Previous 199869 Revisions Next

r34120 Wednesday 31st December, 2014 at 06:53:27 UTC by Miodrag Milanović
Cleanups and version bump
[hash]adam_cass.xml adam_flop.xml apollo_ctape.xml archimedes.xml gamate.xml mtx_cass.xml n64.xml neogeo.xml nes.xml pico.xml sms.xml vz_cass.xml
[src]version.c
[src/emu]luaengine.c machine.c rendlay.c rendlay.h
[src/emu/bus/centronics]epson_lx810l.c
[src/emu/bus/ieee488]c8050fdc.c
[src/emu/bus/isa]cga.c sc499.h
[src/emu/bus/sega8]rom.c rom.h
[src/emu/cpu]cpu.mak
[src/emu/cpu/arc]arc.c arcdasm.c
[src/emu/cpu/arcompact]arcompact.c arcompact.h arcompact_common.c arcompact_execute.c arcompactdasm.c arcompactdasm_dispatch.c arcompactdasm_dispatch.h arcompactdasm_ops.c arcompactdasm_ops.h
[src/emu/cpu/h8]h8_timer16.c
[src/emu/cpu/m68000]m68kcpu.c m68kdasm.c
[src/emu/cpu/pps4]pps4.c pps4.h pps4dasm.c
[src/emu/cpu/sh2]sh2comn.c
[src/emu/cpu/tms0980]tms0980.c tms0980.h
[src/emu/machine]am9517a.c e05a30.c i6300esb.c i82875p.h r10696.c r10696.h r10788.c r10788.h ra17xx.c ra17xx.h smpc.c steppers.c steppers.h
[src/emu/sound]tms5110.c
[src/emu/video]315_5124.c stvvdp2.c tea1002.c
[src/lib/formats]dcp_dsk.c dip_dsk.c fdd_dsk.c nfd_dsk.c victor9k_dsk.c
[src/mame]mame.lst
[src/mame/drivers]5clown.c atvtrack.c barata.c bfm_sc1.c bfm_sc2.c bfm_sc4.c bfm_sc4h.c bwidow.c cps1.c cultures.c dreamwld.c ecoinfr.c f-32.c galpani2.c gts1.c gundealr.c igs009.c jpmimpct.c lindbergh.c maygay1b.c mjkjidai.c mpu3.c mpu4hw.c namcops2.c relief.c renegade.c sbrkout.c snowbros.c taito_f3.c tigeroad.c viper.c wallc.c yunsun16.c
[src/mame/includes]asteroid.h bionicc.h galaxold.h renegade.h yunsun16.h zac2650.h zaccaria.h
[src/mame/machine]atarigen.c
[src/mame/video]chihiro.c galpani2.c segaic16.c tigeroad.c tigeroad_spr.c zac2650.c
[src/mess]mess.mak
[src/mess/drivers]amaztron.c bitgraph.c cnsector.c comp4.c ec184x.c excali64.c gamate.c hp16500.c hp9k_3xx.c intv.c leapster.c mathmagi.c mc1502.c megadriv.c merlin.c ngen.c simon.c starwbc.c stopthie.c tandy12.c ticalc1x.c tispeak.c trs80.c unk3403.c victor9k.c vt240.c
[src/mess/includes]victor9k.h
[src/mess/layout]starwbc.lay
[src/mess/machine]gamecom.c ngen_kb.c sms.c victor9k_fdc.c victor9kb.c
[src/mess/video]apple2.c maria.c
[src/osd/modules/debugger/qt]debugqtdeviceswindow.c debugqtdeviceswindow.h
[src/osd/sdl]input.c video.h window.c window.h

trunk/hash/adam_cass.xml
r242631r242632
968968   </software>
969969
970970<!--
971   <software name="macadam">
972       <description>MacADAM (Fra)</description>
973       <year>1984</year>
974       <publisher>CBS Loisors - Coleco of France</publisher>
971    <software name="macadam">
972        <description>MacADAM (Fra)</description>
973        <year>1984</year>
974        <publisher>CBS Loisors - Coleco of France</publisher>
975975
976       <part name="cass1" interface="adam_cass">
977           <dataarea name="cass" size="262144">
978               <rom name="macadam (1984) (cbs loisors - coleco of france).ddp" size="262144" crc="2fe95d33" sha1="e27e3515644c2fcd28b94b1aed69ae0b2cb76afc" offset="0" />
979           </dataarea>
980       </part>
981   </software>
976        <part name="cass1" interface="adam_cass">
977            <dataarea name="cass" size="262144">
978                <rom name="macadam (1984) (cbs loisors - coleco of france).ddp" size="262144" crc="2fe95d33" sha1="e27e3515644c2fcd28b94b1aed69ae0b2cb76afc" offset="0" />
979            </dataarea>
980        </part>
981    </software>
982982
983   <software name="macadama" cloneof="macadam">
984       <description>MacADAM (Fra, Alt)</description>
985       <year>1984</year>
986       <publisher>CBS Loisors - Coleco of France</publisher>
983    <software name="macadama" cloneof="macadam">
984        <description>MacADAM (Fra, Alt)</description>
985        <year>1984</year>
986        <publisher>CBS Loisors - Coleco of France</publisher>
987987
988       <part name="cass1" interface="adam_cass">
989           <dataarea name="cass" size="262144">
990               <rom name="macadam (1984) (cbs loisors - coleco of france) [a1].ddp" size="262144" crc="5288e332" sha1="4c1de35afefc356db7303f8f584946bbf0f7c528" offset="0" />
991           </dataarea>
992       </part>
993   </software>
988        <part name="cass1" interface="adam_cass">
989            <dataarea name="cass" size="262144">
990                <rom name="macadam (1984) (cbs loisors - coleco of france) [a1].ddp" size="262144" crc="5288e332" sha1="4c1de35afefc356db7303f8f584946bbf0f7c528" offset="0" />
991            </dataarea>
992        </part>
993    </software>
994994-->
995995
996996
trunk/hash/adam_flop.xml
r242631r242632
22<!DOCTYPE softwarelist SYSTEM "softwarelist.dtd">
33<softwarelist name="adam_flop" description="Coleco ADAM diskettes">
44
5   <!--
5   <!--
66   Thanks to SacNews.net for their very comprehensive software database!
7   
7
88   TODO:
9      Add rest of images outside of TOSEC/SacNews databases
10      Proper testing for correct info? (current info is just copy-pasted from filenames)
9       Add rest of images outside of TOSEC/SacNews databases
10       Proper testing for correct info? (current info is just copy-pasted from filenames)
1111   -->
12   
12
1313   <!-- EOS Drivers -->
1414
1515   <software name="homeauto">
r242631r242632
841841         <dataarea name="flop" size="163840">
842842            <rom name="world geography (1985) (a-ware educational software) [a1].dsk" size="163840" crc="c7d26848" sha1="c9581253ac1de95bbb45092bf3aeaa932f4006d7" offset="0" />
843843         </dataarea>
844      </part>   
844      </part>
845845   </software>
846846
847847   <!-- EOS Games -->
848   
848
849849   <software name="2010">
850850      <description>2010 - The Text Adventure Game</description>
851851      <year>1984</year>
r242631r242632
857857         </dataarea>
858858      </part>
859859   </software>
860   
860
861861   <software name="2010a" cloneof="2010">
862862      <description>2010 - The Text Adventure Game (Alt)</description>
863863      <year>1984</year>
r242631r242632
10831083         <dataarea name="flop" size="163840">
10841084            <rom name="adventure pack i (1984) (victory software) [a1].dsk" size="163840" crc="1754bbf4" sha1="a38a4ab0689917e66b3b6dda874f5a4f9ab9415a" offset="0" />
10851085         </dataarea>
1086      </part>     
1086      </part>
10871087   </software>
10881088
10891089   <software name="advpak2v">
r242631r242632
24092409      </part>
24102410   </software>
24112411
2412<!-- From NIAD's blog:
2412<!-- From NIAD's blog:
24132413  Jeopardy for the ADAM Computer is in fact a finshed product which was copyrighted 1984, but for whatever reason (probably
2414  completed just prior to Coleco's announcement in Jan. '85 that they were abandoning the ColecoVision and ADAM), Coleco
2415  decided not to release it commercially. They instead made it available to ADAM Users Groups circa 1985/1986 to share with
2416  the ADAM Community with the requirement that all copyright information would be removed from the program. Because of
2417  this requirement by Coleco, you will see multiple versions of Jeopardy available for download that have been hacked to
2418  change two title screens. This hacking actually eliminated the first title screen and then replaced the copyright information on
2414  completed just prior to Coleco's announcement in Jan. '85 that they were abandoning the ColecoVision and ADAM), Coleco
2415  decided not to release it commercially. They instead made it available to ADAM Users Groups circa 1985/1986 to share with
2416  the ADAM Community with the requirement that all copyright information would be removed from the program. Because of
2417  this requirement by Coleco, you will see multiple versions of Jeopardy available for download that have been hacked to
2418  change two title screens. This hacking actually eliminated the first title screen and then replaced the copyright information on
24192419  the second.
2420  When the original Jeopardy program was copied from data pack (256K max size) to disk (160K max size) a portion of the
2421  program that contained game play data/questions was lost to the ages. This disk version which floated around for a while
2422  would eventually crash due to the missing data, but this was later patched by Walters Software Co.'s Jim Walters to recycle to
2420  When the original Jeopardy program was copied from data pack (256K max size) to disk (160K max size) a portion of the
2421  program that contained game play data/questions was lost to the ages. This disk version which floated around for a while
2422  would eventually crash due to the missing data, but this was later patched by Walters Software Co.'s Jim Walters to recycle to
24232423  the beginning of the questions.
24242424
2425  In 1992, a member of NIAD had the tremendous fortune to come in contact with a former Coleco employee who was looking
2426  to sell off his entire lot of ADAM gear... a number of never before seen hardware and software protos included. In this lot was
2427  [...] a 2-disk version of Jeopardy. I have not tested this 2-disk version thoroughly, but it does seem to work properly and
2428  should be the version that you use as more than likely it is the complete version that would have been released for
2429  commercial sale.
2425  In 1992, a member of NIAD had the tremendous fortune to come in contact with a former Coleco employee who was looking
2426  to sell off his entire lot of ADAM gear... a number of never before seen hardware and software protos included. In this lot was
2427  [...] a 2-disk version of Jeopardy. I have not tested this 2-disk version thoroughly, but it does seem to work properly and
2428  should be the version that you use as more than likely it is the complete version that would have been released for
2429  commercial sale.
24302430 -->
24312431
24322432   <software name="jeopardy">
r242631r242632
31953195         <dataarea name="flop" size="163840">
31963196            <rom name="robothief (1991) (steve pitman software) [a1].dsk" size="163840" crc="8df50a33" sha1="69fde2a68c6c22ae268a209bc9054f6e7206c541" offset="0" />
31973197         </dataarea>
3198      </part>     
3198      </part>
31993199   </software>
32003200
32013201   <software name="rubychal">
r242631r242632
34503450      </part>
34513451   </software>
34523452
3453<!-- From NIAD's blog:
3454  The original prototype/demo/unreleased version as was obtained from Epyx was indeed buggy, but this mainly dealt with the
3455  inability to get it working on a disk, it was originally supplied on data pack, the save feature was a mess and there were a
3456  number of menu (especially at the start of the game) that were messed up. A programmer by the name of Joe Waters spent
3457  considerable time fixing these issues or most of them to get it to the state we now know. He actually lived in Albuquerque and
3458  released software for the ADAM under the Federation Software label and did the Temple hack and some others under the
3453<!-- From NIAD's blog:
3454  The original prototype/demo/unreleased version as was obtained from Epyx was indeed buggy, but this mainly dealt with the
3455  inability to get it working on a disk, it was originally supplied on data pack, the save feature was a mess and there were a
3456  number of menu (especially at the start of the game) that were messed up. A programmer by the name of Joe Waters spent
3457  considerable time fixing these issues or most of them to get it to the state we now know. He actually lived in Albuquerque and
3458  released software for the ADAM under the Federation Software label and did the Temple hack and some others under the
34593459  Falcon Federation Hack Group (or something like that) label.
34603460-->
34613461   <software name="apshai">
r242631r242632
40004000   </software>
40014001
40024002   <!-- EOS Graphics Design -->
4003   
4003
40044004   <software name="adamgfx">
40054005      <description>ADAM Graphics</description>
40064006      <year>199?</year>
r242631r242632
54215421   </software>
54225422
54235423   <!-- EOS Productivity -->
5424   
5424
54255425   <software name="atgradeb">
54265426      <description>A-Tech Gradebook</description>
54275427      <year>198?</year>
r242631r242632
54335433         </dataarea>
54345434      </part>
54355435   </software>
5436   
5436
54375437   <software name="atgradeba" cloneof="atgradeb">
54385438      <description>A-Tech Gradebook (Alt)</description>
54395439      <year>198?</year>
r242631r242632
54675467         <dataarea name="flop" size="163840">
54685468            <rom name="adam agenda - the personal schedule keeper (198x) (jeff harris) [a1].dsk" size="163840" crc="057fd444" sha1="21b76438a43a4e19a1b996789f2073cf25654a19" offset="0" />
54695469         </dataarea>
5470      </part>   
5470      </part>
54715471   </software>
54725472
54735473   <software name="fbanalyz">
r242631r242632
72317231
72327232
72337233   <!-- EOS Programming -->
7234   
7234
72357235   <software name="adambas">
72367236      <description>ADAM Basic (v1.6)</description>
72377237      <year>198?</year>
r242631r242632
78427842         </dataarea>
78437843      </part>
78447844   </software>
7845   
7845
78467846   <software name="smartlog">
78477847      <description>SmartLOGO</description>
78487848      <year>1984</year>
r242631r242632
78547854         </dataarea>
78557855      </part>
78567856   </software>
7857   
7857
78587858   <software name="smartloga" cloneof="smartlog">
78597859      <description>SmartLOGO (Alt)</description>
78607860      <year>1984</year>
r242631r242632
78667866         </dataarea>
78677867      </part>
78687868   </software>
7869   
7869
78707870   <software name="smartlogb" cloneof="smartlog">
78717871      <description>SmartLOGO (Alt 2)</description>
78727872      <year>1984</year>
r242631r242632
80158015         </dataarea>
80168016      </part>
80178017   </software>
8018   
8018
80198019   <software name="anetdata">
80208020      <description>A-Net ADAM BBS - Data Files</description>
80218021      <year>1990</year>
r242631r242632
98169816         <dataarea name="flop" size="163840">
98179817            <rom name="turbodisk v1.0 (1987) (digital express inc.) [a1].dsk" size="163840" crc="bf60a7bb" sha1="ca04851345a882589f1b8d97b11df1643ad4e947" offset="0" />
98189818         </dataarea>
9819      </part>     
9819      </part>
98209820   </software>
98219821
98229822   <software name="turbload">
r242631r242632
99369936         <dataarea name="flop" size="163840">
99379937            <rom name="xrampak i (1987) (digital express inc.) [a1].dsk" size="163840" crc="dc40400b" sha1="aeebdcf76d6fd369fe1720b0a57a48089ac8e050" offset="0" />
99389938         </dataarea>
9939      </part>     
9939      </part>
99409940   </software>
99419941
99429942   <!-- EOS Public Domain - ADAMLand -->
r242631r242632
99669966   </software>
99679967
99689968   <!-- EOS Public Domain - ADAM Users Group -->
9969   
9969
99709970   <software name="augutils">
99719971      <description>A.U.G. - Utilities</description>
99729972      <year>198?</year>
r242631r242632
1232812328   </software>
1232912329
1233012330   <!-- EOS Public Domain - Nibbles & Bits -->
12331   
12331
1233212332   <software name="nbbas01">
1233312333      <description>N&amp;B - Basic Vol. #01</description>
1233412334      <year>198?</year>
r242631r242632
1358213582   </software>
1358313583
1358413584   <!-- EOS Public Domain - Puget Sound ADAM Network -->
13585   
13585
1358613586   <software name="psanutil">
1358713587      <description>P.S.A.N. - Utilities</description>
1358813588      <year>198?</year>
r242631r242632
1380713807   </software>
1380813808
1380913809   <!-- CP/M Drivers -->
13810   
13810
1381113811   <software name="evecpm">
1381213812      <description>EVE CP/M Utilities</description>
1381313813      <year>198?</year>
r242631r242632
1384613846
1384713847   <!-- CP/M Games -->
1384813848
13849<!-- This is a collection of Scott Adams' adventures -->   
13849<!-- This is a collection of Scott Adams' adventures -->
1385013850   <software name="adventur">
1385113851      <description>Adventure (Scott Adams)</description>
1385213852      <year>198?</year>
r242631r242632
1426914269   </software>
1427014270
1427114271   <!-- CP/M Public Domain - Misc -->
14272   
14272
1427314273   <software name="cpmpd01">
1427414274      <description>CP-M 2.2 or T-DOS P.D. Vol. #01</description>
1427514275      <year>198?</year>
r242631r242632
1433114331   </software>
1433214332
1433314333   <!-- CP/M Public Domain - Northern Illiana ADAM User's Group -->
14334   
14334
1433514335   <software name="cndv01">
1433614336      <description>N.I.A.D. - CP/M CNDV #01</description>
1433714337      <year>198?</year>
r242631r242632
1511115111   </software>
1511215112
1511315113   <!-- CP/M PrintMaster Artwork -->
15114   
15114
1511515115   <software name="printm01">
1511615116      <description>PrintMaster Artwork - ADAMGR01</description>
1511715117      <year>198?</year>
r242631r242632
1586915869   </software>
1587015870
1587115871   <!-- CP/M Productivity -->
15872   
15872
1587315873   <software name="abovepls">
1587415874      <description>Above Plus</description>
1587515875      <year>198?</year>
r242631r242632
1604616046   </software>
1604716047
1604816048   <!-- CP/M Programming -->
16049   
16049
1605016050   <software name="dazzstar">
1605116051      <description>DazzleStar Disassembler</description>
1605216052      <year>1986</year>
r242631r242632
1619416194   </software>
1619516195
1619616196   <!-- CP/M Utilities -->
16197   
16197
1619816198   <software name="1kutils">
1619916199      <description>1K Utilities</description>
1620016200      <year>198?</year>
r242631r242632
1625616256   </software>
1625716257
1625816258   <!-- ADAM News Network -->
16259   
16259
1626016260   <software name="ann9103">
1626116261      <description>ANN Disk - 1991-03 - E.O.S. Files</description>
1626216262      <year>1991</year>
trunk/hash/apollo_ctape.xml
r242631r242632
33
44<!-- Domain/OS Known Undumped Versions (from http://www.hpmuseum.net/exhibit.php?swc=24)
55
6       Domain/OS SR10.3 (1990) Product Number 018847 + 018848
7       Domain/OS Quarterly PSK Q3-91 SR10.3 (1991) Product Number 19437 + 19439
6         Domain/OS SR10.3 (1990) Product Number 018847 + 018848
7         Domain/OS Quarterly PSK Q3-91 SR10.3 (1991) Product Number 19437 + 19439
88
99-->
1010
trunk/hash/archimedes.xml
r242631r242632
786786         <dataarea name="flop" size="819200">
787787            <rom name="enigma (1993)(archimedes world)[a].adf" size="819200" crc="9277d658" sha1="2bdd2d1f53ee5f359f12adb8b20e915d12978de0" offset="0" />
788788         </dataarea>
789      </part>     
789      </part>
790790   </software>
791791
792792   <software name="enigmab" cloneof="enigma" supported="no">
r242631r242632
10751075         <dataarea name="flop" size="819200">
10761076            <rom name="mad professor mariarti (1990)(krisalis)[a].adf" size="819200" crc="020e0e93" sha1="e64f832705c6923edcec7e85df4cceafe30b817e" offset="0" />
10771077         </dataarea>
1078      </part>   
1078      </part>
10791079   </software>
10801080
10811081   <software name="mariartib" cloneof="mariarti" supported="no">
r242631r242632
15041504         <dataarea name="flop" size="819200">
15051505            <rom name="super pool (1991)(fourth dimension)[a].adf" size="819200" crc="8fa28978" sha1="10d451076f38ab48e4b9bd754fdcb4c634935c36" offset="0" />
15061506         </dataarea>
1507      </part>     
1507      </part>
15081508   </software>
15091509
15101510   <software name="suprpoolb" cloneof="suprpool" supported="no">
r242631r242632
17691769         </dataarea>
17701770      </part>
17711771   </software>
1772   
17731772
1773
17741774<!-- Other disks to sort (homebrew?!?) -->
17751775
17761776   <software name="3dtanks" supported="no">
r242631r242632
20012001         <dataarea name="flop" size="819200">
20022002            <rom name="hacker, the v3.05 (1993)(doggysoft)[a].adf" size="819200" crc="c6a88514" sha1="b02d6495f6a9a1099cb06cac7d0e0d1756f175a0" offset="0" />
20032003         </dataarea>
2004      </part>     
2004      </part>
20052005   </software>
20062006
20072007   <software name="hackerb" cloneof="hacker" supported="no">
r242631r242632
22132213         <dataarea name="flop" size="820224">
22142214            <rom name="acorn archimedes risc os application suite v1.00 (19xx)(acorn)(disk 2 of 2)[req risc os].adf" size="820224" crc="d5fdf2ca" sha1="bfc96eff8cab5b61f6db82dd135dd95b32f40d4f" offset="0" />
22152215         </dataarea>
2216      </part>     
2216      </part>
22172217   </software>
22182218
22192219   <software name="riscappsa" cloneof="riscapps" supported="no">
trunk/hash/gamate.xml
r242631r242632
11<?xml version="1.0"?>
22<!DOCTYPE softwarelist SYSTEM "softwarelist.dtd">
33
4<!--
4<!--
55Undumped carts, based on Wikipedia list
66C1010 - Bump N' Run (Unreleased?)
77C1016 - Volcano Panic
trunk/hash/mtx_cass.xml
r242631r242632
33
44<softwarelist name="mtx_cass" description="Memotech MTX cassettes">
55
6<!--
6<!--
77TODO: find out why the driver does not recognize the program on the tapes...
88-->
99
trunk/hash/n64.xml
r242631r242632
31093109<!--
31103110Note from marshallh about the dongle present in the Rare proto/demo above
31113111"The dongle is a pass-through, except that there is an Altera
3112MAX7000 series CPLD intercepting the AD16 bus. This lets
3113all normal bus transactions through, but in the special case
3112MAX7000 series CPLD intercepting the AD16 bus. This lets
3113all normal bus transactions through, but in the special case
31143114mentioned below, takes control of the bus and gives its own data."
31153115
31163116We currently don't emulate this, and thus we include also versions where the dongle checks have been
trunk/hash/neogeo.xml
r242631r242632
438438         <dataarea name="mcu" size="0x2000">
439439            <!-- Hitachi HD6301V1 MCU -->
440440            <rom offset="0x000000" size="0x02000" name="rhcom.bin" crc="e5cd6306" sha1="f6bbb8ae562804d67e137290c765c3589fa334c0" />
441        <!-- dumped from a prototype with external ROM, not 100% confirmed as being the same on a final, or other games (lbowling, trally) -->
441      <!-- dumped from a prototype with external ROM, not 100% confirmed as being the same on a final, or other games (lbowling, trally) -->
442442         </dataarea>
443443         <dataarea name="fixed" size="0x040000">
444444            <rom offset="0x000000" size="0x020000" name="006-s1.s1" crc="eb5189f0" sha1="0239c342ea62e73140a2306052f226226461a478" />
r242631r242632
491491         <dataarea name="mcu" size="0x2000">
492492            <!-- Hitachi HD6301V1 MCU -->
493493            <rom offset="0x000000" size="0x02000" name="rhcom.bin" crc="e5cd6306" sha1="f6bbb8ae562804d67e137290c765c3589fa334c0" />
494        <!-- dumped from a prototype with external ROM, not 100% confirmed as being the same on a final, or other games (lbowling, trally) -->
494      <!-- dumped from a prototype with external ROM, not 100% confirmed as being the same on a final, or other games (lbowling, trally) -->
495495         </dataarea>
496496         <dataarea name="fixed" size="0x040000">
497497            <rom offset="0x000000" size="0x020000" name="006-s1.s1" crc="eb5189f0" sha1="0239c342ea62e73140a2306052f226226461a478" />
trunk/hash/nes.xml
r242631r242632
7663276632      <year>19??</year>
7663376633      <publisher>&lt;pirate&gt;</publisher>
7663476634      <part name="cart" interface="nes_cart">
76635         <feature name="slot" value="bmc_hik300" />   <!-- mapper says 217 but it's not gc6in1 either! -->
76635         <feature name="slot" value="bmc_hik300" />  <!-- mapper says 217 but it's not gc6in1 either! -->
7663676636         <dataarea name="chr" size="65536">
7663776637            <rom name="500-in-1 (anim splash, no rev, alt mapper)[p1][!].chr" size="65536" crc="25bdd64a" sha1="1f95eaf20fec9058b6917aa47dbdcec4b7a5b87d" offset="00000" status="baddump" />
7663876638         </dataarea>
r242631r242632
7664776647      <year>19??</year>
7664876648      <publisher>&lt;pirate&gt;</publisher>
7664976649      <part name="cart" interface="nes_cart">
76650         <feature name="slot" value="bmc_hik300" />   <!-- mapper says 217 but it's not gc6in1 either! -->
76650         <feature name="slot" value="bmc_hik300" />  <!-- mapper says 217 but it's not gc6in1 either! -->
7665176651         <dataarea name="chr" size="65536">
7665276652            <rom name="500-in-1 (static splash, no rev, alt mapper)[p1][!].chr" size="65536" crc="e7dacb8a" sha1="ece1b9c7fd8be955a1df6c8505533b4fac194eeb" offset="00000" status="baddump" />
7665376653         </dataarea>
r242631r242632
7757677576      <year>19??</year>
7757777577      <publisher>&lt;pirate&gt;</publisher>
7757877578      <part name="cart" interface="nes_cart">
77579         <feature name="slot" value="bmc_hik300" />   <!-- mapper says 217 but it's not gc6in1 either! -->
77579         <feature name="slot" value="bmc_hik300" />  <!-- mapper says 217 but it's not gc6in1 either! -->
7758077580         <dataarea name="chr" size="65536">
7758177581            <rom name="9999999-in-1 (static splash, no rev, alt mapper)[p1][!].chr" size="65536" crc="25bdd64a" sha1="1f95eaf20fec9058b6917aa47dbdcec4b7a5b87d" offset="00000" status="baddump" />
7758277582         </dataarea>
trunk/hash/pico.xml
r242631r242632
736736      <publisher>Samsung</publisher>
737737      <info name="serial" value="T-102021-08 ~ PICO-9507S"/>
738738      <part name="cart" interface="pico_cart">
739         <feature name="pcb" value="??" />   <!-- non-Sega PCB, probably by Samsung -->
739         <feature name="pcb" value="??" />   <!-- non-Sega PCB, probably by Samsung -->
740740         <feature name="ic1" value="PICO-9507S" />
741741         <dataarea name="rom" size="524288">
742742            <rom name="pico-9507s.ic1" size="524288" crc="042520ce" sha1="5dd748a1bdfc661d0b96f6a1d26babc6a0ae7f2d" offset="000000" loadflag="load16_word_swap" />
trunk/hash/sms.xml
r242631r242632
868868   </software>
869869
870870<!--
871    The labelling of Hi-Com multigame carts is arbitrary. The boxes appears to what was intended as unique product number
872    but boxes are typically mixed up and patched with stickers added to change game titles (on both boxes and cartridges)
873    making the product number rather unreliable AND realistically we may never find out the correct numbers.
871    The labelling of Hi-Com multigame carts is arbitrary. The boxes appears to what was intended as unique product number
872    but boxes are typically mixed up and patched with stickers added to change game titles (on both boxes and cartridges)
873    making the product number rather unreliable AND realistically we may never find out the correct numbers.
874874-->
875875   <software name="hicom3a">
876876      <description>The Best Game Collection - Hang On + Pit Pot + Spy vs Spy (Kor)</description>
trunk/hash/vz_cass.xml
r242631r242632
55
66List of known tape releases by Dick Smith in Australia:
77
8X-7274   Attack of the Killer Tomatoes
9X-7231   Match Box
10X-7232   Poker
11X-7233   Hangman
12X-7234   Slot Machine/Knock Off/Russian Roulette
13X-7235   Blackjack
14X-7236   Circus (*)
15X-7237   Biorhythm/Pair Matching/Calendar
16X-7238   Horse Race
17X-7239   Invaders (*)
18X-7240   Dynasty Derby
19X-7241   Learjet
20X-7242   Ghost Hunter (*)
21X-7243   Hoppy (*)
22X-7244   Super Snake
23X-7245   Knights and Dragons
24X-7247   Star Blaster (*)
25X-7248   VZ-Asteroids
26X-7249   Air Traffic Controller
27X-7250   Lunar Lander
28X-7251   Statistics 1
29X-7252   Statistics 2
30X-7253   Matrix
31X-7254   Tennis Lesson/Golf Lesson
32X-7255   Introduction to BASIC
33X-7256   Elementary Geometry
34X-7257   Speed Reading
35X-7258   Typing Teacher
36X-7259   Mailing List
37X-7261   Portfolio Management
38X-7262   Discounted Cash Flow Analysis
39X-7263   Financial Ratio Analysis
40X-7264   Tennis (*)
41X-7265   Checkers
42X-7266   Planet Patrol (*)
43X-7268   Ladder Challenge (*)
44X-7270   Panik (*)
45X-7271   Othello
46X-7272   Dracula's Castle
47X-7273   Backgammon
48X-7275   VZ Chess (*)
49X-7276   Music Writer
50X-7278   Disassembler
51X-7279   Duel
52X-7280   Hex Utilities
53X-7281   Word Processor
54X-7282   Editor Assembler
55X-7285   Spell'O'Matic 1 & 2
56X-7286   Spell'O'Matic 3 & 4
57X-7287   Flashword 1 & 2
58X-7288   Flashword 3 & 4
59X-7289   Metric Spycatcher
60X-7290   Whizkid Spycatcher
61X-7330   Sprite Generator
62X-7331   Formula One
63X-7332   Galaxon (*)
64X-7333   Dawn Patrol (*)
65X-7339   Space RAM
66X-7342   Crash
67X-7344   Maze of Argon
68X-7345   Word Matching
8X-7274  Attack of the Killer Tomatoes
9X-7231  Match Box
10X-7232  Poker
11X-7233  Hangman
12X-7234  Slot Machine/Knock Off/Russian Roulette
13X-7235  Blackjack
14X-7236  Circus (*)
15X-7237  Biorhythm/Pair Matching/Calendar
16X-7238  Horse Race
17X-7239  Invaders (*)
18X-7240  Dynasty Derby
19X-7241  Learjet
20X-7242  Ghost Hunter (*)
21X-7243  Hoppy (*)
22X-7244  Super Snake
23X-7245  Knights and Dragons
24X-7247  Star Blaster (*)
25X-7248  VZ-Asteroids
26X-7249  Air Traffic Controller
27X-7250  Lunar Lander
28X-7251  Statistics 1
29X-7252  Statistics 2
30X-7253  Matrix
31X-7254  Tennis Lesson/Golf Lesson
32X-7255  Introduction to BASIC
33X-7256  Elementary Geometry
34X-7257  Speed Reading
35X-7258  Typing Teacher
36X-7259  Mailing List
37X-7261  Portfolio Management
38X-7262  Discounted Cash Flow Analysis
39X-7263  Financial Ratio Analysis
40X-7264  Tennis (*)
41X-7265  Checkers
42X-7266  Planet Patrol (*)
43X-7268  Ladder Challenge (*)
44X-7270  Panik (*)
45X-7271  Othello
46X-7272  Dracula's Castle
47X-7273  Backgammon
48X-7275  VZ Chess (*)
49X-7276  Music Writer
50X-7278  Disassembler
51X-7279  Duel
52X-7280  Hex Utilities
53X-7281  Word Processor
54X-7282  Editor Assembler
55X-7285  Spell'O'Matic 1 & 2
56X-7286  Spell'O'Matic 3 & 4
57X-7287  Flashword 1 & 2
58X-7288  Flashword 3 & 4
59X-7289  Metric Spycatcher
60X-7290  Whizkid Spycatcher
61X-7330  Sprite Generator
62X-7331  Formula One
63X-7332  Galaxon (*)
64X-7333  Dawn Patrol (*)
65X-7339  Space RAM
66X-7342  Crash
67X-7344  Maze of Argon
68X-7345  Word Matching
6969
7070* = dumped
7171
trunk/src/emu/bus/centronics/epson_lx810l.c
r242631r242632
176176   MCFG_STEPPER_END_INDEX(24)
177177   MCFG_STEPPER_INDEX_PATTERN(0x00)
178178   MCFG_STEPPER_INIT_PHASE(2)
179   
179
180180MACHINE_CONFIG_END
181181
182182//-------------------------------------------------
r242631r242632
345345
346346void epson_lx810l_t::device_start()
347347{
348
349348}
350349
351350
trunk/src/emu/bus/ieee488/c8050fdc.c
r242631r242632
2020#define LOG 1
2121
2222#define GCR_DECODE(_e, _i) \
23    ((BIT(_e, 6) << 7) | (BIT(_i, 7) << 6) | (_e & 0x33) | (BIT(_e, 2) << 3) | (_i & 0x04))
23   ((BIT(_e, 6) << 7) | (BIT(_i, 7) << 6) | (_e & 0x33) | (BIT(_e, 2) << 3) | (_i & 0x04))
2424
2525#define GCR_ENCODE(_e, _i) \
26    ((_e & 0xc0) << 2 | (_i & 0x80) | (_e & 0x3c) << 1 | (_i & 0x04) | (_e & 0x03))
26   ((_e & 0xc0) << 2 | (_i & 0x80) | (_e & 0x3c) << 1 | (_i & 0x04) | (_e & 0x03))
2727
2828
2929
trunk/src/emu/bus/isa/cga.c
r242631r242632
365365   astring tempstring;
366366   m_chr_gen_base = memregion(subtag(tempstring, "gfx1"))->base();
367367   m_chr_gen = m_chr_gen_base + m_chr_gen_offset[1];
368   
368
369369   save_item(NAME(m_framecnt));
370370   save_item(NAME(m_mode_control));
371371   save_item(NAME(m_color_select));
r242631r242632
374374   save_item(NAME(m_vsync));
375375   save_item(NAME(m_hsync));
376376   save_item(NAME(m_vram));
377   save_item(NAME(m_plantronics));
377   save_item(NAME(m_plantronics));
378378}
379379
380380
trunk/src/emu/bus/isa/sc499.h
r242631r242632
2828public:
2929   // construction/destruction
3030   sc499_ctape_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
31   
31
3232   // image-level overrides
3333   virtual bool call_load();
3434   virtual bool call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry) { return load_software(swlist, swname, start_entry); }
3535   virtual void call_unload();
3636   virtual iodevice_t image_type() const { return IO_MAGTAPE; }
37   
37
3838   virtual bool is_readable()  const { return 1; }
3939   virtual bool is_writeable() const { return 1; }
4040   virtual bool is_creatable() const { return 1; }
trunk/src/emu/bus/sega8/rom.c
r242631r242632
899899
900900
901901/*-------------------------------------------------
902
902
903903 Hi-Com X-in-1 cart, uses writes to 0xffff to
904904 change program bank in 0x0000-0x7fff
905
905
906906 -------------------------------------------------*/
907907
908908READ8_MEMBER(sega8_hicom_device::read_cart)
909909{
910910   if (offset >= 0x8000)
911911      return m_rom[offset & 0x3fff];
912   
912
913913   return m_rom[(m_rom_bank_base * 0x8000) + offset];
914914}
915915
trunk/src/emu/bus/sega8/rom.h
r242631r242632
318318public:
319319   // construction/destruction
320320   sega8_hicom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
321   
321
322322   // device-level overrides
323323   virtual void device_start() { save_item(NAME(m_rom_bank_base)); }
324   
324
325325   virtual void late_bank_setup();
326   
326
327327   // reading and writing
328328   virtual DECLARE_READ8_MEMBER(read_cart);
329329   virtual DECLARE_WRITE8_MEMBER(write_cart) {}
330330   virtual DECLARE_WRITE8_MEMBER(write_mapper);
331   
331
332332protected:
333333   UINT8 m_rom_bank_base;
334334};
trunk/src/emu/cpu/arc/arc.c
r242631r242632
9999
100100void arc_device::execute_set_input(int irqline, int state)
101101{
102
103102}
104103
105104
trunk/src/emu/cpu/arc/arcdasm.c
r242631r242632
6868   /* 03 */ "PL", // (aka P          - Positive)
6969   /* 04 */ "MI", // (aka N          - Negative)
7070   /* 05 */ "CS", // (aka C,  LO     - Carry set / Lower than) (unsigned)
71   /* 06 */ "CC", // (aka CC, NC, HS - Carry Clear / Higher or Same) (unsigned)
71   /* 06 */ "CC", // (aka CC, NC, HS - Carry Clear / Higher or Same) (unsigned)
7272   /* 07 */ "VS", // (aka V          - Overflow set)
7373   /* 08 */ "VC", // (aka NV         - Overflow clear)
7474   /* 09 */ "GT", // (               - Greater than) (signed)
r242631r242632
204204      case 0x05: // BL
205205      print("%s(%s)(%s) %08x", basic[opcode], conditions[ARC_CONDITION], delaytype[ARC_BRANCH_DELAY], (ARC_BRANCH_ADDR<<2)+pc+4);
206206      break;
207   
207
208208      case 0x08: // ADD
209209      // todo, short / long immediate formats
210210      print("%s %s , %s , %s (%08x)", basic[opcode], regnames[ARC_REGOP_DEST], regnames[ARC_REGOP_OP1], regnames[ARC_REGOP_OP2], op &~ 0xfffffe00);
trunk/src/emu/cpu/arcompact/arcompact.c
r242631r242632
164164
165165
166166/*****************************************************************************/
167   
168167
168
169169void arcompact_device::execute_set_input(int irqline, int state)
170170{
171
172171}
trunk/src/emu/cpu/arcompact/arcompact.h
r242631r242632
2121ARCOMPACT_RETTYPE arcompact_handle##name##_p11(OPS_32) \
2222{ \
2323   int M = (op & 0x00000020) >> 5; \
24    \
24      \
2525   switch (M) \
2626   { \
2727      case 0x00: return arcompact_handle##name##_p11_m0(PARAMS); \
2828      case 0x01: return arcompact_handle##name##_p11_m1(PARAMS); \
2929   } \
30    \
30      \
3131   return 0; \
32}; \
33
32};
3433#define ARCOMPACT_HANDLER04_TYPE(name) \
3534ARCOMPACT_RETTYPE arcompact_handle##name(OPS_32) \
3635{ \
r242631r242632
4544   } \
4645   \
4746   return 0; \
48}; \
47};
4948
50
5149#define ARCOMPACT_HANDLER04_TYPE_PM(name) \
5250   ARCOMPACT_RETTYPE arcompact_handle##name##_p00(OPS_32); \
5351   ARCOMPACT_RETTYPE arcompact_handle##name##_p01(OPS_32); \
r242631r242632
5553   ARCOMPACT_RETTYPE arcompact_handle##name##_p11_m0(OPS_32); \
5654   ARCOMPACT_RETTYPE arcompact_handle##name##_p11_m1(OPS_32); \
5755   ARCOMPACT_HANDLER04_P11_TYPE(name); \
58   ARCOMPACT_HANDLER04_TYPE(name); \
56   ARCOMPACT_HANDLER04_TYPE(name);
5957
60
6158class arcompact_device : public cpu_device
6259{
6360public:
r242631r242632
146143   ARCOMPACT_RETTYPE arcompact_handle01_01_01_0f(OPS_32);
147144   ARCOMPACT_RETTYPE arcompact_handle02(OPS_32);
148145   ARCOMPACT_RETTYPE arcompact_handle03(OPS_32);
149//   ARCOMPACT_RETTYPE arcompact_handle04_00(OPS_32);
146//  ARCOMPACT_RETTYPE arcompact_handle04_00(OPS_32);
150147   ARCOMPACT_RETTYPE arcompact_handle04_01(OPS_32);
151//   ARCOMPACT_RETTYPE arcompact_handle04_02(OPS_32);
148//  ARCOMPACT_RETTYPE arcompact_handle04_02(OPS_32);
152149   ARCOMPACT_RETTYPE arcompact_handle04_03(OPS_32);
153//   ARCOMPACT_RETTYPE arcompact_handle04_04(OPS_32);
154//   ARCOMPACT_RETTYPE arcompact_handle04_05(OPS_32);
155//   ARCOMPACT_RETTYPE arcompact_handle04_06(OPS_32);
156//   ARCOMPACT_RETTYPE arcompact_handle04_07(OPS_32);
150//  ARCOMPACT_RETTYPE arcompact_handle04_04(OPS_32);
151//  ARCOMPACT_RETTYPE arcompact_handle04_05(OPS_32);
152//  ARCOMPACT_RETTYPE arcompact_handle04_06(OPS_32);
153//  ARCOMPACT_RETTYPE arcompact_handle04_07(OPS_32);
157154   ARCOMPACT_RETTYPE arcompact_handle04_08(OPS_32);
158155   ARCOMPACT_RETTYPE arcompact_handle04_09(OPS_32);
159//   ARCOMPACT_RETTYPE arcompact_handle04_0a(OPS_32);
156//  ARCOMPACT_RETTYPE arcompact_handle04_0a(OPS_32);
160157   ARCOMPACT_RETTYPE arcompact_handle04_0b(OPS_32);
161158   ARCOMPACT_RETTYPE arcompact_handle04_0c(OPS_32);
162159   ARCOMPACT_RETTYPE arcompact_handle04_0d(OPS_32);
163//   ARCOMPACT_RETTYPE arcompact_handle04_0e(OPS_32);
164//   ARCOMPACT_RETTYPE arcompact_handle04_0f(OPS_32);
160//  ARCOMPACT_RETTYPE arcompact_handle04_0e(OPS_32);
161//  ARCOMPACT_RETTYPE arcompact_handle04_0f(OPS_32);
165162   ARCOMPACT_RETTYPE arcompact_handle04_10(OPS_32);
166163   ARCOMPACT_RETTYPE arcompact_handle04_11(OPS_32);
167164   ARCOMPACT_RETTYPE arcompact_handle04_12(OPS_32);
168//   ARCOMPACT_RETTYPE arcompact_handle04_13(OPS_32);
169//   ARCOMPACT_RETTYPE arcompact_handle04_14(OPS_32);
170//   ARCOMPACT_RETTYPE arcompact_handle04_15(OPS_32);
171//   ARCOMPACT_RETTYPE arcompact_handle04_16(OPS_32);
172//   ARCOMPACT_RETTYPE arcompact_handle04_17(OPS_32);
173//   ARCOMPACT_RETTYPE arcompact_handle04_18(OPS_32);
174//   ARCOMPACT_RETTYPE arcompact_handle04_19(OPS_32);
165//  ARCOMPACT_RETTYPE arcompact_handle04_13(OPS_32);
166//  ARCOMPACT_RETTYPE arcompact_handle04_14(OPS_32);
167//  ARCOMPACT_RETTYPE arcompact_handle04_15(OPS_32);
168//  ARCOMPACT_RETTYPE arcompact_handle04_16(OPS_32);
169//  ARCOMPACT_RETTYPE arcompact_handle04_17(OPS_32);
170//  ARCOMPACT_RETTYPE arcompact_handle04_18(OPS_32);
171//  ARCOMPACT_RETTYPE arcompact_handle04_19(OPS_32);
175172   ARCOMPACT_RETTYPE arcompact_handle04_1a(OPS_32);
176173   ARCOMPACT_RETTYPE arcompact_handle04_1b(OPS_32);
177174   ARCOMPACT_RETTYPE arcompact_handle04_1c(OPS_32);
178175   ARCOMPACT_RETTYPE arcompact_handle04_1d(OPS_32);
179//   ARCOMPACT_RETTYPE arcompact_handle04_20(OPS_32);
176//  ARCOMPACT_RETTYPE arcompact_handle04_20(OPS_32);
180177   ARCOMPACT_RETTYPE arcompact_handle04_21(OPS_32);
181178   ARCOMPACT_RETTYPE arcompact_handle04_22(OPS_32);
182179   ARCOMPACT_RETTYPE arcompact_handle04_23(OPS_32);
183180   ARCOMPACT_RETTYPE arcompact_handle04_28(OPS_32);
184181   ARCOMPACT_RETTYPE arcompact_handle04_29(OPS_32);
185182   ARCOMPACT_RETTYPE arcompact_handle04_2a(OPS_32);
186//   ARCOMPACT_RETTYPE arcompact_handle04_2b(OPS_32);
183//  ARCOMPACT_RETTYPE arcompact_handle04_2b(OPS_32);
187184   ARCOMPACT_RETTYPE arcompact_handle04_2f_00(OPS_32);
188185   ARCOMPACT_RETTYPE arcompact_handle04_2f_01(OPS_32);
189//   ARCOMPACT_RETTYPE arcompact_handle04_2f_02(OPS_32);
186//  ARCOMPACT_RETTYPE arcompact_handle04_2f_02(OPS_32);
190187   ARCOMPACT_RETTYPE arcompact_handle04_2f_03(OPS_32);
191188   ARCOMPACT_RETTYPE arcompact_handle04_2f_04(OPS_32);
192189   ARCOMPACT_RETTYPE arcompact_handle04_2f_05(OPS_32);
193190   ARCOMPACT_RETTYPE arcompact_handle04_2f_06(OPS_32);
194//   ARCOMPACT_RETTYPE arcompact_handle04_2f_07(OPS_32);
195//   ARCOMPACT_RETTYPE arcompact_handle04_2f_08(OPS_32);
191//  ARCOMPACT_RETTYPE arcompact_handle04_2f_07(OPS_32);
192//  ARCOMPACT_RETTYPE arcompact_handle04_2f_08(OPS_32);
196193   ARCOMPACT_RETTYPE arcompact_handle04_2f_09(OPS_32);
197194   ARCOMPACT_RETTYPE arcompact_handle04_2f_0a(OPS_32);
198195   ARCOMPACT_RETTYPE arcompact_handle04_2f_0b(OPS_32);
r242631r242632
779776   ARCOMPACT_HANDLER04_TYPE_PM(04_14);
780777   ARCOMPACT_HANDLER04_TYPE_PM(04_15);
781778   ARCOMPACT_HANDLER04_TYPE_PM(04_16);
782   ARCOMPACT_HANDLER04_TYPE_PM(04_17);   
779   ARCOMPACT_HANDLER04_TYPE_PM(04_17);
783780   ARCOMPACT_HANDLER04_TYPE_PM(04_18);
784   ARCOMPACT_HANDLER04_TYPE_PM(04_19);   
781   ARCOMPACT_HANDLER04_TYPE_PM(04_19);
785782   ARCOMPACT_HANDLER04_TYPE_PM(04_20);
786783   ARCOMPACT_HANDLER04_TYPE_PM(04_2b);
787784
r242631r242632
811808   inline  UINT32 READ32(UINT32 address) { return m_program->read_dword(address << 2); }
812809   inline void WRITE32(UINT32 address, UINT32 data) { m_program->write_dword(address << 2, data); }
813810   inline UINT16 READ16(UINT32 address) { return m_program->read_word(address << 1); }
814   inline void WRITE16(UINT32 address, UINT16 data){    m_program->write_word(address << 1, data); }
811   inline void WRITE16(UINT32 address, UINT16 data){   m_program->write_word(address << 1, data); }
815812   inline UINT8 READ8(UINT32 address) { return m_program->read_byte(address << 0); }
816   inline void WRITE8(UINT32 address, UINT8 data){    m_program->write_byte(address << 0, data); }
817   
813   inline void WRITE8(UINT32 address, UINT8 data){     m_program->write_byte(address << 0, data); }
814
818815   inline  UINT64 READAUX(UINT64 address) { return m_io->read_dword(address *4); }
819816   inline void WRITEAUX(UINT64 address, UINT32 data) { m_io->write_dword(address *4, data); }
820817
r242631r242632
827824   int m_delaylinks;
828825   UINT32 m_delayjump;
829826
830//   f  e  d  c| b  a  9  8| 7  6  5  4| 3  2  1  0
827//  f  e  d  c| b  a  9  8| 7  6  5  4| 3  2  1  0
831828//  -  -  -  L| Z  N  C  V| U DE AE A2|A1 E2 E1  H
832829   UINT32 m_status32;
833830
r242631r242632
862859#define STATUS32_CHECK_Z (m_status32 &   Z_ZERO_FLAG)
863860
864861// Condition 0x0c (LE)
865#define CONDITION_LE ((STATUS32_CHECK_Z) || (STATUS32_CHECK_N && !STATUS32_CHECK_V) ||  (!STATUS32_CHECK_N && STATUS32_CHECK_V)) // Z or (N and /V) or (/N and V)
862#define CONDITION_LE ((STATUS32_CHECK_Z) || (STATUS32_CHECK_N && !STATUS32_CHECK_V) ||  (!STATUS32_CHECK_N && STATUS32_CHECK_V)) // Z or (N and /V) or (/N and V)
866863#define CONDITION_EQ (STATUS32_CHECK_Z)
867864#define CONDITION_CS (STATUS32_CHECK_C)
868865#define CONDITION_LT ((STATUS32_CHECK_N && !STATUS32_CHECK_V) || (!STATUS32_CHECK_N && STATUS32_CHECK_V))
trunk/src/emu/cpu/arcompact/arcompact_common.c
r242631r242632
44
55\*********************************/
66
7// condition codes (basic ones are the same as arc
7// condition codes (basic ones are the same as arc
88const char *conditions[0x20] =
99{
1010   /* 00 */ "AL", // (aka RA         - Always)
r242631r242632
1313   /* 03 */ "PL", // (aka P          - Positive)
1414   /* 04 */ "MI", // (aka N          - Negative)
1515   /* 05 */ "CS", // (aka C,  LO     - Carry set / Lower than) (unsigned)
16   /* 06 */ "CC", // (aka CC, NC, HS - Carry Clear / Higher or Same) (unsigned)
16   /* 06 */ "CC", // (aka CC, NC, HS - Carry Clear / Higher or Same) (unsigned)
1717   /* 07 */ "VS", // (aka V          - Overflow set)
1818   /* 08 */ "VC", // (aka NV         - Overflow clear)
1919   /* 09 */ "GT", // (               - Greater than) (signed)
r242631r242632
4444#define UNUSED_REG "unusedreg"
4545
4646#define AUX_UNUSED_16 \
47   /* 0xxx0 */ UNUSED_REG,   /* 0xxx1 */ UNUSED_REG,   /* 0xxx2 */ UNUSED_REG,   /* 0xxx3 */ UNUSED_REG,   /* 0xxx4 */ UNUSED_REG,   /* 0xxx5 */ UNUSED_REG,   /* 0xxx6 */ UNUSED_REG,   /* 0xxx7 */ UNUSED_REG,   /* 0xxx8 */ UNUSED_REG,   /* 0xxx9 */ UNUSED_REG,   /* 0xxxa */ UNUSED_REG,   /* 0xxxb */ UNUSED_REG,   /* 0xxxc */ UNUSED_REG,   /* 0xxxd */ UNUSED_REG,   /* 0xxxe */ UNUSED_REG,   /* 0xxxf */ UNUSED_REG,
47   /* 0xxx0 */ UNUSED_REG, /* 0xxx1 */ UNUSED_REG, /* 0xxx2 */ UNUSED_REG, /* 0xxx3 */ UNUSED_REG, /* 0xxx4 */ UNUSED_REG, /* 0xxx5 */ UNUSED_REG, /* 0xxx6 */ UNUSED_REG, /* 0xxx7 */ UNUSED_REG, /* 0xxx8 */ UNUSED_REG, /* 0xxx9 */ UNUSED_REG, /* 0xxxa */ UNUSED_REG, /* 0xxxb */ UNUSED_REG, /* 0xxxc */ UNUSED_REG, /* 0xxxd */ UNUSED_REG, /* 0xxxe */ UNUSED_REG, /* 0xxxf */ UNUSED_REG,
4848
4949// the Auxiliary Register set is actually a 2^32 dword address space (so 16 GB / 34-bit)
5050// this table just allows us to improve the debugger display for some of the common core / internal ones
r242631r242632
125125   AUX_UNUSED_16 /* 0x090 - 0x09f */
126126   AUX_UNUSED_16 /* 0x0a0 - 0x0af */
127127   AUX_UNUSED_16 /* 0x0b0 - 0x0bf */
128    // build configuration registers 0x0c0 - 0x0ff
128      // build configuration registers 0x0c0 - 0x0ff
129129   /* 0x0c0 */ "RESERVED AUX 0xc0",/* 0x0c1 */ "RESERVED AUX 0xc1",/* 0x0c2 */ "RESERVED AUX 0xc2",/* 0x0c3 */ "RESERVED AUX 0xc3",/* 0x0c4 */ "RESERVED AUX 0xc4",/* 0x0c5 */ "RESERVED AUX 0xc5",/* 0x0c6 */ "RESERVED AUX 0xc6",/* 0x0c7 */ "RESERVED AUX 0xc7",/* 0x0c8 */ "RESERVED AUX 0xc8",/* 0x0c9 */ "RESERVED AUX 0xc9",/* 0x0ca */ "RESERVED AUX 0xca",/* 0x0cb */ "RESERVED AUX 0xcb",/* 0x0cc */ "RESERVED AUX 0xcc",/* 0x0cd */ "RESERVED AUX 0xcd",/* 0x0ce */ "RESERVED AUX 0xce",/* 0x0cf */ "RESERVED AUX 0xcf",
130130   /* 0x0d0 */ "RESERVED AUX 0xd0",/* 0x0d1 */ "RESERVED AUX 0xd1",/* 0x0d2 */ "RESERVED AUX 0xd2",/* 0x0d3 */ "RESERVED AUX 0xd3",/* 0x0d4 */ "RESERVED AUX 0xd4",/* 0x0d5 */ "RESERVED AUX 0xd5",/* 0x0d6 */ "RESERVED AUX 0xd6",/* 0x0d7 */ "RESERVED AUX 0xd7",/* 0x0d8 */ "RESERVED AUX 0xd8",/* 0x0d9 */ "RESERVED AUX 0xd9",/* 0x0da */ "RESERVED AUX 0xda",/* 0x0db */ "RESERVED AUX 0xdb",/* 0x0dc */ "RESERVED AUX 0xdc",/* 0x0dd */ "RESERVED AUX 0xdd",/* 0x0de */ "RESERVED AUX 0xde",/* 0x0df */ "RESERVED AUX 0xdf",
131131   /* 0x0e0 */ "RESERVED AUX 0xe0",/* 0x0e1 */ "RESERVED AUX 0xe1",/* 0x0e2 */ "RESERVED AUX 0xe2",/* 0x0e3 */ "RESERVED AUX 0xe3",/* 0x0e4 */ "RESERVED AUX 0xe4",/* 0x0e5 */ "RESERVED AUX 0xe5",/* 0x0e6 */ "RESERVED AUX 0xe6",/* 0x0e7 */ "RESERVED AUX 0xe7",/* 0x0e8 */ "RESERVED AUX 0xe8",/* 0x0e9 */ "RESERVED AUX 0xe9",/* 0x0ea */ "RESERVED AUX 0xea",/* 0x0eb */ "RESERVED AUX 0xeb",/* 0x0ec */ "RESERVED AUX 0xec",/* 0x0ed */ "RESERVED AUX 0xed",/* 0x0ee */ "RESERVED AUX 0xee",/* 0x0ef */ "RESERVED AUX 0xef",
r242631r242632
371371   /* 37 */ "r55(ext)",
372372   /* 38 */ "r56(ext)",
373373   /* 39 */ "r57(M-LO)",  // MLO  (result registers for optional multply functions)
374   /* 3a */ "r58(M-MID)", // MMID
375   /* 3b */ "r59(M-HI)",  // MHI
374   /* 3a */ "r58(M-MID)", // MMID
375   /* 3b */ "r59(M-HI)",  // MHI
376376   /* 3c */ "r60(LP_COUNT)",
377377   /* 3d */ "r61(reserved)",
378378   /* 3e */ "r62(LIMM)", // use Long Immediate Data instead of register
r242631r242632
523523   /* 3e */ "0x3e",
524524   /* 3f */ "0x3f",
525525};
526
trunk/src/emu/cpu/arcompact/arcompact_execute.c
r242631r242632
1919   {
2020      debugger_instruction_hook(this, m_pc);
2121
22//      printf("new pc %04x\n", m_pc);
22//      printf("new pc %04x\n", m_pc);
2323
2424      if (m_delayactive)
2525      {
r242631r242632
5656#define GET_01_01_01_BRANCH_ADDR \
5757   INT32 address = (op & 0x00fe0000) >> 17; \
5858   address |= ((op & 0x00008000) >> 15) << 7; \
59   if (address & 0x80) address = -0x80 + (address & 0x7f); \
59   if (address & 0x80) address = -0x80 + (address & 0x7f);
6060
61
6261#define GROUP_0e_GET_h \
6362   h =  ((op & 0x0007) << 3); \
64    h |= ((op & 0x00e0) >> 5); \
65
63   h |= ((op & 0x00e0) >> 5);
6664#define COMMON32_GET_breg \
6765   int b_temp = (op & 0x07000000) >> 24; \
6866   int B_temp = (op & 0x00007000) >> 12; \
69   int breg = b_temp | (B_temp << 3); \
70
67   int breg = b_temp | (B_temp << 3);
7168#define COMMON32_GET_creg \
72   int creg = (op & 0x00000fc0) >> 6; \
73
69   int creg = (op & 0x00000fc0) >> 6;
7470#define COMMON32_GET_u6 \
75   int u = (op & 0x00000fc0) >> 6; \
76
71   int u = (op & 0x00000fc0) >> 6;
7772#define COMMON32_GET_areg \
78   int areg = (op & 0x0000003f) >> 0; \
79
73   int areg = (op & 0x0000003f) >> 0;
8074#define COMMON32_GET_areg_reserved \
81   int ares = (op & 0x0000003f) >> 0; \
82
75   int ares = (op & 0x0000003f) >> 0;
8376#define COMMON32_GET_F \
84   int F = (op & 0x00008000) >> 15; \
85
77   int F = (op & 0x00008000) >> 15;
8678#define COMMON32_GET_p \
87   int p = (op & 0x00c00000) >> 22; \
79   int p = (op & 0x00c00000) >> 22;
8880
89
9081#define COMMON32_GET_s12 \
9182      int S_temp = (op & 0x0000003f) >> 0; \
9283      int s_temp = (op & 0x00000fc0) >> 6; \
9384      INT32 S = s_temp | (S_temp<<6); \
94      if (S & 0x800) S = -0x800 + (S&0x7ff); /* sign extend */ \
95
85      if (S & 0x800) S = -0x800 + (S&0x7ff); /* sign extend */
9686#define COMMON32_GET_CONDITION \
9787      UINT8 condition = op & 0x0000001f;
9888
9989
10090#define COMMON16_GET_breg \
101   breg =  ((op & 0x0700) >>8); \
102
91   breg =  ((op & 0x0700) >>8);
10392#define COMMON16_GET_creg \
104   creg =  ((op & 0x00e0) >>5); \
105
93   creg =  ((op & 0x00e0) >>5);
10694#define COMMON16_GET_areg \
107   areg =  ((op & 0x0007) >>0); \
108
95   areg =  ((op & 0x0007) >>0);
10996#define COMMON16_GET_u3 \
110   u =  ((op & 0x0007) >>0); \
111
97   u =  ((op & 0x0007) >>0);
11298#define COMMON16_GET_u5 \
113   u =  ((op & 0x001f) >>0); \
114
99   u =  ((op & 0x001f) >>0);
115100#define COMMON16_GET_u8 \
116   u =  ((op & 0x00ff) >>0); \
117
101   u =  ((op & 0x00ff) >>0);
118102#define COMMON16_GET_u7 \
119   u =  ((op & 0x007f) >>0); \
120
103   u =  ((op & 0x007f) >>0);
121104#define COMMON16_GET_s9 \
122   s =  ((op & 0x01ff) >>0); \
123
105   s =  ((op & 0x01ff) >>0);
124106// registers used in 16-bit opcodes hae a limited range
125107// and can only address registers r0-r3 and r12-r15
126108
127109#define REG_16BIT_RANGE(_reg_) \
128   if (_reg_>3) _reg_+= 8; \
110   if (_reg_>3) _reg_+= 8;
129111
130
131112#define GET_LIMM_32 \
132113   limm = (READ16((m_pc + 4) >> 1) << 16); \
133   limm |= READ16((m_pc + 6) >> 1); \
134
114   limm |= READ16((m_pc + 6) >> 1);
135115#define GET_LIMM_16 \
136116   limm = (READ16((m_pc + 2) >> 1) << 16); \
137   limm |= READ16((m_pc + 4) >> 1); \
117   limm |= READ16((m_pc + 4) >> 1);
138118
139
140119#define PC_ALIGNED32 \
141120   (m_pc&0xfffffffc)
142121
r242631r242632
178157      case 0x1f: fatalerror("unhandled condition check %s", conditions[condition]); return -1;
179158   }
180159
181    return -1;
160      return -1;
182161
183162}
184163
r242631r242632
194173
195174      switch (instruction) // 32-bit instructions (with optional extra dword for immediate data)
196175      {
197         case 0x00: return arcompact_handle00(PARAMS);    // Bcc
198         case 0x01: return arcompact_handle01(PARAMS);    // BLcc/BRcc
199         case 0x02: return arcompact_handle02(PARAMS);    // LD r+o
200         case 0x03: return arcompact_handle03(PARAMS);    // ST r+o
201         case 0x04: return arcompact_handle04(PARAMS);    // op a,b,c (basecase)
202         case 0x05: return arcompact_handle05(PARAMS);    // op a,b,c (05 ARC ext)
203         case 0x06: return arcompact_handle06(PARAMS);    // op a,b,c (06 ARC ext)
204         case 0x07: return arcompact_handle07(PARAMS);    // op a,b,c (07 User ext)
205         case 0x08: return arcompact_handle08(PARAMS);    // op a,b,c (08 User ext)
206         case 0x09: return arcompact_handle09(PARAMS);    // op a,b,c (09 Market ext)
207         case 0x0a: return arcompact_handle0a(PARAMS);    // op a,b,c (0a Market ext)
208         case 0x0b: return arcompact_handle0b(PARAMS);    // op a,b,c (0b Market ext)
176         case 0x00: return arcompact_handle00(PARAMS);    // Bcc
177         case 0x01: return arcompact_handle01(PARAMS);    // BLcc/BRcc
178         case 0x02: return arcompact_handle02(PARAMS);    // LD r+o
179         case 0x03: return arcompact_handle03(PARAMS);    // ST r+o
180         case 0x04: return arcompact_handle04(PARAMS);    // op a,b,c (basecase)
181         case 0x05: return arcompact_handle05(PARAMS);    // op a,b,c (05 ARC ext)
182         case 0x06: return arcompact_handle06(PARAMS);    // op a,b,c (06 ARC ext)
183         case 0x07: return arcompact_handle07(PARAMS);    // op a,b,c (07 User ext)
184         case 0x08: return arcompact_handle08(PARAMS);    // op a,b,c (08 User ext)
185         case 0x09: return arcompact_handle09(PARAMS);    // op a,b,c (09 Market ext)
186         case 0x0a: return arcompact_handle0a(PARAMS);    // op a,b,c (0a Market ext)
187         case 0x0b: return arcompact_handle0b(PARAMS);    // op a,b,c (0b Market ext)
209188      }
210189   }
211190   else
212191   {
213192      switch (instruction) // 16-bit instructions
214193      {
215         case 0x0c: return arcompact_handle0c(PARAMS);    // Load/Add reg-reg
216         case 0x0d: return arcompact_handle0d(PARAMS);    // Add/Sub/Shft imm
217         case 0x0e: return arcompact_handle0e(PARAMS);    // Mov/Cmp/Add
218         case 0x0f: return arcompact_handle0f(PARAMS);    // op_S b,b,c (single 16-bit ops)
219         case 0x10: return arcompact_handle10(PARAMS);    // LD_S
220         case 0x11: return arcompact_handle11(PARAMS);    // LDB_S
221         case 0x12: return arcompact_handle12(PARAMS);    // LDW_S
222         case 0x13: return arcompact_handle13(PARAMS);    // LSW_S.X
223         case 0x14: return arcompact_handle14(PARAMS);    // ST_S
224         case 0x15: return arcompact_handle15(PARAMS);    // STB_S
225         case 0x16: return arcompact_handle16(PARAMS);    // STW_S
226         case 0x17: return arcompact_handle17(PARAMS);    // Shift/Sub/Bit
227         case 0x18: return arcompact_handle18(PARAMS);    // Stack Instr
228         case 0x19: return arcompact_handle19(PARAMS);    // GP Instr
229         case 0x1a: return arcompact_handle1a(PARAMS);    // PCL Instr
230         case 0x1b: return arcompact_handle1b(PARAMS);    // MOV_S
231         case 0x1c: return arcompact_handle1c(PARAMS);    // ADD_S/CMP_S
232         case 0x1d: return arcompact_handle1d(PARAMS);    // BRcc_S
233         case 0x1e: return arcompact_handle1e(PARAMS);    // Bcc_S
234         case 0x1f: return arcompact_handle1f(PARAMS);    // BL_S
194         case 0x0c: return arcompact_handle0c(PARAMS);    // Load/Add reg-reg
195         case 0x0d: return arcompact_handle0d(PARAMS);    // Add/Sub/Shft imm
196         case 0x0e: return arcompact_handle0e(PARAMS);    // Mov/Cmp/Add
197         case 0x0f: return arcompact_handle0f(PARAMS);    // op_S b,b,c (single 16-bit ops)
198         case 0x10: return arcompact_handle10(PARAMS);    // LD_S
199         case 0x11: return arcompact_handle11(PARAMS);    // LDB_S
200         case 0x12: return arcompact_handle12(PARAMS);    // LDW_S
201         case 0x13: return arcompact_handle13(PARAMS);    // LSW_S.X
202         case 0x14: return arcompact_handle14(PARAMS);    // ST_S
203         case 0x15: return arcompact_handle15(PARAMS);    // STB_S
204         case 0x16: return arcompact_handle16(PARAMS);    // STW_S
205         case 0x17: return arcompact_handle17(PARAMS);    // Shift/Sub/Bit
206         case 0x18: return arcompact_handle18(PARAMS);    // Stack Instr
207         case 0x19: return arcompact_handle19(PARAMS);    // GP Instr
208         case 0x1a: return arcompact_handle1a(PARAMS);    // PCL Instr
209         case 0x1b: return arcompact_handle1b(PARAMS);    // MOV_S
210         case 0x1c: return arcompact_handle1c(PARAMS);    // ADD_S/CMP_S
211         case 0x1d: return arcompact_handle1d(PARAMS);    // BRcc_S
212         case 0x1e: return arcompact_handle1e(PARAMS);    // Bcc_S
213         case 0x1f: return arcompact_handle1f(PARAMS);    // BL_S
235214      }
236215   }
237216
r242631r242632
501480
502481   switch (subinstr2)
503482   {
504      case 0x00: return arcompact_handle05_2f_00(PARAMS);  // SWAP
505      case 0x01: return arcompact_handle05_2f_01(PARAMS);  // NORM
483      case 0x00: return arcompact_handle05_2f_00(PARAMS);  // SWAP
484      case 0x01: return arcompact_handle05_2f_01(PARAMS);  // NORM
506485      case 0x02: return arcompact_handle05_2f_02(PARAMS);  // SAT16
507      case 0x03: return arcompact_handle05_2f_03(PARAMS);  // RND16
508      case 0x04: return arcompact_handle05_2f_04(PARAMS);  // ABSSW
509      case 0x05: return arcompact_handle05_2f_05(PARAMS);  // ABSS
510      case 0x06: return arcompact_handle05_2f_06(PARAMS);  // NEGSW
511      case 0x07: return arcompact_handle05_2f_07(PARAMS);  // NEGS
512      case 0x08: return arcompact_handle05_2f_08(PARAMS);  // NORMW
486      case 0x03: return arcompact_handle05_2f_03(PARAMS);  // RND16
487      case 0x04: return arcompact_handle05_2f_04(PARAMS);  // ABSSW
488      case 0x05: return arcompact_handle05_2f_05(PARAMS);  // ABSS
489      case 0x06: return arcompact_handle05_2f_06(PARAMS);  // NEGSW
490      case 0x07: return arcompact_handle05_2f_07(PARAMS);  // NEGS
491      case 0x08: return arcompact_handle05_2f_08(PARAMS);  // NORMW
513492      case 0x09: return arcompact_handle05_2f_09(PARAMS);  // illegal
514493      case 0x0a: return arcompact_handle05_2f_0a(PARAMS);  // illegal
515494      case 0x0b: return arcompact_handle05_2f_0b(PARAMS);  // illegal
r242631r242632
935914
936915   switch (subinstr)
937916   {
938      case 0x00: return arcompact_handle17_00(PARAMS);  // ASL_S
939      case 0x01: return arcompact_handle17_01(PARAMS);  // LSR_S
917      case 0x00: return arcompact_handle17_00(PARAMS);  // ASL_S
918      case 0x01: return arcompact_handle17_01(PARAMS);  // LSR_S
940919      case 0x02: return arcompact_handle17_02(PARAMS);  // ASR_S
941      case 0x03: return arcompact_handle17_03(PARAMS);  // SUB_S
942      case 0x04: return arcompact_handle17_04(PARAMS);  // BSET_S
943      case 0x05: return arcompact_handle17_05(PARAMS);  // BCLR_S
944      case 0x06: return arcompact_handle17_06(PARAMS);  // BMSK_S
920      case 0x03: return arcompact_handle17_03(PARAMS);  // SUB_S
921      case 0x04: return arcompact_handle17_04(PARAMS);  // BSET_S
922      case 0x05: return arcompact_handle17_05(PARAMS);  // BCLR_S
923      case 0x06: return arcompact_handle17_06(PARAMS);  // BMSK_S
945924      case 0x07: return arcompact_handle17_07(PARAMS);  // BTST_S
946925   }
947926
r242631r242632
967946   return 0;
968947}
969948
970ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_05(OPS_16)
949ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_05(OPS_16)
971950{
972951   UINT8 subinstr2 = (op & 0x0700) >> 8;
973952
r242631r242632
975954   {
976955      case 0x00: return arcompact_handle18_05_00(PARAMS);  // ADD_S (SP)
977956      case 0x01: return arcompact_handle18_05_01(PARAMS);  // SUB_S (SP)
978      case 0x02: return arcompact_handle18_05_02(PARAMS);  // <illegal 0x18_05_02>
957      case 0x02: return arcompact_handle18_05_02(PARAMS);  // <illegal 0x18_05_02>
979958      case 0x03: return arcompact_handle18_05_03(PARAMS);  // <illegal 0x18_05_03>
980959      case 0x04: return arcompact_handle18_05_04(PARAMS);  // <illegal 0x18_05_04>
981960      case 0x05: return arcompact_handle18_05_05(PARAMS);  // <illegal 0x18_05_05>
r242631r242632
986965   return 0;
987966}
988967
989ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_06(OPS_16)
968ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_06(OPS_16)
990969{
991970   UINT8 subinstr2 = (op & 0x001f) >> 0;
992971
r242631r242632
10291008   return 0;
10301009}
10311010
1032ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_07(OPS_16)
1011ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_07(OPS_16)
10331012{
10341013   UINT8 subinstr2 = (op & 0x001f) >> 0;
10351014
r242631r242632
11351114   switch (subinstr2)
11361115   {
11371116      case 0x00: return arcompact_handle1e_03_00(PARAMS);  // BGT_S
1138      case 0x01: return arcompact_handle1e_03_01(PARAMS);  // BGE_S
1117      case 0x01: return arcompact_handle1e_03_01(PARAMS);  // BGE_S
11391118      case 0x02: return arcompact_handle1e_03_02(PARAMS);  // BLT_S
11401119      case 0x03: return arcompact_handle1e_03_03(PARAMS);  // BLE_S
11411120      case 0x04: return arcompact_handle1e_03_04(PARAMS);  // BHI_S
11421121      case 0x05: return arcompact_handle1e_03_05(PARAMS);  // BHS_S
11431122      case 0x06: return arcompact_handle1e_03_06(PARAMS);  // BLO_S
1144      case 0x07: return arcompact_handle1e_03_07(PARAMS);  // BLS_S
1123      case 0x07: return arcompact_handle1e_03_07(PARAMS);  // BLS_S
11451124   }
11461125
11471126   return 0;
r242631r242632
11771156   }
11781157   else
11791158   {
1180   //   m_regs[REG_BLINK] = m_pc + (size >> 0);  // don't link
1159   //  m_regs[REG_BLINK] = m_pc + (size >> 0);  // don't link
11811160      return realaddress;
11821161   }
11831162
r242631r242632
11941173   address |= ((op & 0x0000000f) >> 0) << 20;
11951174   if (address & 0x800000) address = -0x800000 + (address & 0x7fffff);
11961175   int n = (op & 0x00000020) >> 5; op &= ~0x00000020;
1197//   int res =  (op & 0x00000010) >> 4; op &= ~0x00000010; // should be set to 0
1176//  int res =  (op & 0x00000010) >> 4; op &= ~0x00000010; // should be set to 0
11981177
11991178   UINT32 realaddress = PC_ALIGNED32 + (address * 2);
12001179
r242631r242632
12061185   }
12071186   else
12081187   {
1209   //   m_regs[REG_BLINK] = m_pc + (size >> 0);  // don't link
1188   //  m_regs[REG_BLINK] = m_pc + (size >> 0);  // don't link
12101189      return realaddress;
12111190   }
12121191
r242631r242632
12341213   INT32 address =   (op & 0x07fc0000) >> 17;
12351214   address |=        ((op & 0x0000ffc0) >> 6) << 10;
12361215   address |=        ((op & 0x0000000f) >> 0) << 20;
1237   if (address & 0x800000) address = -0x800000 + (address&0x7fffff);   
1216   if (address & 0x800000) address = -0x800000 + (address&0x7fffff);
12381217   int n = (op & 0x00000020) >> 5; op &= ~0x00000020;
1239//   int res =  (op & 0x00000010) >> 4; op &= ~0x00000010;
1218//  int res =  (op & 0x00000010) >> 4; op &= ~0x00000010;
12401219
12411220   UINT32 realaddress = PC_ALIGNED32 + (address * 2);
12421221
r242631r242632
12711250
12721251   if ((breg != LIMM_REG) && (creg != LIMM_REG))
12731252   {
1274
12751253   }
12761254   else
12771255   {
r242631r242632
13051283      UINT32 limm; \
13061284      GET_LIMM_32; \
13071285      size = 8; \
1308         \
1286      \
13091287      if (breg == LIMM_REG) \
13101288         b = limm; \
13111289      else \
13121290         b = m_regs[breg]; \
1313        \
1291      \
13141292      if (creg == LIMM_REG) \
13151293         c = limm; \
13161294      else \
13171295         c = m_regs[creg]; \
1318   } \
1319
1296   }
13201297#define BR_TAKEJUMP \
13211298   /* take jump */ \
13221299   UINT32 realaddress = PC_ALIGNED32 + (address * 2); \
1323    \
1300      \
13241301   if (n) \
13251302   { \
13261303      m_delayactive = 1; \
r242631r242632
13301307   else \
13311308   { \
13321309      return realaddress; \
1333   } \
1310   }
13341311
13351312
1336
13371313ARCOMPACT_RETTYPE arcompact_device::arcompact_handle01_01_00_00(OPS_32)  // register - register BREQ
13381314{
13391315   BR_REGREG_SETUP
r242631r242632
13431319   {
13441320      BR_TAKEJUMP
13451321   }
1346   
1322
13471323   return m_pc + (size>>0);
13481324}
13491325
r242631r242632
13561332   {
13571333      BR_TAKEJUMP
13581334   }
1359   
1335
13601336   return m_pc + (size>>0);
13611337}
13621338
r242631r242632
13691345   {
13701346      BR_TAKEJUMP
13711347   }
1372   
1348
13731349   return m_pc + (size>>0);
13741350
13751351}
1376ARCOMPACT_RETTYPE arcompact_device::arcompact_handle01_01_00_03(OPS_32) // register - register BRGE
1352ARCOMPACT_RETTYPE arcompact_device::arcompact_handle01_01_00_03(OPS_32) // register - register BRGE
13771353{
13781354   BR_REGREG_SETUP
1379   
1355
13801356   // BRGE  (signed operation)
13811357   if ((INT32)b >= (INT32)c)
13821358   {
13831359      BR_TAKEJUMP
13841360   }
1385   
1361
13861362   return m_pc + (size>>0);
13871363}
13881364
r242631r242632
13951371   {
13961372      BR_TAKEJUMP
13971373   }
1398   
1374
13991375   return m_pc + (size>>0);
14001376}
14011377
r242631r242632
14091385   {
14101386      BR_TAKEJUMP
14111387   }
1412   
1388
14131389   return m_pc + (size>>0);
14141390}
14151391
r242631r242632
14431419      GET_LIMM_32; \
14441420      size = 8; \
14451421      b = limm; \
1446   } \
1422   }
14471423
1448
14491424// register -immediate cases
14501425ARCOMPACT_RETTYPE arcompact_device::arcompact_handle01_01_01_00(OPS_32) // BREQ reg-imm
14511426{
14521427   BR_REGIMM_SETUP
1453   
1428
14541429   // BREQ
14551430   if (b == c)
14561431   {
14571432      BR_TAKEJUMP
14581433   }
1459   
1434
14601435   return m_pc + (size>>0);
14611436}
14621437
14631438ARCOMPACT_RETTYPE arcompact_device::arcompact_handle01_01_01_01(OPS_32) // BRNE reg-imm
14641439{
14651440   BR_REGIMM_SETUP
1466   
1441
14671442   // BRNE
14681443   if (b != c)
14691444   {
14701445      BR_TAKEJUMP
14711446   }
1472   
1447
14731448   return m_pc + (size>>0);
14741449}
14751450
r242631r242632
14781453ARCOMPACT_RETTYPE arcompact_device::arcompact_handle01_01_01_02(OPS_32) // BRLT reg-imm
14791454{
14801455   BR_REGIMM_SETUP
1481   
1456
14821457   // BRLT  (signed operation)
14831458   if ((INT32)b < (INT32)c)
14841459   {
14851460      BR_TAKEJUMP
14861461   }
1487   
1462
14881463   return m_pc + (size>>0);
14891464
14901465}
14911466ARCOMPACT_RETTYPE arcompact_device::arcompact_handle01_01_01_03(OPS_32)
14921467{
14931468   BR_REGIMM_SETUP
1494   
1469
14951470   // BRGE  (signed operation)
14961471   if ((INT32)b >= (INT32)c)
14971472   {
14981473      BR_TAKEJUMP
14991474   }
1500   
1475
15011476   return m_pc + (size>>0);
15021477}
15031478
r242631r242632
15101485   {
15111486      BR_TAKEJUMP
15121487   }
1513   
1488
15141489   return m_pc + (size>>0);
15151490
15161491}
r242631r242632
15241499   {
15251500      BR_TAKEJUMP
15261501   }
1527   
1502
15281503   return m_pc + (size>>0);
15291504}
15301505
r242631r242632
15471522   int X = (op & 0x00000040) >> 6;  //op &= ~0x00000040;
15481523   int Z = (op & 0x00000180) >> 7;  //op &= ~0x00000180;
15491524   int a = (op & 0x00000600) >> 9;  //op &= ~0x00000600;
1550//   int D = (op & 0x00000800) >> 11;// op &= ~0x00000800; // we don't use the data cache currently
1525//  int D = (op & 0x00000800) >> 11;// op &= ~0x00000800; // we don't use the data cache currently
15511526
15521527   UINT32 address = m_regs[breg];
15531528
r242631r242632
16351610{
16361611   int size = 4;
16371612   UINT32 limm = 0;
1638   int got_limm = 0;
1613   int got_limm = 0;
16391614   int S = (op & 0x00008000) >> 15;
16401615   int s = (op & 0x00ff0000) >> 16;
16411616   if (S) s = -0x100 + s;
16421617
16431618   COMMON32_GET_breg;
16441619   COMMON32_GET_creg;
1645   
1646//   int R = (op & 0x00000001) >> 0; // bit 0 is reserved
1647   int Z = (op & 0x00000006) >> 1;
1648   int a = (op & 0x00000018) >> 3;
1649//   int D = (op & 0x00000020) >> 5; // we don't use the data cache currently
16501620
1621//  int R = (op & 0x00000001) >> 0; // bit 0 is reserved
1622   int Z = (op & 0x00000006) >> 1;
1623   int a = (op & 0x00000018) >> 3;
1624//  int D = (op & 0x00000020) >> 5; // we don't use the data cache currently
16511625
1626
16521627   UINT32 address = m_regs[breg];
16531628
16541629   if (breg == LIMM_REG)
r242631r242632
17381713
17391714   COMMON32_GET_p;
17401715   COMMON32_GET_breg;
1741   
1716
17421717   if (!b_reserved)
17431718   {
17441719      if (breg == LIMM_REG)
r242631r242632
18131788
18141789#include "cpu/arcompact/arcompact.inc"
18151790
1816ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_01(OPS_32) 
1817{
1791ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_01(OPS_32)
1792{
18181793   return arcompact_handle04_helper(PARAMS, opcodes_04[0x01], /*"ADC"*/ 0,0);
18191794}
18201795
18211796
18221797
1823ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_03(OPS_32) 
1798ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_03(OPS_32)
18241799{
18251800   return arcompact_handle04_helper(PARAMS, opcodes_04[0x03], /*"SBC"*/ 0,0);
18261801}
18271802
1828ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_08(OPS_32) 
1803ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_08(OPS_32)
18291804{
18301805   return arcompact_handle04_helper(PARAMS, opcodes_04[0x08], /*"MAX"*/ 0,0);
18311806}
18321807
1833ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_09(OPS_32)
1808ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_09(OPS_32)
18341809{
18351810   return arcompact_handle04_helper(PARAMS, opcodes_04[0x09], /*"MIN"*/ 0,0);
18361811}
r242631r242632
18481823}
18491824
18501825ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_0d(OPS_32)
1851{
1826{
18521827   return arcompact_handle04_helper(PARAMS, opcodes_04[0x0d], /*"RCMP"*/ 1,0);
18531828}
18541829
18551830
18561831
1857ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_10(OPS_32) 
1858{
1832ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_10(OPS_32)
1833{
18591834   return arcompact_handle04_helper(PARAMS, opcodes_04[0x10], /*"BCLR"*/ 0,0);
18601835}
18611836
1862ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_11(OPS_32) 
1863{
1837ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_11(OPS_32)
1838{
18641839   return arcompact_handle04_helper(PARAMS, opcodes_04[0x11], /*"BTST"*/ 0,0);
18651840}
18661841
1867ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_12(OPS_32) 
1868{
1842ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_12(OPS_32)
1843{
18691844   return arcompact_handle04_helper(PARAMS, opcodes_04[0x12], /*"BXOR"*/ 0,0);
18701845}
18711846
r242631r242632
18741849
18751850
18761851
1877ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_1a(OPS_32) 
1878{
1852ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_1a(OPS_32)
1853{
18791854   return arcompact_handle04_helper(PARAMS, opcodes_04[0x1a], /*"MPY"*/ 0,0);
18801855} // *
18811856
1882ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_1b(OPS_32) 
1883{
1857ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_1b(OPS_32)
1858{
18841859   return arcompact_handle04_helper(PARAMS, opcodes_04[0x1b], /*"MPYH"*/ 0,0);
18851860} // *
18861861
1887ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_1c(OPS_32) 
1888{
1862ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_1c(OPS_32)
1863{
18891864   return arcompact_handle04_helper(PARAMS, opcodes_04[0x1c], /*"MPYHU"*/ 0,0);
18901865} // *
18911866
1892ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_1d(OPS_32) 
1893{
1867ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_1d(OPS_32)
1868{
18941869   return arcompact_handle04_helper(PARAMS, opcodes_04[0x1d], /*"MPYU"*/ 0,0);
18951870} // *
18961871
r242631r242632
19031878   COMMON32_GET_creg
19041879   COMMON32_GET_F
19051880
1906   if (creg == LIMM_REG)
1881   if (creg == LIMM_REG)
19071882   {
19081883      // opcode          iiii i--- ppII IIII F--- CCCC CC-- ----
19091884      // J limm          0010 0RRR 0010 0000 0RRR 1111 10RR RRRR  [LIMM]  (creg = LIMM)
r242631r242632
19451920         }
19461921         else
19471922         {
1948           
19491923            return m_regs[creg];
19501924         }
19511925      }
r242631r242632
20031977      // opcode          iiii i--- ppII IIII F--- cccc ccmq qqqq
20041978      // Jcc [c]         0010 0RRR 1110 0000 0RRR CCCC CC0Q QQQQ
20051979      // no conditional links to ILINK1, ILINK2?
2006     
1980
20071981      c = m_regs[creg];
20081982   }
20091983
r242631r242632
20262000   }
20272001
20282002   if (F)
2029   {
2003   {
20302004      // if F is set then the destination MUST be ILINK1 or ILINK2
20312005
20322006      if ((creg == REG_ILINK1) || (creg == REG_ILINK1))
r242631r242632
20372011      {
20382012         arcompact_fatal ("fatal arcompact_handle04_20_p11_m0 J %08x (F set but not ILINK1 or ILINK2 used as dst)", op);
20392013
2040      }   
2014      }
20412015   }
20422016
20432017
r242631r242632
20762050ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_28(OPS_32) // LPcc (loop setup)
20772051{
20782052   int size = 4;
2079//   COMMON32_GET_breg; // breg is reserved
2053//  COMMON32_GET_breg; // breg is reserved
20802054   COMMON32_GET_p;
20812055
20822056   if (p == 0x00)
r242631r242632
20992073      COMMON32_GET_u6
21002074      COMMON32_GET_CONDITION
21012075      //arcompact_fatal("Lp conditional %s not supported %d", conditions[condition], u);
2102     
2076
21032077      // if the loop condition fails then just jump to after the end of the loop, don't set any registers
21042078      if (!check_condition(condition))
21052079      {
r242631r242632
21242098ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_2a(OPS_32)  // Load FROM Auxiliary register TO register
21252099{
21262100   int size = 4;
2127//   UINT32 limm = 0;
2101//  UINT32 limm = 0;
21282102   int got_limm = 0;
21292103
21302104   COMMON32_GET_p;
r242631r242632
21322106
21332107   if (p == 0)
21342108   {
2135
21362109      COMMON32_GET_creg
21372110
21382111      if (creg == LIMM_REG)
r242631r242632
21422115            //GET_LIMM_32;
21432116            size = 8;
21442117         }
2145   
2118
21462119      }
21472120      else
21482121      {
r242631r242632
21762149
21772150   COMMON32_GET_p;
21782151   //COMMON32_GET_breg;
2179   
2152
21802153   if (p == 0)
21812154   {
21822155      COMMON32_GET_creg
r242631r242632
21852158      {
21862159         //UINT32 limm;
21872160         //GET_LIMM_32;
2188         size = 8;   
2161         size = 8;
21892162      }
21902163      else
21912164      {
r242631r242632
22652238   }
22662239   else
22672240   {
2268   }   
2241   }
22692242
22702243   arcompact_log("unimplemented LD %08x (type 04_3x)", op);
22712244   return m_pc + (size>>0);
r242631r242632
23132286
23142287   COMMON32_GET_p;
23152288   //COMMON32_GET_breg;
2316   
2289
23172290   if (p == 0)
23182291   {
23192292      COMMON32_GET_creg
r242631r242632
23222295      {
23232296         //UINT32 limm;
23242297         //GET_LIMM_32;
2325         size = 8;   
2298         size = 8;
23262299
23272300      }
23282301      else
r242631r242632
24542427   int size = 2;
24552428
24562429   GROUP_0e_GET_h;
2457   
2430
24582431   if (h == LIMM_REG)
24592432   {
24602433      //UINT32 limm;
r242631r242632
24632436   }
24642437   else
24652438   {
2466
24672439   }
24682440
24692441   arcompact_log("unimplemented %s %04x (0x0e_0x group)", optext, op);
r242631r242632
24802452   GROUP_0e_GET_h;
24812453   COMMON16_GET_breg;
24822454   REG_16BIT_RANGE(breg);
2483   
2455
24842456   if (h == LIMM_REG)
24852457   {
24862458      UINT32 limm;
r242631r242632
24992471}
25002472
25012473// 16-bit MOV with extended register range
2502ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0e_01(OPS_16) // MOV_S b <- h
2474ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0e_01(OPS_16) // MOV_S b <- h
25032475{
25042476   int h,breg;
25052477   int size = 2;
r242631r242632
25072479   GROUP_0e_GET_h;
25082480   COMMON16_GET_breg;
25092481   REG_16BIT_RANGE(breg);
2510   
2482
25112483   if (h == LIMM_REG)
25122484   {
25132485      // opcode        iiii ibbb hhhI Ihhh
r242631r242632
25432515   GROUP_0e_GET_h;
25442516   COMMON16_GET_breg;
25452517   REG_16BIT_RANGE(breg);
2546   
2518
25472519   if (h == LIMM_REG) // no result..
25482520   {
2549
25502521   }
25512522
25522523   m_regs[h] = m_regs[breg];
r242631r242632
25732544
25742545   COMMON16_GET_breg;
25752546   REG_16BIT_RANGE(breg);
2576   
2547
25772548   m_regs[REG_BLINK] = m_pc + (2 >> 0);
2578   
2549
25792550   return m_regs[breg];
25802551}
25812552
r242631r242632
25862557
25872558   COMMON16_GET_breg;
25882559   REG_16BIT_RANGE(breg);
2589   
2560
25902561   m_delayactive = 1;
25912562   m_delayjump = m_regs[breg];
25922563   m_delaylinks = 1;
2593   
2564
25942565   return m_pc + (2 >> 0);
25952566}
25962567
r242631r242632
26162587   m_delayactive = 1;
26172588   m_delayjump = m_regs[REG_BLINK];
26182589   m_delaylinks = 0;
2619   
2590
26202591   return m_pc + (2 >> 0);
26212592}
26222593
r242631r242632
26792650
26802651
26812652ARCOMPACT_RETTYPE arcompact_device::arcompact_handle10(OPS_16)
2682{ // LD_S c, [b, u7]
2653{ // LD_S c, [b, u7]
26832654   int breg, creg, u;
26842655
26852656   COMMON16_GET_breg;
r242631r242632
26972668
26982669ARCOMPACT_RETTYPE arcompact_device::arcompact_handle11(OPS_16)
26992670{
2700 // LDB_S c, [b, u5]
2671   // LDB_S c, [b, u5]
27012672   int breg, creg, u;
27022673
27032674   COMMON16_GET_breg;
r242631r242632
27072678   REG_16BIT_RANGE(breg);
27082679   REG_16BIT_RANGE(creg);
27092680
2710//   u <<= 0; // check
2681//  u <<= 0; // check
27112682   m_regs[creg] = READ8((m_regs[breg] + u) >> 0);
27122683
27132684   return m_pc + (2 >> 0);
r242631r242632
27152686
27162687ARCOMPACT_RETTYPE arcompact_device::arcompact_handle12(OPS_16)
27172688{
2718 // LDB_W c, [b, u6]
2689   // LDB_W c, [b, u6]
27192690   int breg, creg, u;
27202691
27212692   COMMON16_GET_breg;
r242631r242632
27652736   REG_16BIT_RANGE(breg);
27662737   REG_16BIT_RANGE(creg);
27672738
2768//   u <<= 0;
2739//  u <<= 0;
27692740
27702741   WRITE8((m_regs[breg] + u) >> 0, m_regs[creg]);
27712742
r242631r242632
28332804   return m_pc + (2 >> 0);
28342805}
28352806
2836ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_01(OPS_16)
2807ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_01(OPS_16)
28372808{
28382809   return arcompact_handle18_0x_helper(PARAMS, "LDB_S (SP)", 0);
28392810}
r242631r242632
28552826   return m_pc + (2 >> 0);
28562827}
28572828
2858ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_03(OPS_16)
2829ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_03(OPS_16)
28592830{
28602831   return arcompact_handle18_0x_helper(PARAMS, "STB_S (SP)", 1);
28612832}
r242631r242632
28962867   return m_pc + (2 >> 0);
28972868}
28982869
2899// op bits remaining for 0x18_06_xx subgroups 0x0700
2870// op bits remaining for 0x18_06_xx subgroups 0x0700
29002871ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_06_01(OPS_16) // POP_S b
29012872{
29022873   int breg;
29032874   COMMON16_GET_breg;
29042875   REG_16BIT_RANGE(breg);
2905   
2876
29062877   m_regs[breg] = READ32(m_regs[REG_SP] >> 2);
29072878   m_regs[REG_SP] += 4;
29082879
r242631r242632
29182889   return m_pc + (2 >> 0);
29192890}
29202891
2921// op bits remaining for 0x18_07_xx subgroups 0x0700
2892// op bits remaining for 0x18_07_xx subgroups 0x0700
29222893ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_07_01(OPS_16) // PUSH_S b
29232894{
29242895   int breg;
29252896   COMMON16_GET_breg;
29262897   REG_16BIT_RANGE(breg);
2927   
2898
29282899   m_regs[REG_SP] -= 4;
2929   
2900
29302901   WRITE32(m_regs[REG_SP] >> 2, m_regs[breg]);
29312902
29322903   return m_pc + (2 >> 0);
r242631r242632
29382909   // breg bits are reserved
29392910
29402911   m_regs[REG_SP] -= 4;
2941   
2912
29422913   WRITE32(m_regs[REG_SP] >> 2, m_regs[REG_BLINK]);
29432914
29442915   return m_pc + (2 >> 0);
r242631r242632
30583029
30593030   if (!m_regs[breg])
30603031   {
3061      int s = (op & 0x007f) >> 0;   op &= ~0x007f;
3032      int s = (op & 0x007f) >> 0; op &= ~0x007f;
30623033      if (s & 0x40) s = -0x40 + (s & 0x3f);
30633034      UINT32 realaddress = PC_ALIGNED32 + (s * 2);
30643035      //m_regs[REG_BLINK] = m_pc + (2 >> 0); // don't link
r242631r242632
30773048
30783049   if (m_regs[breg])
30793050   {
3080      int s = (op & 0x007f) >> 0;   op &= ~0x007f;
3051      int s = (op & 0x007f) >> 0; op &= ~0x007f;
30813052      if (s & 0x40) s = -0x40 + (s & 0x3f);
30823053      UINT32 realaddress = PC_ALIGNED32 + (s * 2);
30833054      //m_regs[REG_BLINK] = m_pc + (2 >> 0); // don't link
r242631r242632
30983069
30993070ARCOMPACT_RETTYPE arcompact_device::arcompact_handle1e_00(OPS_16) // B_S s10  (branch always)
31003071{
3101   int s = (op & 0x01ff) >> 0;   op &= ~0x01ff;
3072   int s = (op & 0x01ff) >> 0; op &= ~0x01ff;
31023073   if (s & 0x100) s = -0x100 + (s & 0xff);
31033074   UINT32 realaddress = PC_ALIGNED32 + (s * 2);
31043075   //m_regs[REG_BLINK] = m_pc + (2 >> 0); // don't link
r242631r242632
31093080{
31103081   if (STATUS32_CHECK_Z)
31113082   {
3112      int s = (op & 0x01ff) >> 0;   op &= ~0x01ff;
3083      int s = (op & 0x01ff) >> 0; op &= ~0x01ff;
31133084      if (s & 0x100) s = -0x100 + (s & 0xff);
31143085      UINT32 realaddress = PC_ALIGNED32 + (s * 2);
31153086      //m_regs[REG_BLINK] = m_pc + (2 >> 0); // don't link
r242631r242632
31233094{
31243095   if (!STATUS32_CHECK_Z)
31253096   {
3126      int s = (op & 0x01ff) >> 0;   op &= ~0x01ff;
3097      int s = (op & 0x01ff) >> 0; op &= ~0x01ff;
31273098      if (s & 0x100) s = -0x100 + (s & 0xff);
31283099      UINT32 realaddress = PC_ALIGNED32 + (s * 2);
31293100      //m_regs[REG_BLINK] = m_pc + (2 >> 0); // don't link
r242631r242632
31463117{
31473118   if (CONDITION_LT)
31483119   {
3149      int s = (op & 0x003f) >> 0;   op &= ~0x003f;
3120      int s = (op & 0x003f) >> 0; op &= ~0x003f;
31503121      if (s & 0x020) s = -0x20 + (s & 0x1f);
31513122      UINT32 realaddress = PC_ALIGNED32 + (s * 2);
31523123      //m_regs[REG_BLINK] = m_pc + (2 >> 0); // don't link
r242631r242632
31603131{
31613132   if (CONDITION_LE)
31623133   {
3163      int s = (op & 0x003f) >> 0;   op &= ~0x003f;
3134      int s = (op & 0x003f) >> 0; op &= ~0x003f;
31643135      if (s & 0x020) s = -0x20 + (s & 0x1f);
31653136      UINT32 realaddress = PC_ALIGNED32 + (s * 2);
31663137      //m_regs[REG_BLINK] = m_pc + (2 >> 0); // don't link
r242631r242632
31773148
31783149ARCOMPACT_RETTYPE arcompact_device::arcompact_handle1f(OPS_16) // BL_S s13
31793150{
3180   int s = (op & 0x07ff) >> 0;   op &= ~0x07ff;
3151   int s = (op & 0x07ff) >> 0; op &= ~0x07ff;
31813152   if (s & 0x400) s = -0x400 + (s & 0x3ff);
31823153
31833154   UINT32 realaddress = PC_ALIGNED32 + (s * 4);
r242631r242632
36003571ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_07_1d(OPS_16)  { arcompact_fatal("<illegal 0x18_07_1d> (%04x)",  op); return m_pc + (2 >> 0);}
36013572ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_07_1e(OPS_16)  { arcompact_fatal("<illegal 0x18_07_1e> (%04x)",  op); return m_pc + (2 >> 0);}
36023573ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_07_1f(OPS_16)  { arcompact_fatal("<illegal 0x18_07_1f> (%04x)",  op); return m_pc + (2 >> 0);}
3603
3604
3605
trunk/src/emu/cpu/arcompact/arcompactdasm.c
r242631r242632
4141
4242      switch (instruction) // 32-bit instructions (with optional extra dword for immediate data)
4343      {
44         case 0x00: size = arcompact_handle00_dasm(DASM_PARAMS);   break; // Bcc
45         case 0x01: size = arcompact_handle01_dasm(DASM_PARAMS);   break; // BLcc/BRcc
46         case 0x02: size = arcompact_handle02_dasm(DASM_PARAMS);   break; // LD r+o
47         case 0x03: size = arcompact_handle03_dasm(DASM_PARAMS);   break; // ST r+o
48         case 0x04: size = arcompact_handle04_dasm(DASM_PARAMS);   break; // op a,b,c (basecase)
49         case 0x05: size = arcompact_handle05_dasm(DASM_PARAMS);   break; // op a,b,c (05 ARC ext)
50         case 0x06: size = arcompact_handle06_dasm(DASM_PARAMS);   break; // op a,b,c (06 ARC ext)
51         case 0x07: size = arcompact_handle07_dasm(DASM_PARAMS);   break; // op a,b,c (07 User ext)
52         case 0x08: size = arcompact_handle08_dasm(DASM_PARAMS);   break; // op a,b,c (08 User ext)
53         case 0x09: size = arcompact_handle09_dasm(DASM_PARAMS);   break; // op a,b,c (09 Market ext)
54         case 0x0a: size = arcompact_handle0a_dasm(DASM_PARAMS);   break; // op a,b,c (0a Market ext)
55         case 0x0b: size = arcompact_handle0b_dasm(DASM_PARAMS);   break; // op a,b,c (0b Market ext)
44         case 0x00: size = arcompact_handle00_dasm(DASM_PARAMS); break; // Bcc
45         case 0x01: size = arcompact_handle01_dasm(DASM_PARAMS); break; // BLcc/BRcc
46         case 0x02: size = arcompact_handle02_dasm(DASM_PARAMS); break; // LD r+o
47         case 0x03: size = arcompact_handle03_dasm(DASM_PARAMS); break; // ST r+o
48         case 0x04: size = arcompact_handle04_dasm(DASM_PARAMS); break; // op a,b,c (basecase)
49         case 0x05: size = arcompact_handle05_dasm(DASM_PARAMS); break; // op a,b,c (05 ARC ext)
50         case 0x06: size = arcompact_handle06_dasm(DASM_PARAMS); break; // op a,b,c (06 ARC ext)
51         case 0x07: size = arcompact_handle07_dasm(DASM_PARAMS); break; // op a,b,c (07 User ext)
52         case 0x08: size = arcompact_handle08_dasm(DASM_PARAMS); break; // op a,b,c (08 User ext)
53         case 0x09: size = arcompact_handle09_dasm(DASM_PARAMS); break; // op a,b,c (09 Market ext)
54         case 0x0a: size = arcompact_handle0a_dasm(DASM_PARAMS); break; // op a,b,c (0a Market ext)
55         case 0x0b: size = arcompact_handle0b_dasm(DASM_PARAMS); break; // op a,b,c (0b Market ext)
5656      }
5757   }
5858   else
59   {   
59   {
6060      size = 2;
6161      op &= ~0xf800;
6262
6363
6464      switch (instruction) // 16-bit instructions
6565      {
66         case 0x0c: size = arcompact_handle0c_dasm(DASM_PARAMS);   break; // Load/Add reg-reg
67         case 0x0d: size = arcompact_handle0d_dasm(DASM_PARAMS);   break; // Add/Sub/Shft imm
68         case 0x0e: size = arcompact_handle0e_dasm(DASM_PARAMS);   break; // Mov/Cmp/Add
69         case 0x0f: size = arcompact_handle0f_dasm(DASM_PARAMS);   break; // op_S b,b,c (single 16-bit ops)
70         case 0x10: size = arcompact_handle10_dasm(DASM_PARAMS);   break; // LD_S
71         case 0x11: size = arcompact_handle11_dasm(DASM_PARAMS);   break; // LDB_S
72         case 0x12: size = arcompact_handle12_dasm(DASM_PARAMS);   break; // LDW_S
73         case 0x13: size = arcompact_handle13_dasm(DASM_PARAMS);   break; // LSW_S.X
74         case 0x14: size = arcompact_handle14_dasm(DASM_PARAMS);   break; // ST_S
75         case 0x15: size = arcompact_handle15_dasm(DASM_PARAMS);   break; // STB_S
76         case 0x16: size = arcompact_handle16_dasm(DASM_PARAMS);   break; // STW_S
77         case 0x17: size = arcompact_handle17_dasm(DASM_PARAMS);   break; // Shift/Sub/Bit
78         case 0x18: size = arcompact_handle18_dasm(DASM_PARAMS);   break; // Stack Instr
79         case 0x19: size = arcompact_handle19_dasm(DASM_PARAMS);   break; // GP Instr
80         case 0x1a: size = arcompact_handle1a_dasm(DASM_PARAMS);   break; // PCL Instr
81         case 0x1b: size = arcompact_handle1b_dasm(DASM_PARAMS);   break; // MOV_S
82         case 0x1c: size = arcompact_handle1c_dasm(DASM_PARAMS);   break; // ADD_S/CMP_S
83         case 0x1d: size = arcompact_handle1d_dasm(DASM_PARAMS);   break; // BRcc_S
84         case 0x1e: size = arcompact_handle1e_dasm(DASM_PARAMS);   break; // Bcc_S
85         case 0x1f: size = arcompact_handle1f_dasm(DASM_PARAMS);   break; // BL_S
66         case 0x0c: size = arcompact_handle0c_dasm(DASM_PARAMS); break; // Load/Add reg-reg
67         case 0x0d: size = arcompact_handle0d_dasm(DASM_PARAMS); break; // Add/Sub/Shft imm
68         case 0x0e: size = arcompact_handle0e_dasm(DASM_PARAMS); break; // Mov/Cmp/Add
69         case 0x0f: size = arcompact_handle0f_dasm(DASM_PARAMS); break; // op_S b,b,c (single 16-bit ops)
70         case 0x10: size = arcompact_handle10_dasm(DASM_PARAMS); break; // LD_S
71         case 0x11: size = arcompact_handle11_dasm(DASM_PARAMS); break; // LDB_S
72         case 0x12: size = arcompact_handle12_dasm(DASM_PARAMS); break; // LDW_S
73         case 0x13: size = arcompact_handle13_dasm(DASM_PARAMS); break; // LSW_S.X
74         case 0x14: size = arcompact_handle14_dasm(DASM_PARAMS); break; // ST_S
75         case 0x15: size = arcompact_handle15_dasm(DASM_PARAMS); break; // STB_S
76         case 0x16: size = arcompact_handle16_dasm(DASM_PARAMS); break; // STW_S
77         case 0x17: size = arcompact_handle17_dasm(DASM_PARAMS); break; // Shift/Sub/Bit
78         case 0x18: size = arcompact_handle18_dasm(DASM_PARAMS); break; // Stack Instr
79         case 0x19: size = arcompact_handle19_dasm(DASM_PARAMS); break; // GP Instr
80         case 0x1a: size = arcompact_handle1a_dasm(DASM_PARAMS); break; // PCL Instr
81         case 0x1b: size = arcompact_handle1b_dasm(DASM_PARAMS); break; // MOV_S
82         case 0x1c: size = arcompact_handle1c_dasm(DASM_PARAMS); break; // ADD_S/CMP_S
83         case 0x1d: size = arcompact_handle1d_dasm(DASM_PARAMS); break; // BRcc_S
84         case 0x1e: size = arcompact_handle1e_dasm(DASM_PARAMS); break; // Bcc_S
85         case 0x1f: size = arcompact_handle1f_dasm(DASM_PARAMS); break; // BL_S
8686      }
8787   }
8888
trunk/src/emu/cpu/arcompact/arcompactdasm_dispatch.c
r242631r242632
141141   // 00100 bbb 00 iiiiii F BBB CCCCCC A AAAAA   General Operations *UN*Conditional Register to Register
142142   // 00100 bbb 01 iiiiii F BBB UUUUUU A AAAAA   General Operations *UN*Conditional Register (Unsigned 6-bit IMM)
143143   // 00100 bbb 10 iiiiii F BBB ssssss S SSSSS   General Operations *UN*Conditional Register (Signed 12-bit IMM)
144   
145   // 00100 bbb 11 iiiiii F BBB CCCCCC 0 QQQQQ   General Operations Conditional Register
146   // 00100 bbb 11 iiiiii F BBB UUUUUU 1 QQQQQ   General Operations Conditional Register (Unsigned 6-bit IMM)
144
145   // 00100 bbb 11 iiiiii F BBB CCCCCC 0 QQQQQ   General Operations Conditional Register
146   // 00100 bbb 11 iiiiii F BBB UUUUUU 1 QQQQQ   General Operations Conditional Register (Unsigned 6-bit IMM)
147147   UINT8 subinstr = (op & 0x003f0000) >> 16;
148148   op &= ~0x003f0000;
149149
r242631r242632
304304
305305   switch (subinstr2)
306306   {
307      case 0x00: size = arcompact_handle05_2f_00_dasm(DASM_PARAMS); break; // SWAP
308      case 0x01: size = arcompact_handle05_2f_01_dasm(DASM_PARAMS); break; // NORM
307      case 0x00: size = arcompact_handle05_2f_00_dasm(DASM_PARAMS); break; // SWAP
308      case 0x01: size = arcompact_handle05_2f_01_dasm(DASM_PARAMS); break; // NORM
309309      case 0x02: size = arcompact_handle05_2f_02_dasm(DASM_PARAMS); break; // SAT16
310      case 0x03: size = arcompact_handle05_2f_03_dasm(DASM_PARAMS); break; // RND16
311      case 0x04: size = arcompact_handle05_2f_04_dasm(DASM_PARAMS); break; // ABSSW
312      case 0x05: size = arcompact_handle05_2f_05_dasm(DASM_PARAMS); break; // ABSS
313      case 0x06: size = arcompact_handle05_2f_06_dasm(DASM_PARAMS); break; // NEGSW
314      case 0x07: size = arcompact_handle05_2f_07_dasm(DASM_PARAMS); break; // NEGS
315      case 0x08: size = arcompact_handle05_2f_08_dasm(DASM_PARAMS); break; // NORMW
310      case 0x03: size = arcompact_handle05_2f_03_dasm(DASM_PARAMS); break; // RND16
311      case 0x04: size = arcompact_handle05_2f_04_dasm(DASM_PARAMS); break; // ABSSW
312      case 0x05: size = arcompact_handle05_2f_05_dasm(DASM_PARAMS); break; // ABSS
313      case 0x06: size = arcompact_handle05_2f_06_dasm(DASM_PARAMS); break; // NEGSW
314      case 0x07: size = arcompact_handle05_2f_07_dasm(DASM_PARAMS); break; // NEGS
315      case 0x08: size = arcompact_handle05_2f_08_dasm(DASM_PARAMS); break; // NORMW
316316      case 0x09: size = arcompact_handle05_2f_09_dasm(DASM_PARAMS); break; // illegal
317317      case 0x0a: size = arcompact_handle05_2f_0a_dasm(DASM_PARAMS); break; // illegal
318318      case 0x0b: size = arcompact_handle05_2f_0b_dasm(DASM_PARAMS); break; // illegal
r242631r242632
759759
760760   switch (subinstr)
761761   {
762      case 0x00: size = arcompact_handle17_00_dasm(DASM_PARAMS); break; // ASL_S
763      case 0x01: size = arcompact_handle17_01_dasm(DASM_PARAMS); break; // LSR_S
762      case 0x00: size = arcompact_handle17_00_dasm(DASM_PARAMS); break; // ASL_S
763      case 0x01: size = arcompact_handle17_01_dasm(DASM_PARAMS); break; // LSR_S
764764      case 0x02: size = arcompact_handle17_02_dasm(DASM_PARAMS); break; // ASR_S
765      case 0x03: size = arcompact_handle17_03_dasm(DASM_PARAMS); break; // SUB_S
766      case 0x04: size = arcompact_handle17_04_dasm(DASM_PARAMS); break; // BSET_S
767      case 0x05: size = arcompact_handle17_05_dasm(DASM_PARAMS); break; // BCLR_S
768      case 0x06: size = arcompact_handle17_06_dasm(DASM_PARAMS); break; // BMSK_S
765      case 0x03: size = arcompact_handle17_03_dasm(DASM_PARAMS); break; // SUB_S
766      case 0x04: size = arcompact_handle17_04_dasm(DASM_PARAMS); break; // BSET_S
767      case 0x05: size = arcompact_handle17_05_dasm(DASM_PARAMS); break; // BCLR_S
768      case 0x06: size = arcompact_handle17_06_dasm(DASM_PARAMS); break; // BMSK_S
769769      case 0x07: size = arcompact_handle17_07_dasm(DASM_PARAMS); break; // BTST_S
770770   }
771771
r242631r242632
795795   return size;
796796}
797797
798int arcompact_handle18_05_dasm(DASM_OPS_16)
798int arcompact_handle18_05_dasm(DASM_OPS_16)
799799{
800800   int size = 2;
801801   UINT8 subinstr2 = (op & 0x0700) >> 8;
r242631r242632
805805   {
806806      case 0x00: size = arcompact_handle18_05_00_dasm(DASM_PARAMS); break; // ADD_S (SP)
807807      case 0x01: size = arcompact_handle18_05_01_dasm(DASM_PARAMS); break; // SUB_S (SP)
808      case 0x02: size = arcompact_handle18_05_02_dasm(DASM_PARAMS); break; // <illegal 0x18_05_02>
808      case 0x02: size = arcompact_handle18_05_02_dasm(DASM_PARAMS); break; // <illegal 0x18_05_02>
809809      case 0x03: size = arcompact_handle18_05_03_dasm(DASM_PARAMS); break; // <illegal 0x18_05_03>
810810      case 0x04: size = arcompact_handle18_05_04_dasm(DASM_PARAMS); break; // <illegal 0x18_05_04>
811811      case 0x05: size = arcompact_handle18_05_05_dasm(DASM_PARAMS); break; // <illegal 0x18_05_05>
r242631r242632
816816   return size;
817817}
818818
819int arcompact_handle18_06_dasm(DASM_OPS_16)
819int arcompact_handle18_06_dasm(DASM_OPS_16)
820820{
821821   int size = 2;
822822   UINT8 subinstr2 = (op & 0x001f) >> 0;
r242631r242632
861861   return size;
862862}
863863
864int arcompact_handle18_07_dasm(DASM_OPS_16)
864int arcompact_handle18_07_dasm(DASM_OPS_16)
865865{
866866   int size = 2;
867867   UINT8 subinstr2 = (op & 0x001f) >> 0;
r242631r242632
968968
969969int arcompact_handle1e_03_dasm(DASM_OPS_16)
970970{
971   
972971   int size = 2;
973972   UINT8 subinstr2 = (op & 0x01c0) >> 6;
974973   op &= ~0x01c0;
r242631r242632
976975   switch (subinstr2)
977976   {
978977      case 0x00: size = arcompact_handle1e_03_00_dasm(DASM_PARAMS); break; // BGT_S
979      case 0x01: size = arcompact_handle1e_03_01_dasm(DASM_PARAMS); break; // BGE_S
978      case 0x01: size = arcompact_handle1e_03_01_dasm(DASM_PARAMS); break; // BGE_S
980979      case 0x02: size = arcompact_handle1e_03_02_dasm(DASM_PARAMS); break; // BLT_S
981980      case 0x03: size = arcompact_handle1e_03_03_dasm(DASM_PARAMS); break; // BLE_S
982981      case 0x04: size = arcompact_handle1e_03_04_dasm(DASM_PARAMS); break; // BHI_S
983982      case 0x05: size = arcompact_handle1e_03_05_dasm(DASM_PARAMS); break; // BHS_S
984983      case 0x06: size = arcompact_handle1e_03_06_dasm(DASM_PARAMS); break; // BLO_S
985      case 0x07: size = arcompact_handle1e_03_07_dasm(DASM_PARAMS); break; // BLS_S
984      case 0x07: size = arcompact_handle1e_03_07_dasm(DASM_PARAMS); break; // BLS_S
986985   }
987986   return size;
988987
trunk/src/emu/cpu/arcompact/arcompactdasm_dispatch.h
r242631r242632
1212
1313#define GET_LIMM_32 \
1414   limm = oprom[6] | (oprom[7] << 8); \
15   limm |= (oprom[4] << 16) | (oprom[5] << 24); \
15   limm |= (oprom[4] << 16) | (oprom[5] << 24);
1616
1717
18
1918int arcompact_handle00_dasm(DASM_OPS_32);
2019int arcompact_handle01_dasm(DASM_OPS_32);
2120int arcompact_handle01_00_dasm(DASM_OPS_32);
trunk/src/emu/cpu/arcompact/arcompactdasm_ops.c
r242631r242632
3131
3232#define GROUP_0e_GET_h \
3333   h =  ((op & 0x0007) << 3); \
34    h |= ((op & 0x00e0) >> 5); \
35   op &= ~0x00e7; \
36
34   h |= ((op & 0x00e0) >> 5); \
35   op &= ~0x00e7;
3736#define COMMON32_GET_breg \
3837   int b_temp = (op & 0x07000000) >> 24; op &= ~0x07000000; \
3938   int B_temp = (op & 0x00007000) >> 12; op &= ~0x00007000; \
40   int breg = b_temp | (B_temp << 3); \
41
39   int breg = b_temp | (B_temp << 3);
4240#define COMMON32_GET_creg \
43   int creg = (op & 0x00000fc0) >> 6; op &= ~0x00000fc0; \
44
41   int creg = (op & 0x00000fc0) >> 6; op &= ~0x00000fc0;
4542#define COMMON32_GET_u6 \
46   int u = (op & 0x00000fc0) >> 6; op &= ~0x00000fc0; \
47
43   int u = (op & 0x00000fc0) >> 6; op &= ~0x00000fc0;
4844#define COMMON32_GET_areg \
49   int areg = (op & 0x0000003f) >> 0; op &= ~0x0000003f; \
50
45   int areg = (op & 0x0000003f) >> 0; op &= ~0x0000003f;
5146#define COMMON32_GET_areg_reserved \
52   int ares = (op & 0x0000003f) >> 0; op &= ~0x0000003f; \
53
47   int ares = (op & 0x0000003f) >> 0; op &= ~0x0000003f;
5448#define COMMON32_GET_F \
55   int F = (op & 0x00008000) >> 15; op &= ~0x00008000; \
56
49   int F = (op & 0x00008000) >> 15; op &= ~0x00008000;
5750#define COMMON32_GET_p \
58   int p = (op & 0x00c00000) >> 22; op &= ~0x00c00000; \
51   int p = (op & 0x00c00000) >> 22; op &= ~0x00c00000;
5952
60
6153#define COMMON32_GET_s12 \
6254      int S_temp = (op & 0x0000003f) >> 0; op &= ~0x0000003f; \
6355      int s_temp = (op & 0x00000fc0) >> 6; op &= ~0x00000fc0; \
64      int S = s_temp | (S_temp<<6); \
65
56      int S = s_temp | (S_temp<<6);
6657#define COMMON32_GET_CONDITION \
6758      UINT8 condition = op & 0x0000001f;  op &= ~0x0000001f;
6859
6960
7061#define COMMON16_GET_breg \
7162   breg =  ((op & 0x0700) >>8); \
72   op &= ~0x0700; \
73
63   op &= ~0x0700;
7464#define COMMON16_GET_creg \
7565   creg =  ((op & 0x00e0) >>5); \
76   op &= ~0x00e0; \
77
66   op &= ~0x00e0;
7867#define COMMON16_GET_areg \
7968   areg =  ((op & 0x0007) >>0); \
80   op &= ~0x0007; \
81
69   op &= ~0x0007;
8270#define COMMON16_GET_u3 \
8371   u =  ((op & 0x0007) >>0); \
84   op &= ~0x0007; \
85
72   op &= ~0x0007;
8673#define COMMON16_GET_u5 \
8774   u =  ((op & 0x001f) >>0); \
88   op &= ~0x001f; \
89
75   op &= ~0x001f;
9076#define COMMON16_GET_u8 \
9177   u =  ((op & 0x00ff) >>0); \
92   op &= ~0x00ff; \
93
78   op &= ~0x00ff;
9479#define COMMON16_GET_u7 \
9580   u =  ((op & 0x007f) >>0); \
96   op &= ~0x007f; \
97
81   op &= ~0x007f;
9882#define COMMON16_GET_s9 \
9983   s =  ((op & 0x01ff) >>0); \
100   op &= ~0x01ff; \
101
84   op &= ~0x01ff;
10285// registers used in 16-bit opcodes hae a limited range
10386// and can only address registers r0-r3 and r12-r15
10487
10588#define REG_16BIT_RANGE(_reg_) \
106   if (_reg_>3) _reg_+= 8; \
89   if (_reg_>3) _reg_+= 8;
10790
108
10991// this is as messed up as the rest of the 16-bit alignment in LE mode...
11092
11193#define GET_LIMM \
11294   limm = oprom[4] | (oprom[5] << 8); \
113   limm |= (oprom[2] << 16) | (oprom[3] << 24); \
114
95   limm |= (oprom[2] << 16) | (oprom[3] << 24);
11596#define PC_ALIGNED32 \
11697   (pc&0xfffffffc)
11798
r242631r242632
163144   // 00001 sssssssss 00 SSSSSSSSSS N QQQQQ
164145   INT32 address =   (op & 0x07fc0000) >> 17;
165146   address |=        ((op & 0x0000ffc0) >> 6) << 10;
166   if (address & 0x800000) address = -0x800000 + (address&0x7fffff);   
147   if (address & 0x800000) address = -0x800000 + (address&0x7fffff);
167148   int n = (op & 0x00000020) >> 5; op &= ~0x00000020;
168149
169150   COMMON32_GET_CONDITION
r242631r242632
180161   INT32 address =   (op & 0x07fc0000) >> 17;
181162   address |=        ((op & 0x0000ffc0) >> 6) << 10;
182163   address |=        ((op & 0x0000000f) >> 0) << 20;
183   if (address & 0x800000) address = -0x800000 + (address&0x7fffff);   
164   if (address & 0x800000) address = -0x800000 + (address&0x7fffff);
184165   int n = (op & 0x00000020) >> 5; op &= ~0x00000020;
185166   int res =  (op & 0x00000010) >> 4; op &= ~0x00000010;
186167
r242631r242632
265246   op &= ~0x07007fe0;
266247
267248   print("%s%s %s, 0x%02x %08x (%08x)", optext, delaybit[n], regnames[breg], u, PC_ALIGNED32 + (address * 2), op & ~0xf8fe800f);
268   
249
269250   return size;
270251}
271252
r242631r242632
327308{
328309   int size = 4;
329310   UINT32 limm = 0;
330   int got_limm = 0;
311   int got_limm = 0;
331312   // bitpos
332313   // 1111 1111 1111 1111 0000 0000 0000 0000
333314   // fedc ba98 7654 3210 fedc ba98 7654 3210
r242631r242632
401382
402383   output += sprintf(output, "%s", optext);
403384   output += sprintf(output, "%s", flagbit[F]);
404   //   output  += sprintf( output, " p(%d)", p);
385   //  output  += sprintf( output, " p(%d)", p);
405386
406387
407388   if ((!b_reserved) && (breg == LIMM_REG))
r242631r242632
429410   }
430411   else if (ignore_dst == 1) // certain opcode types ignore the 'a' field entirely, it should be set to 0.
431412   {
432      if (areg) output += sprintf(output, " <reserved %d> <-", areg);
413         if (areg) output += sprintf(output, " <reserved %d> <-", areg);
433414   }
434415   else if (ignore_dst == 2) // for multiply operations areg should always be set to LIMM
435416   {
r242631r242632
464445   // 0010 0bbb 01ii iiii FBBB uuuu uuAA AAAA
465446   int size = 4;
466447   UINT32 limm = 0;
467//   int got_limm = 0;
448//  int got_limm = 0;
468449
469450   COMMON32_GET_breg;
470451   COMMON32_GET_F;
r242631r242632
473454
474455   output += sprintf(output, "%s", optext);
475456   output += sprintf(output, "%s", flagbit[F]);
476   //   output  += sprintf( output, " p(%d)", p);
457   //  output  += sprintf( output, " p(%d)", p);
477458
478459
479460   if ((!b_reserved) && (breg == LIMM_REG))
480461   {
481462      GET_LIMM_32;
482463      size = 8;
483//      got_limm = 1;
464//      got_limm = 1;
484465   }
485466
486467   // areg can be LIMM too, but in that case LIMM indicates 'no destination' rather than an actual LIMM value following
r242631r242632
492473   }
493474   else if (ignore_dst == 1) // certain opcode types ignore the 'a' field entirely, it should be set to 0.
494475   {
495      if (areg) output += sprintf(output, " <reserved %d> <-", areg);
476         if (areg) output += sprintf(output, " <reserved %d> <-", areg);
496477   }
497478   else if (ignore_dst == 2) // for multiply operations areg should always be set to LIMM
498479   {
r242631r242632
530511
531512   output += sprintf(output, "%s", optext);
532513   output += sprintf(output, "%s", flagbit[F]);
533   //   output  += sprintf( output, " p(%d)", p);
514   //  output  += sprintf( output, " p(%d)", p);
534515
535516
536517   if (!b_reserved)
r242631r242632
570551
571552   output += sprintf(output, "%s", optext);
572553   output += sprintf(output, "%s", flagbit[F]);
573   //   output  += sprintf( output, " p(%d)", p);
554   //  output  += sprintf( output, " p(%d)", p);
574555
575556   if (!b_reserved)
576557   {
r242631r242632
594575
595576
596577   output += sprintf(output, " Cond<%s> ", conditions[condition]);
597   
598578
579
599580   if (creg == LIMM_REG)
600581   {
601582      if (!got_limm)
r242631r242632
626607
627608   output += sprintf(output, "%s", optext);
628609   output += sprintf(output, "%s", flagbit[F]);
629   //   output  += sprintf( output, " p(%d)", p);
610   //  output  += sprintf( output, " p(%d)", p);
630611
631612   if (!b_reserved)
632613   {
r242631r242632
685666   return 0;
686667}
687668
688int arcompact_handle04_00_dasm(DASM_OPS_32) 
669int arcompact_handle04_00_dasm(DASM_OPS_32)
689670{
690671   return arcompact_handle04_helper_dasm(DASM_PARAMS, "ADD", 0,0);
691672}
692673
693int arcompact_handle04_01_dasm(DASM_OPS_32) 
694{
674int arcompact_handle04_01_dasm(DASM_OPS_32)
675{
695676   return arcompact_handle04_helper_dasm(DASM_PARAMS, "ADC", 0,0);
696677}
697678
698int arcompact_handle04_02_dasm(DASM_OPS_32) 
699{
679int arcompact_handle04_02_dasm(DASM_OPS_32)
680{
700681   return arcompact_handle04_helper_dasm(DASM_PARAMS, "SUB", 0,0);
701682}
702683
703int arcompact_handle04_03_dasm(DASM_OPS_32) 
684int arcompact_handle04_03_dasm(DASM_OPS_32)
704685{
705686   return arcompact_handle04_helper_dasm(DASM_PARAMS, "SBC", 0,0);
706687}
707688
708int arcompact_handle04_04_dasm(DASM_OPS_32) 
689int arcompact_handle04_04_dasm(DASM_OPS_32)
709690{
710691   return arcompact_handle04_helper_dasm(DASM_PARAMS, "AND", 0,0);
711692}
712693
713int arcompact_handle04_05_dasm(DASM_OPS_32) 
694int arcompact_handle04_05_dasm(DASM_OPS_32)
714695{
715696   return arcompact_handle04_helper_dasm(DASM_PARAMS, "OR", 0,0);
716697}
717698
718int arcompact_handle04_06_dasm(DASM_OPS_32) 
699int arcompact_handle04_06_dasm(DASM_OPS_32)
719700{
720701   return arcompact_handle04_helper_dasm(DASM_PARAMS, "BIC", 0,0);
721702}
722703
723int arcompact_handle04_07_dasm(DASM_OPS_32) 
704int arcompact_handle04_07_dasm(DASM_OPS_32)
724705{
725706   return arcompact_handle04_helper_dasm(DASM_PARAMS, "XOR", 0,0);
726707}
727708
728int arcompact_handle04_08_dasm(DASM_OPS_32) 
709int arcompact_handle04_08_dasm(DASM_OPS_32)
729710{
730711   return arcompact_handle04_helper_dasm(DASM_PARAMS, "MAX", 0,0);
731712}
732713
733int arcompact_handle04_09_dasm(DASM_OPS_32)
714int arcompact_handle04_09_dasm(DASM_OPS_32)
734715{
735716   return arcompact_handle04_helper_dasm(DASM_PARAMS, "MIN", 0,0);
736717}
r242631r242632
752733}
753734
754735int arcompact_handle04_0d_dasm(DASM_OPS_32)
755{
736{
756737   return arcompact_handle04_helper_dasm(DASM_PARAMS, "RCMP", 1,0);
757738}
758739
759740int arcompact_handle04_0e_dasm(DASM_OPS_32)
760{
741{
761742   return arcompact_handle04_helper_dasm(DASM_PARAMS, "RSUB", 0,0);
762743}
763744
764int arcompact_handle04_0f_dasm(DASM_OPS_32) 
765{
745int arcompact_handle04_0f_dasm(DASM_OPS_32)
746{
766747   return arcompact_handle04_helper_dasm(DASM_PARAMS, "BSET", 0,0);
767748}
768749
769int arcompact_handle04_10_dasm(DASM_OPS_32) 
770{
750int arcompact_handle04_10_dasm(DASM_OPS_32)
751{
771752   return arcompact_handle04_helper_dasm(DASM_PARAMS, "BCLR", 0,0);
772753}
773754
774int arcompact_handle04_11_dasm(DASM_OPS_32) 
775{
755int arcompact_handle04_11_dasm(DASM_OPS_32)
756{
776757   return arcompact_handle04_helper_dasm(DASM_PARAMS, "BTST", 0,0);
777758}
778759
779int arcompact_handle04_12_dasm(DASM_OPS_32) 
780{
760int arcompact_handle04_12_dasm(DASM_OPS_32)
761{
781762   return arcompact_handle04_helper_dasm(DASM_PARAMS, "BXOR", 0,0);
782763}
783764
784int arcompact_handle04_13_dasm(DASM_OPS_32) 
785{
765int arcompact_handle04_13_dasm(DASM_OPS_32)
766{
786767   return arcompact_handle04_helper_dasm(DASM_PARAMS, "BMSK", 0,0);
787768}
788769
789int arcompact_handle04_14_dasm(DASM_OPS_32) 
790{
770int arcompact_handle04_14_dasm(DASM_OPS_32)
771{
791772   return arcompact_handle04_helper_dasm(DASM_PARAMS, "ADD1", 0,0);
792773}
793774
794int arcompact_handle04_15_dasm(DASM_OPS_32) 
795{
775int arcompact_handle04_15_dasm(DASM_OPS_32)
776{
796777   return arcompact_handle04_helper_dasm(DASM_PARAMS, "ADD2", 0,0);
797778}
798779
799int arcompact_handle04_16_dasm(DASM_OPS_32) 
800{
780int arcompact_handle04_16_dasm(DASM_OPS_32)
781{
801782   return arcompact_handle04_helper_dasm(DASM_PARAMS, "ADD3", 0,0);
802783}
803784
804int arcompact_handle04_17_dasm(DASM_OPS_32) 
805{
785int arcompact_handle04_17_dasm(DASM_OPS_32)
786{
806787   return arcompact_handle04_helper_dasm(DASM_PARAMS, "SUB1", 0,0);
807788}
808789
809int arcompact_handle04_18_dasm(DASM_OPS_32) 
810{
790int arcompact_handle04_18_dasm(DASM_OPS_32)
791{
811792   return arcompact_handle04_helper_dasm(DASM_PARAMS, "SUB2", 0,0);
812793}
813794
814int arcompact_handle04_19_dasm(DASM_OPS_32) 
815{
795int arcompact_handle04_19_dasm(DASM_OPS_32)
796{
816797   return arcompact_handle04_helper_dasm(DASM_PARAMS, "SUB3", 0,0);
817798}
818799
819int arcompact_handle04_1a_dasm(DASM_OPS_32) 
820{
800int arcompact_handle04_1a_dasm(DASM_OPS_32)
801{
821802   return arcompact_handle04_helper_dasm(DASM_PARAMS, "MPY", 0,0);
822803} // *
823804
824int arcompact_handle04_1b_dasm(DASM_OPS_32) 
825{
805int arcompact_handle04_1b_dasm(DASM_OPS_32)
806{
826807   return arcompact_handle04_helper_dasm(DASM_PARAMS, "MPYH", 0,0);
827808} // *
828809
829int arcompact_handle04_1c_dasm(DASM_OPS_32) 
830{
810int arcompact_handle04_1c_dasm(DASM_OPS_32)
811{
831812   return arcompact_handle04_helper_dasm(DASM_PARAMS, "MPYHU", 0,0);
832813} // *
833814
834int arcompact_handle04_1d_dasm(DASM_OPS_32) 
835{
815int arcompact_handle04_1d_dasm(DASM_OPS_32)
816{
836817   return arcompact_handle04_helper_dasm(DASM_PARAMS, "MPYU", 0,0);
837818} // *
838819
r242631r242632
890871      output += sprintf(output, "LP<%s> (start %08x, end %08x)", conditions[condition], pc + 4, PC_ALIGNED32 + u*2);
891872
892873      int unused = (op & 0x00000020)>>5;
893      if (unused==0)    output += sprintf(output, "(unused bit not set)");
874      if (unused==0) output += sprintf(output, "(unused bit not set)");
894875
895876   }
896877
r242631r242632
908889            output  += sprintf( output, "[%03x]", auxreg); \
909890      } \
910891      else \
911         output  += sprintf( output, "[%03x]", auxreg); \
912
892         output  += sprintf( output, "[%03x]", auxreg);
913893int arcompact_handle04_2a_dasm(DASM_OPS_32)  // Load FROM Auxiliary register TO register
914894{
915
916895   //           pp        F
917896   // 0010 0bbb 0010 1010 0BBB CCCC CCRR RRRR
918897   // 0010 0bbb 0010 1010 0BBB 1111 10RR RRRR
r242631r242632
930909
931910   output  += sprintf( output, "LR");
932911   if (F) output  += sprintf( output, ".<F set, illegal>");
933//   output  += sprintf( output, " p(%d)", p);
934   
935   
912//  output  += sprintf( output, " p(%d)", p);
936913
914
915
937916   if (breg == LIMM_REG)
938917   {
939918      output  += sprintf( output, "<no dest>" ); // illegal encoding?
r242631r242632
947926
948927   if (p == 0)
949928   {
950
951929      COMMON32_GET_creg
952930      COMMON32_GET_areg_reserved
953931
r242631r242632
960938         }
961939
962940         output  += sprintf( output, "(%08x) ", limm );
963   
941
964942      }
965943      else
966944      {
r242631r242632
976954
977955      int auxreg = u;
978956      PRINT_AUX_REGNAME
979     
957
980958      if (ares) output  += sprintf( output, "reserved(%02x) ", ares );
981959   }
982960   else if (p == 2)
r242631r242632
996974}
997975
998976int arcompact_handle04_2b_dasm(DASM_OPS_32)  // Store TO Auxiliary register FROM register
999{   
977{
1000978   // code at ~ 40073DFE in leapster bios is manually setting up a loop this way
1001979   // rather than using the lPcc opcode
1002980
r242631r242632
1010988
1011989   output  += sprintf( output, "SR");
1012990   if (F) output  += sprintf( output, ".<F set, illegal>");
1013//   output  += sprintf( output, " p(%d)", p);
1014   
1015   
991//  output  += sprintf( output, " p(%d)", p);
1016992
993
994
1017995   if (breg == LIMM_REG)
1018996   {
1019997      GET_LIMM_32;
r242631r242632
10311009
10321010   if (p == 0)
10331011   {
1034
10351012      COMMON32_GET_creg
10361013      COMMON32_GET_areg_reserved
10371014
r242631r242632
10951072
10961073int arcompact_handle04_2f_helper_dasm(DASM_OPS_32, const char* optext)
10971074{
1098   //           
1075   //
10991076   // 0010 0bbb pp10 1111 FBBB CCCC CCII IIII
11001077   int size = 4;
11011078
r242631r242632
11051082
11061083   output  += sprintf( output, "%s", optext);
11071084   output  += sprintf( output, "%s", flagbit[F]);
1108//   output  += sprintf( output, " p(%d)", p);
1109   
1085//  output  += sprintf( output, " p(%d)", p);
1086
11101087   if (breg == LIMM_REG)
11111088   {
11121089      output += sprintf(output, " <no dst>, ");
r242631r242632
11251102      {
11261103         UINT32 limm;
11271104         GET_LIMM_32;
1128         size = 8;   
1105         size = 8;
11291106         output  += sprintf( output, "(%08x) ", limm );
11301107
11311108      }
r242631r242632
12321209   else
12331210   {
12341211      output  += sprintf( output, "%s]", regnames[creg]);
1235   }   
1212   }
12361213
12371214
12381215   return size;
1239   
12401216
12411217
1218
12421219}
12431220
12441221int arcompact_handle04_30_dasm(DASM_OPS_32)  { return arcompact_handle04_3x_helper_dasm(DASM_PARAMS,0,0); }
r242631r242632
12791256
12801257int arcompact_handle05_2f_0x_helper_dasm(DASM_OPS_32, const char* optext)
12811258{
1282   //           
1259   //
12831260   // 0010 1bbb pp10 1111 FBBB CCCC CCII IIII when pp == 0x00
12841261   // or
12851262   // 0010 1bbb pp10 1111 FBBB UUUU UUII IIII when pp == 0x01
r242631r242632
12931270
12941271   output  += sprintf( output, "%s", optext);
12951272   output  += sprintf( output, "%s", flagbit[F]);
1296//   output  += sprintf( output, " p(%d)", p);
1297   
1298   
1273//  output  += sprintf( output, " p(%d)", p);
1274
1275
12991276   output += sprintf(output, " %s, ", regnames[breg]);
13001277
13011278   if (p == 0)
r242631r242632
13061283      {
13071284         UINT32 limm;
13081285         GET_LIMM_32;
1309         size = 8;   
1286         size = 8;
13101287         output  += sprintf( output, "(%08x) ", limm );
13111288
13121289      }
r242631r242632
14691446   GROUP_0e_GET_h;
14701447   COMMON16_GET_breg;
14711448   REG_16BIT_RANGE(breg);
1472   
1449
14731450   if (h == LIMM_REG)
14741451   {
14751452      UINT32 limm;
r242631r242632
15171494
15181495   COMMON16_GET_breg;
15191496   REG_16BIT_RANGE(breg);
1520   
1497
15211498   print("%s %s", optext, regnames[breg]);
15221499
15231500   return 2;
r242631r242632
17241701}
17251702
17261703
1727// op bits remaining for 0x18_xx subgroups 0x071f
1704// op bits remaining for 0x18_xx subgroups 0x071f
17281705
17291706int arcompact_handle18_0x_helper_dasm(DASM_OPS_16, const char* optext, int st, int format)
17301707{
r242631r242632
17461723   return 2;
17471724}
17481725
1749int arcompact_handle18_00_dasm(DASM_OPS_16)
1726int arcompact_handle18_00_dasm(DASM_OPS_16)
17501727{
17511728   return arcompact_handle18_0x_helper_dasm(DASM_PARAMS, "LD_S", 0,0);
17521729}
17531730
1754int arcompact_handle18_01_dasm(DASM_OPS_16)
1731int arcompact_handle18_01_dasm(DASM_OPS_16)
17551732{
17561733   return arcompact_handle18_0x_helper_dasm(DASM_PARAMS, "LDB_S", 0,0);
17571734}
17581735
1759int arcompact_handle18_02_dasm(DASM_OPS_16)
1736int arcompact_handle18_02_dasm(DASM_OPS_16)
17601737{
17611738   return arcompact_handle18_0x_helper_dasm(DASM_PARAMS, "ST_S", 1,0);
17621739}
17631740
1764int arcompact_handle18_03_dasm(DASM_OPS_16)
1741int arcompact_handle18_03_dasm(DASM_OPS_16)
17651742{
17661743   return arcompact_handle18_0x_helper_dasm(DASM_PARAMS, "STB_S", 1,0);
17671744}
17681745
1769int arcompact_handle18_04_dasm(DASM_OPS_16)
1746int arcompact_handle18_04_dasm(DASM_OPS_16)
17701747{
17711748   return arcompact_handle18_0x_helper_dasm(DASM_PARAMS, "ADD_S", 1,1); // check format
17721749}
r242631r242632
17911768   return 2;
17921769}
17931770
1794// op bits remaining for 0x18_06_xx subgroups 0x0700
1795int arcompact_handle18_06_01_dasm(DASM_OPS_16)
1771// op bits remaining for 0x18_06_xx subgroups 0x0700
1772int arcompact_handle18_06_01_dasm(DASM_OPS_16)
17961773{
17971774   int breg;
17981775   COMMON16_GET_breg
r242631r242632
18031780   return 2;
18041781}
18051782
1806int arcompact_handle18_06_11_dasm(DASM_OPS_16)
1783int arcompact_handle18_06_11_dasm(DASM_OPS_16)
18071784{
18081785   int res = (op & 0x0700) >> 8;
18091786   op &= ~0x0700; // all bits now used
r242631r242632
18161793   return 2;
18171794}
18181795
1819// op bits remaining for 0x18_07_xx subgroups 0x0700
1820int arcompact_handle18_07_01_dasm(DASM_OPS_16)
1796// op bits remaining for 0x18_07_xx subgroups 0x0700
1797int arcompact_handle18_07_01_dasm(DASM_OPS_16)
18211798{
18221799   int breg;
18231800   COMMON16_GET_breg
r242631r242632
18291806}
18301807
18311808
1832int arcompact_handle18_07_11_dasm(DASM_OPS_16)
1809int arcompact_handle18_07_11_dasm(DASM_OPS_16)
18331810{
18341811   int res = (op & 0x0700) >> 8;
18351812   op &= ~0x0700; // all bits now used
r242631r242632
19211898   COMMON16_GET_breg;
19221899   REG_16BIT_RANGE(breg);
19231900
1924   int s = (op & 0x007f) >> 0;   op &= ~0x007f;
1901   int s = (op & 0x007f) >> 0; op &= ~0x007f;
19251902   if (s & 0x40) s = -0x40 + (s & 0x3f);
19261903
19271904   print("%s %s, 0 to 0x%08x", optext, regnames[breg], PC_ALIGNED32 + s*2);
r242631r242632
19351912
19361913int arcompact_handle1e_0x_helper_dasm(DASM_OPS_16, const char* optext)
19371914{
1938   int s = (op & 0x01ff) >> 0;   op &= ~0x01ff;
1915   int s = (op & 0x01ff) >> 0; op &= ~0x01ff;
19391916   if (s & 0x100) s = -0x100 + (s & 0xff);
19401917
19411918   print("%s %08x", optext, PC_ALIGNED32 + s*2);
r242631r242632
19501927
19511928int arcompact_handle1e_03_0x_helper_dasm(DASM_OPS_16, const char* optext)
19521929{
1953   int s = (op & 0x003f) >> 0;   op &= ~0x003f;
1930   int s = (op & 0x003f) >> 0; op &= ~0x003f;
19541931   if (s & 0x020) s = -0x20 + (s & 0x1f);
19551932
19561933   print("%s %08x", optext, PC_ALIGNED32 + s*2);
r242631r242632
19681945
19691946int arcompact_handle1f_dasm(DASM_OPS_16)
19701947{
1971   int s = (op & 0x07ff) >> 0;   op &= ~0x07ff;
1948   int s = (op & 0x07ff) >> 0; op &= ~0x07ff;
19721949   if (s & 0x400) s = -0x400 + (s & 0x3ff);
19731950
19741951   print("BL_S %08x", PC_ALIGNED32 + (s*4));
r242631r242632
23892366int arcompact_handle18_07_1d_dasm(DASM_OPS_16)  { print("<illegal 0x18_07_1d> (%04x)",  op); return 2;}
23902367int arcompact_handle18_07_1e_dasm(DASM_OPS_16)  { print("<illegal 0x18_07_1e> (%04x)",  op); return 2;}
23912368int arcompact_handle18_07_1f_dasm(DASM_OPS_16)  { print("<illegal 0x18_07_1f> (%04x)",  op); return 2;}
2392
trunk/src/emu/cpu/arcompact/arcompactdasm_ops.h
r242631r242632
1515
1616#define GET_LIMM_32 \
1717   limm = oprom[6] | (oprom[7] << 8); \
18   limm |= (oprom[4] << 16) | (oprom[5] << 24); \
18   limm |= (oprom[4] << 16) | (oprom[5] << 24);
1919
20
2120int arcompact_handle00_00_dasm(DASM_OPS_32);
2221int arcompact_handle00_01_dasm(DASM_OPS_32);
2322int arcompact_handle01_00_00dasm(DASM_OPS_32);
r242631r242632
367366int arcompact_handle04_2f_3f_3b_dasm(DASM_OPS_32);
368367int arcompact_handle04_2f_3f_3c_dasm(DASM_OPS_32);
369368int arcompact_handle04_2f_3f_3d_dasm(DASM_OPS_32);
370int arcompact_handle04_2f_3f_3e_dasm(DASM_OPS_32);
369int arcompact_handle04_2f_3f_3e_dasm(DASM_OPS_32);
371370int arcompact_handle04_2f_3f_3f_dasm(DASM_OPS_32);
372371
373372int arcompact_handle05_2f_00_dasm(DASM_OPS_32);
r242631r242632
632631int arcompact_handle18_07_16_dasm(DASM_OPS_16);
633632int arcompact_handle18_07_17_dasm(DASM_OPS_16);
634633int arcompact_handle18_07_18_dasm(DASM_OPS_16);
635int arcompact_handle18_07_19_dasm(DASM_OPS_16);
634int arcompact_handle18_07_19_dasm(DASM_OPS_16);
636635int arcompact_handle18_07_1a_dasm(DASM_OPS_16);
637636int arcompact_handle18_07_1b_dasm(DASM_OPS_16);
638637int arcompact_handle18_07_1c_dasm(DASM_OPS_16);
trunk/src/emu/cpu/cpu.mak
r242631r242632
129129$(CPUOBJ)/arcompact/arcompact.inc: $(CPUSRC)/arcompact/arcompact_make.py
130130   @echo Generating arcompact source .inc files...
131131   $(PYTHON) $(CPUSRC)/arcompact/arcompact_make.py $@
132   
132
133133#-------------------------------------------------
134134# Acorn ARM series
135135#
trunk/src/emu/cpu/h8/h8_timer16.c
r242631r242632
347347      sprintf(tm, "%d", i);
348348      timer_channel[i] = subdevice<h8_timer16_channel_device>(tm);
349349   }
350   
350
351351   save_item(NAME(tstr));
352352}
353353
trunk/src/emu/cpu/m68000/m68kcpu.c
r242631r242632
699699   {
700700      /* only the 68010 throws this unique type-1000 frame */
701701      m68ki_stack_frame_1000(m68k, REG_PPC(m68k), sr, EXCEPTION_BUS_ERROR);
702   }
702   }
703703   else if (m68k->mmu_tmp_buserror_address == REG_PPC(m68k))
704704   {
705705      m68ki_stack_frame_1010(m68k, sr, EXCEPTION_BUS_ERROR, REG_PPC(m68k), m68k->mmu_tmp_buserror_address);
trunk/src/emu/cpu/m68000/m68kdasm.c
r242631r242632
17281728
17291729   switch (g_cpu_ir & 0x7)
17301730   {
1731      case 2:   // word operand
1731      case 2: // word operand
17321732         w3 = read_imm_16();
17331733         sprintf(g_dasm_str, "ftrap%s.w   $%04x", g_cpcc[w2 & 0x3f], w3);
17341734         break;
17351735
1736      case 3:   // long word operand
1736      case 3: // long word operand
17371737         l2 = read_imm_32();
17381738         sprintf(g_dasm_str, "ftrap%s.l   $%08x", g_cpcc[w2 & 0x3f], l2);
17391739         break;
trunk/src/emu/cpu/pps4/pps4.c
r242631r242632
7171const device_type PPS4 = &device_creator<pps4_device>;
7272
7373pps4_device::pps4_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
74    : cpu_device(mconfig, PPS4, "PPS4", tag, owner, clock, "pps4", __FILE__ )
75    , m_program_config("program", ENDIANNESS_LITTLE, 8, 12)
76    , m_data_config("data", ENDIANNESS_LITTLE, 8, 12)  // 4bit RAM
77    , m_io_config("io", ENDIANNESS_LITTLE, 8, 8)  // 4bit IO
74   : cpu_device(mconfig, PPS4, "PPS4", tag, owner, clock, "pps4", __FILE__ )
75   , m_program_config("program", ENDIANNESS_LITTLE, 8, 12)
76   , m_data_config("data", ENDIANNESS_LITTLE, 8, 12)  // 4bit RAM
77   , m_io_config("io", ENDIANNESS_LITTLE, 8, 8)  // 4bit IO
7878{
7979}
8080
r242631r242632
8484 */
8585UINT8 pps4_device::M()
8686{
87    UINT8 ret = m_data->read_byte(m_B & ~m_SAG);
88    m_SAG = 0;
89    return ret;
87   UINT8 ret = m_data->read_byte(m_B & ~m_SAG);
88   m_SAG = 0;
89   return ret;
9090}
9191
9292
r242631r242632
9696 */
9797void pps4_device::W(UINT8 data)
9898{
99    m_data->write_byte(m_B & ~m_SAG, data);
100    m_SAG = 0;
99   m_data->write_byte(m_B & ~m_SAG, data);
100   m_SAG = 0;
101101}
102102
103103offs_t pps4_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options)
104104{
105    extern CPU_DISASSEMBLE( pps4 );
106    return CPU_DISASSEMBLE_NAME(pps4)(this, buffer, pc, oprom, opram, options);
105   extern CPU_DISASSEMBLE( pps4 );
106   return CPU_DISASSEMBLE_NAME(pps4)(this, buffer, pc, oprom, opram, options);
107107}
108108
109109/**
r242631r242632
115115 */
116116inline UINT8 pps4_device::ROP()
117117{
118    const UINT8 op = m_direct->read_decrypted_byte(m_P & 0xFFF);
119    m_Ip = m_I1;         // save previous opcode
120    m_P = (m_P + 1) & 0xFFF;
121    m_icount -= 1;
122    return op;
118   const UINT8 op = m_direct->read_decrypted_byte(m_P & 0xFFF);
119   m_Ip = m_I1;         // save previous opcode
120   m_P = (m_P + 1) & 0xFFF;
121   m_icount -= 1;
122   return op;
123123}
124124
125125/**
r242631r242632
131131 */
132132inline UINT8 pps4_device::ARG()
133133{
134    const UINT8 arg = m_direct->read_raw_byte(m_P & 0xFFF);
135    m_P = (m_P + 1) & 0xFFF;
136    m_icount -= 1;
137    return arg;
134   const UINT8 arg = m_direct->read_raw_byte(m_P & 0xFFF);
135   m_P = (m_P + 1) & 0xFFF;
136   m_icount -= 1;
137   return arg;
138138}
139139
140140/**
r242631r242632
173173 */
174174void pps4_device::iAD()
175175{
176    m_A = m_A + M();
177    m_C = (m_A >> 4) & 1;
178    m_A = m_A & 15;
176   m_A = m_A + M();
177   m_C = (m_A >> 4) & 1;
178   m_A = m_A & 15;
179179}
180180
181181/**
r242631r242632
193193 */
194194void pps4_device::iADC()
195195{
196    m_A = m_A + M() + m_C;
197    m_C = m_A >> 4;
198    m_A = m_A & 15;
196   m_A = m_A + M() + m_C;
197   m_C = m_A >> 4;
198   m_A = m_A & 15;
199199}
200200
201201/**
r242631r242632
214214 */
215215void pps4_device::iADSK()
216216{
217    m_A = m_A + M();
218    m_C = m_A >> 4;
219    m_Skip = m_C;
220    m_A = m_A & 15;
217   m_A = m_A + M();
218   m_C = m_A >> 4;
219   m_Skip = m_C;
220   m_A = m_A & 15;
221221}
222222
223223/**
r242631r242632
236236 */
237237void pps4_device::iADCSK()
238238{
239    m_A = m_A + M() + m_C;
240    m_C = m_A >> 4;
241    m_Skip = m_C;
242    m_A = m_A & 15;
239   m_A = m_A + M() + m_C;
240   m_C = m_A >> 4;
241   m_Skip = m_C;
242   m_A = m_A & 15;
243243}
244244
245245/**
r242631r242632
265265 */
266266void pps4_device::iADI()
267267{
268    const UINT8 imm = ~m_I1 & 15;
269    m_A = m_A + imm;
270    m_Skip = (m_A >> 4) & 1;
271    m_A = m_A & 15;
268   const UINT8 imm = ~m_I1 & 15;
269   m_A = m_A + imm;
270   m_Skip = (m_A >> 4) & 1;
271   m_A = m_A & 15;
272272}
273273
274274/**
r242631r242632
288288 */
289289void pps4_device::iDC()
290290{
291    m_A = m_A + 10;
291   m_A = m_A + 10;
292292}
293293
294294/**
r242631r242632
307307 */
308308void pps4_device::iAND()
309309{
310    m_A = m_A & M();
310   m_A = m_A & M();
311311}
312312
313313/**
r242631r242632
326326 */
327327void pps4_device::iOR()
328328{
329    m_A = m_A | M();
329   m_A = m_A | M();
330330}
331331
332332/**
r242631r242632
346346 */
347347void pps4_device::iEOR()
348348{
349    m_A = m_A ^ M();
349   m_A = m_A ^ M();
350350}
351351
352352/**
r242631r242632
364364 */
365365void pps4_device::iCOMP()
366366{
367    m_A = m_A ^ 15;
367   m_A = m_A ^ 15;
368368}
369369
370370/**
r242631r242632
381381 */
382382void pps4_device::iSC()
383383{
384    m_C = 1;
384   m_C = 1;
385385}
386386
387387/**
r242631r242632
398398 */
399399void pps4_device::iRC()
400400{
401    m_C = 0;
401   m_C = 0;
402402}
403403
404404/**
r242631r242632
415415 */
416416void pps4_device::iSF1()
417417{
418    m_FF1 = 1;
418   m_FF1 = 1;
419419}
420420
421421/**
r242631r242632
432432 */
433433void pps4_device::iRF1()
434434{
435    m_FF1 = 0;
435   m_FF1 = 0;
436436}
437437
438438/**
r242631r242632
449449 */
450450void pps4_device::iSF2()
451451{
452    m_FF2 = 1;
452   m_FF2 = 1;
453453}
454454
455455/**
r242631r242632
466466 */
467467void pps4_device::iRF2()
468468{
469    m_FF2 = 0;
469   m_FF2 = 0;
470470}
471471
472472/**
r242631r242632
490490 */
491491void pps4_device::iLD()
492492{
493    const UINT16 i3c = ~m_I1 & 7;
494    m_A = M();
495    m_B = m_B ^ (i3c << 4);
493   const UINT16 i3c = ~m_I1 & 7;
494   m_A = M();
495   m_B = m_B ^ (i3c << 4);
496496}
497497
498498/**
r242631r242632
513513 */
514514void pps4_device::iEX()
515515{
516    const UINT16 i3c = ~m_I1 & 7;
517    const UINT8 mem = M();
518    W(m_A);
519    m_A = mem;
520    m_B = m_B ^ (i3c << 4);
516   const UINT16 i3c = ~m_I1 & 7;
517   const UINT8 mem = M();
518   W(m_A);
519   m_A = mem;
520   m_B = m_B ^ (i3c << 4);
521521}
522522
523523/**
r242631r242632
542542 */
543543void pps4_device::iEXD()
544544{
545    const UINT8 i3c = ~m_I1 & 7;
546    const UINT8 mem = M();
547    UINT8 bl = m_B & 15;
548    W(m_A);
549    m_A = mem;
550    m_B = m_B ^ (i3c << 4);
551    // if decrement BL wraps to 1111b
552    if (0 == bl) {
553        bl = 15;
554        m_Skip = 1;
555    } else {
556        bl = bl - 1;
557    }
558    m_B = (m_B & ~15) | bl;
545   const UINT8 i3c = ~m_I1 & 7;
546   const UINT8 mem = M();
547   UINT8 bl = m_B & 15;
548   W(m_A);
549   m_A = mem;
550   m_B = m_B ^ (i3c << 4);
551   // if decrement BL wraps to 1111b
552   if (0 == bl) {
553      bl = 15;
554      m_Skip = 1;
555   } else {
556      bl = bl - 1;
557   }
558   m_B = (m_B & ~15) | bl;
559559}
560560
561561/**
r242631r242632
579579 */
580580void pps4_device::iLDI()
581581{
582    // previous LDI instruction?
583    if (0x70 == (m_Ip & 0xf0)) {
584        LOG(("%s: skip prev:%02x op:%02x\n", __FUNCTION__, m_Ip, m_I1));
585        return;
586    }
587    m_A = ~m_I1 & 15;
582   // previous LDI instruction?
583   if (0x70 == (m_Ip & 0xf0)) {
584      LOG(("%s: skip prev:%02x op:%02x\n", __FUNCTION__, m_Ip, m_I1));
585      return;
586   }
587   m_A = ~m_I1 & 15;
588588}
589589
590590/**
r242631r242632
602602 */
603603void pps4_device::iLAX()
604604{
605    m_A = m_X;
605   m_A = m_X;
606606}
607607
608608/**
r242631r242632
620620 */
621621void pps4_device::iLXA()
622622{
623    m_X = m_A;
623   m_X = m_A;
624624}
625625
626626/**
r242631r242632
638638 */
639639void pps4_device::iLABL()
640640{
641    m_A = m_B & 15;
641   m_A = m_B & 15;
642642}
643643
644644/**
r242631r242632
656656 */
657657void pps4_device::iLBMX()
658658{
659    m_B = (m_B & ~(15 << 4)) | (m_X << 4);
659   m_B = (m_B & ~(15 << 4)) | (m_X << 4);
660660}
661661
662662/**
r242631r242632
676676 */
677677void pps4_device::iLBUA()
678678{
679    m_B = (m_B & ~(15 << 8)) | (m_A << 8);
680    m_A = M();
679   m_B = (m_B & ~(15 << 8)) | (m_A << 8);
680   m_A = M();
681681}
682682
683683/**
r242631r242632
695695 */
696696void pps4_device::iXABL()
697697{
698    // swap A and BL
699    UINT8 bl = m_B & 15;
700    m_B = (m_B & ~15) | m_A;
701    m_A = bl;
698   // swap A and BL
699   UINT8 bl = m_B & 15;
700   m_B = (m_B & ~15) | m_A;
701   m_A = bl;
702702}
703703
704704/**
r242631r242632
716716 */
717717void pps4_device::iXBMX()
718718{
719    // swap X and BM
720    const UINT8 bm = (m_B >> 4) & 15;
721    m_B = (m_B & ~(15 << 4)) | (m_X << 4);
722    m_X = bm;
719   // swap X and BM
720   const UINT8 bm = (m_B >> 4) & 15;
721   m_B = (m_B & ~(15 << 4)) | (m_X << 4);
722   m_X = bm;
723723}
724724
725725/**
r242631r242632
737737 */
738738void pps4_device::iXAX()
739739{
740    // swap A and X
741    m_A ^= m_X;
742    m_X ^= m_A;
743    m_A ^= m_X;
740   // swap A and X
741   m_A ^= m_X;
742   m_X ^= m_A;
743   m_A ^= m_X;
744744}
745745
746746/**
r242631r242632
758758 */
759759void pps4_device::iXS()
760760{
761    // swap SA and SB
762    m_SA ^= m_SB;
763    m_SB ^= m_SA;
764    m_SA ^= m_SB;
761   // swap SA and SB
762   m_SA ^= m_SB;
763   m_SB ^= m_SA;
764   m_SA ^= m_SB;
765765}
766766
767767/**
r242631r242632
786786 */
787787void pps4_device::iCYS()
788788{
789    const UINT16 sa = (m_SA >> 4) | (m_A << 8);
790    m_A = m_SA & 15;
791    m_SA = sa;
789   const UINT16 sa = (m_SA >> 4) | (m_A << 8);
790   m_A = m_SA & 15;
791   m_SA = sa;
792792}
793793
794794/**
r242631r242632
826826 */
827827void pps4_device::iLB()
828828{
829    // previous LB or LBL instruction?
830    if (0xc0 == (m_Ip & 0xf0) || 0x00 == m_Ip) {
831        LOG(("%s: skip prev:%02x op:%02x\n", __FUNCTION__, m_Ip, m_I1));
832        return;
833    }
834    m_SB = m_SA;
835    m_SA = (m_P + 1) & 0xFFF;
836    m_P = (3 << 6) | (m_I1 & 15);
837    m_B = ~ARG() & 255;
838    m_P = m_SA;
839    // swap SA and SB
840    m_SA ^= m_SB;
841    m_SB ^= m_SA;
842    m_SA ^= m_SB;
829   // previous LB or LBL instruction?
830   if (0xc0 == (m_Ip & 0xf0) || 0x00 == m_Ip) {
831      LOG(("%s: skip prev:%02x op:%02x\n", __FUNCTION__, m_Ip, m_I1));
832      return;
833   }
834   m_SB = m_SA;
835   m_SA = (m_P + 1) & 0xFFF;
836   m_P = (3 << 6) | (m_I1 & 15);
837   m_B = ~ARG() & 255;
838   m_P = m_SA;
839   // swap SA and SB
840   m_SA ^= m_SB;
841   m_SB ^= m_SA;
842   m_SA ^= m_SB;
843843}
844844
845845/**
r242631r242632
867867 */
868868void pps4_device::iLBL()
869869{
870    m_I2 = ARG();
871    // previous LB or LBL instruction?
872    if (0xc0 == (m_Ip & 0xf0) || 0x00 == m_Ip) {
873        LOG(("%s: skip prev:%02x op:%02x\n", __FUNCTION__, m_Ip, m_I1));
874        return;
875    }
876    m_B = ~m_I2 & 255;  // Note: immediate is 1's complement
870   m_I2 = ARG();
871   // previous LB or LBL instruction?
872   if (0xc0 == (m_Ip & 0xf0) || 0x00 == m_Ip) {
873      LOG(("%s: skip prev:%02x op:%02x\n", __FUNCTION__, m_Ip, m_I1));
874      return;
875   }
876   m_B = ~m_I2 & 255;  // Note: immediate is 1's complement
877877}
878878
879879/**
r242631r242632
893893 */
894894void pps4_device::iINCB()
895895{
896    UINT8 bl = m_B & 15;
897    bl = (bl + 1) & 15;
898    if (0 == bl) {
899        LOG(("%s: skip BL=%x\n", __FUNCTION__, bl));
900        m_Skip = 1;
901    }
902    m_B = (m_B & ~15) | bl;
896   UINT8 bl = m_B & 15;
897   bl = (bl + 1) & 15;
898   if (0 == bl) {
899      LOG(("%s: skip BL=%x\n", __FUNCTION__, bl));
900      m_Skip = 1;
901   }
902   m_B = (m_B & ~15) | bl;
903903}
904904
905905/**
r242631r242632
919919 */
920920void pps4_device::iDECB()
921921{
922    UINT8 bl = m_B & 15;
923    bl = (bl - 1) & 15;
924    if (15 == bl) {
925        LOG(("%s: skip BL=%x\n", __FUNCTION__, bl));
926        m_Skip = 1;
927    }
928    m_B = (m_B & ~15) | bl;
922   UINT8 bl = m_B & 15;
923   bl = (bl - 1) & 15;
924   if (15 == bl) {
925      LOG(("%s: skip BL=%x\n", __FUNCTION__, bl));
926      m_Skip = 1;
927   }
928   m_B = (m_B & ~15) | bl;
929929}
930930
931931/**
r242631r242632
945945 */
946946void pps4_device::iT()
947947{
948    const UINT16 p = (m_P & ~63) | (m_I1 & 63);
949    LOG(("%s: P=%03x I=%02x -> P=%03x\n", __FUNCTION__, m_P, m_I1, p));
950    m_P = p;
948   const UINT16 p = (m_P & ~63) | (m_I1 & 63);
949   LOG(("%s: P=%03x I=%02x -> P=%03x\n", __FUNCTION__, m_P, m_I1, p));
950   m_P = p;
951951}
952952
953953/**
r242631r242632
977977 */
978978void pps4_device::iTM()
979979{
980    m_SB = m_SA;
981    m_SA = m_P;
982    m_P = (3 << 6) | (m_I1 & 63);
983    m_I2 = ARG();
984    m_P = (1 << 8) | m_I2;
980   m_SB = m_SA;
981   m_SA = m_P;
982   m_P = (3 << 6) | (m_I1 & 63);
983   m_I2 = ARG();
984   m_P = (1 << 8) | m_I2;
985985}
986986
987987/**
r242631r242632
10031003 */
10041004void pps4_device::iTL()
10051005{
1006    m_I2 = ARG();
1007    m_P = ((m_I1 & 15) << 8) | m_I2;
1006   m_I2 = ARG();
1007   m_P = ((m_I1 & 15) << 8) | m_I2;
10081008}
10091009
10101010/**
r242631r242632
10281028 */
10291029void pps4_device::iTML()
10301030{
1031    m_I2 = ARG();
1032    m_SB = m_SA;
1033    m_SA = m_P;
1034    m_P = ((m_I1 & 15) << 8) | m_I2;
1031   m_I2 = ARG();
1032   m_SB = m_SA;
1033   m_SA = m_P;
1034   m_P = ((m_I1 & 15) << 8) | m_I2;
10351035}
10361036
10371037/**
r242631r242632
10481048 */
10491049void pps4_device::iSKC()
10501050{
1051    m_Skip = m_C;
1051   m_Skip = m_C;
10521052}
10531053
10541054/**
r242631r242632
10651065 */
10661066void pps4_device::iSKZ()
10671067{
1068    m_Skip = (0 == m_A) ? 1 : 0;
1068   m_Skip = (0 == m_A) ? 1 : 0;
10691069}
10701070
10711071/**
r242631r242632
10841084 */
10851085void pps4_device::iSKBI()
10861086{
1087    const UINT8 i4 = m_I1 & 15;
1088    const UINT8 bl = m_B & 15;
1089    m_Skip = bl == i4 ? 1 : 0;
1087   const UINT8 i4 = m_I1 & 15;
1088   const UINT8 bl = m_B & 15;
1089   m_Skip = bl == i4 ? 1 : 0;
10901090}
10911091
10921092/**
r242631r242632
11011101 */
11021102void pps4_device::iSKF1()
11031103{
1104    m_Skip = m_FF1;
1104   m_Skip = m_FF1;
11051105}
11061106
11071107/**
r242631r242632
11161116 */
11171117void pps4_device::iSKF2()
11181118{
1119    m_Skip = m_FF2;
1119   m_Skip = m_FF2;
11201120}
11211121
11221122/**
r242631r242632
11351135 */
11361136void pps4_device::iRTN()
11371137{
1138    m_P = m_SA & 0xFFF;
1139    // swap SA and SB
1140    m_SA ^= m_SB;
1141    m_SB ^= m_SA;
1142    m_SA ^= m_SB;
1138   m_P = m_SA & 0xFFF;
1139   // swap SA and SB
1140   m_SA ^= m_SB;
1141   m_SB ^= m_SA;
1142   m_SA ^= m_SB;
11431143}
11441144
11451145/**
r242631r242632
11581158 */
11591159void pps4_device::iRTNSK()
11601160{
1161    m_P = m_SA & 0xFFF;
1162    // swap SA and SB
1163    m_SA ^= m_SB;
1164    m_SB ^= m_SA;
1165    m_SA ^= m_SB;
1166    m_Skip = 1; // next opcode is ignored
1161   m_P = m_SA & 0xFFF;
1162   // swap SA and SB
1163   m_SA ^= m_SB;
1164   m_SB ^= m_SA;
1165   m_SA ^= m_SB;
1166   m_Skip = 1; // next opcode is ignored
11671167}
11681168
11691169/**
r242631r242632
11951195 */
11961196void pps4_device::iIOL()
11971197{
1198    UINT8 ac = ((m_B & 15) << 4) | (~m_A & 15);
1199    m_I2 = ARG();
1200    m_io->write_byte(m_I2, ac);
1201    LOG(("%s: port:%02x <- %x\n", __FUNCTION__, m_I2, ac));
1202    ac = m_io->read_byte(m_I2) & 15;
1203    LOG(("%s: port:%02x -> %x\n", __FUNCTION__, m_I2, ac));
1204    m_A = ~ac & 15;
1198   UINT8 ac = ((m_B & 15) << 4) | (~m_A & 15);
1199   m_I2 = ARG();
1200   m_io->write_byte(m_I2, ac);
1201   LOG(("%s: port:%02x <- %x\n", __FUNCTION__, m_I2, ac));
1202   ac = m_io->read_byte(m_I2) & 15;
1203   LOG(("%s: port:%02x -> %x\n", __FUNCTION__, m_I2, ac));
1204   m_A = ~ac & 15;
12051205}
12061206
12071207/**
r242631r242632
12191219 */
12201220void pps4_device::iDIA()
12211221{
1222    m_A = m_io->read_byte(PPS4_PORT_A) & 15;
1222   m_A = m_io->read_byte(PPS4_PORT_A) & 15;
12231223}
12241224
12251225/**
r242631r242632
12371237 */
12381238void pps4_device::iDIB()
12391239{
1240    m_A = m_io->read_byte(PPS4_PORT_B) & 15;
1240   m_A = m_io->read_byte(PPS4_PORT_B) & 15;
12411241}
12421242
12431243/**
r242631r242632
12551255 */
12561256void pps4_device::iDOA()
12571257{
1258    m_io->write_byte(PPS4_PORT_A, m_A);
1258   m_io->write_byte(PPS4_PORT_A, m_A);
12591259}
12601260
12611261/**
r242631r242632
12771277 */
12781278void pps4_device::iSAG()
12791279{
1280    // mask bits 12:5 on next memory access
1281    m_SAG = 0xff0;
1280   // mask bits 12:5 on next memory access
1281   m_SAG = 0xff0;
12821282}
12831283
12841284/***************************************************************************
r242631r242632
12861286***************************************************************************/
12871287void pps4_device::execute_one()
12881288{
1289    m_I1 = ROP();
1290    if (m_Skip) {
1291        m_Skip = 0;
1292        LOG(("%s: skip op:%02x\n", __FUNCTION__, m_I1));
1293        return;
1294    }
1295    switch (m_I1) {
1296    case 0x00:
1297        iLBL();
1298        break;
1299    case 0x01:
1300        iTML();
1301        break;
1302    case 0x02:
1303        iTML();
1304        break;
1305    case 0x03:
1306        iTML();
1307        break;
1308    case 0x04:
1309        iLBUA();
1310        break;
1311    case 0x05:
1312        iRTN();
1313        break;
1314    case 0x06:
1315        iXS();
1316        break;
1317    case 0x07:
1318        iRTNSK();
1319        break;
1320    case 0x08:
1321        iADCSK();
1322        break;
1323    case 0x09:
1324        iADSK();
1325        break;
1326    case 0x0a:
1327        iADC();
1328        break;
1329    case 0x0b:
1330        iAD();
1331        break;
1332    case 0x0c:
1333        iEOR();
1334        break;
1335    case 0x0d:
1336        iAND();
1337        break;
1338    case 0x0e:
1339        iCOMP();
1340        break;
1341    case 0x0f:
1342        iOR();
1343        break;
1289   m_I1 = ROP();
1290   if (m_Skip) {
1291      m_Skip = 0;
1292      LOG(("%s: skip op:%02x\n", __FUNCTION__, m_I1));
1293      return;
1294   }
1295   switch (m_I1) {
1296   case 0x00:
1297      iLBL();
1298      break;
1299   case 0x01:
1300      iTML();
1301      break;
1302   case 0x02:
1303      iTML();
1304      break;
1305   case 0x03:
1306      iTML();
1307      break;
1308   case 0x04:
1309      iLBUA();
1310      break;
1311   case 0x05:
1312      iRTN();
1313      break;
1314   case 0x06:
1315      iXS();
1316      break;
1317   case 0x07:
1318      iRTNSK();
1319      break;
1320   case 0x08:
1321      iADCSK();
1322      break;
1323   case 0x09:
1324      iADSK();
1325      break;
1326   case 0x0a:
1327      iADC();
1328      break;
1329   case 0x0b:
1330      iAD();
1331      break;
1332   case 0x0c:
1333      iEOR();
1334      break;
1335   case 0x0d:
1336      iAND();
1337      break;
1338   case 0x0e:
1339      iCOMP();
1340      break;
1341   case 0x0f:
1342      iOR();
1343      break;
13441344
1345    case 0x10:
1346        iLBMX();
1347        break;
1348    case 0x11:
1349        iLABL();
1350        break;
1351    case 0x12:
1352        iLAX();
1353        break;
1354    case 0x13:
1355        iSAG();
1356        break;
1357    case 0x14:
1358        iSKF2();
1359        break;
1360    case 0x15:
1361        iSKC();
1362        break;
1363    case 0x16:
1364        iSKF1();
1365        break;
1366    case 0x17:
1367        iINCB();
1368        break;
1369    case 0x18:
1370        iXBMX();
1371        break;
1372    case 0x19:
1373        iXABL();
1374        break;
1375    case 0x1a:
1376        iXAX();
1377        break;
1378    case 0x1b:
1379        iLXA();
1380        break;
1381    case 0x1c:
1382        iIOL();
1383        break;
1384    case 0x1d:
1385        iDOA();
1386        break;
1387    case 0x1e:
1388        iSKZ();
1389        break;
1390    case 0x1f:
1391        iDECB();
1392        break;
1345   case 0x10:
1346      iLBMX();
1347      break;
1348   case 0x11:
1349      iLABL();
1350      break;
1351   case 0x12:
1352      iLAX();
1353      break;
1354   case 0x13:
1355      iSAG();
1356      break;
1357   case 0x14:
1358      iSKF2();
1359      break;
1360   case 0x15:
1361      iSKC();
1362      break;
1363   case 0x16:
1364      iSKF1();
1365      break;
1366   case 0x17:
1367      iINCB();
1368      break;
1369   case 0x18:
1370      iXBMX();
1371      break;
1372   case 0x19:
1373      iXABL();
1374      break;
1375   case 0x1a:
1376      iXAX();
1377      break;
1378   case 0x1b:
1379      iLXA();
1380      break;
1381   case 0x1c:
1382      iIOL();
1383      break;
1384   case 0x1d:
1385      iDOA();
1386      break;
1387   case 0x1e:
1388      iSKZ();
1389      break;
1390   case 0x1f:
1391      iDECB();
1392      break;
13931393
1394    case 0x20:
1395        iSC();
1396        break;
1397    case 0x21:
1398        iSF2();
1399        break;
1400    case 0x22:
1401        iSF1();
1402        break;
1403    case 0x23:
1404        iDIB();
1405        break;
1406    case 0x24:
1407        iRC();
1408        break;
1409    case 0x25:
1410        iRF2();
1411        break;
1412    case 0x26:
1413        iRF1();
1414        break;
1415    case 0x27:
1416        iDIA();
1417        break;
1394   case 0x20:
1395      iSC();
1396      break;
1397   case 0x21:
1398      iSF2();
1399      break;
1400   case 0x22:
1401      iSF1();
1402      break;
1403   case 0x23:
1404      iDIB();
1405      break;
1406   case 0x24:
1407      iRC();
1408      break;
1409   case 0x25:
1410      iRF2();
1411      break;
1412   case 0x26:
1413      iRF1();
1414      break;
1415   case 0x27:
1416      iDIA();
1417      break;
14181418
1419    case 0x28: case 0x29: case 0x2a: case 0x2b:
1420    case 0x2c: case 0x2d: case 0x2e: case 0x2f:
1421        iEXD();
1422        break;
1419   case 0x28: case 0x29: case 0x2a: case 0x2b:
1420   case 0x2c: case 0x2d: case 0x2e: case 0x2f:
1421      iEXD();
1422      break;
14231423
1424    case 0x30: case 0x31: case 0x32: case 0x33:
1425    case 0x34: case 0x35: case 0x36: case 0x37:
1426        iLD();
1427        break;
1424   case 0x30: case 0x31: case 0x32: case 0x33:
1425   case 0x34: case 0x35: case 0x36: case 0x37:
1426      iLD();
1427      break;
14281428
1429    case 0x38: case 0x39: case 0x3a: case 0x3b:
1430    case 0x3c: case 0x3d: case 0x3e: case 0x3f:
1431        iEX();
1432        break;
1429   case 0x38: case 0x39: case 0x3a: case 0x3b:
1430   case 0x3c: case 0x3d: case 0x3e: case 0x3f:
1431      iEX();
1432      break;
14331433
1434    case 0x40: case 0x41: case 0x42: case 0x43:
1435    case 0x44: case 0x45: case 0x46: case 0x47:
1436    case 0x48: case 0x49: case 0x4a: case 0x4b:
1437    case 0x4c: case 0x4d: case 0x4e: case 0x4f:
1438        iSKBI();
1439        break;
1434   case 0x40: case 0x41: case 0x42: case 0x43:
1435   case 0x44: case 0x45: case 0x46: case 0x47:
1436   case 0x48: case 0x49: case 0x4a: case 0x4b:
1437   case 0x4c: case 0x4d: case 0x4e: case 0x4f:
1438      iSKBI();
1439      break;
14401440
1441    case 0x50: case 0x51: case 0x52: case 0x53:
1442    case 0x54: case 0x55: case 0x56: case 0x57:
1443    case 0x58: case 0x59: case 0x5a: case 0x5b:
1444    case 0x5c: case 0x5d: case 0x5e: case 0x5f:
1445        iTL();
1446        break;
1441   case 0x50: case 0x51: case 0x52: case 0x53:
1442   case 0x54: case 0x55: case 0x56: case 0x57:
1443   case 0x58: case 0x59: case 0x5a: case 0x5b:
1444   case 0x5c: case 0x5d: case 0x5e: case 0x5f:
1445      iTL();
1446      break;
14471447
1448    case 0x65:
1449        iDC();
1450        break;
1448   case 0x65:
1449      iDC();
1450      break;
14511451
1452    case 0x60: case 0x61: case 0x62: case 0x63:
1453    case 0x64:            case 0x66: case 0x67:
1454    case 0x68: case 0x69: case 0x6a: case 0x6b:
1455    case 0x6c: case 0x6d: case 0x6e:
1456        iADI();
1457        break;
1452   case 0x60: case 0x61: case 0x62: case 0x63:
1453   case 0x64:            case 0x66: case 0x67:
1454   case 0x68: case 0x69: case 0x6a: case 0x6b:
1455   case 0x6c: case 0x6d: case 0x6e:
1456      iADI();
1457      break;
14581458
1459    case 0x6f:
1460        iCYS();
1461        break;
1459   case 0x6f:
1460      iCYS();
1461      break;
14621462
1463    case 0x70: case 0x71: case 0x72: case 0x73:
1464    case 0x74: case 0x75: case 0x76: case 0x77:
1465    case 0x78: case 0x79: case 0x7a: case 0x7b:
1466    case 0x7c: case 0x7d: case 0x7e: case 0x7f:
1467        iLDI();
1468        break;
1463   case 0x70: case 0x71: case 0x72: case 0x73:
1464   case 0x74: case 0x75: case 0x76: case 0x77:
1465   case 0x78: case 0x79: case 0x7a: case 0x7b:
1466   case 0x7c: case 0x7d: case 0x7e: case 0x7f:
1467      iLDI();
1468      break;
14691469
1470    case 0x80: case 0x81: case 0x82: case 0x83:
1471    case 0x84: case 0x85: case 0x86: case 0x87:
1472    case 0x88: case 0x89: case 0x8a: case 0x8b:
1473    case 0x8c: case 0x8d: case 0x8e: case 0x8f:
1474    case 0x90: case 0x91: case 0x92: case 0x93:
1475    case 0x94: case 0x95: case 0x96: case 0x97:
1476    case 0x98: case 0x99: case 0x9a: case 0x9b:
1477    case 0x9c: case 0x9d: case 0x9e: case 0x9f:
1478    case 0xa0: case 0xa1: case 0xa2: case 0xa3:
1479    case 0xa4: case 0xa5: case 0xa6: case 0xa7:
1480    case 0xa8: case 0xa9: case 0xaa: case 0xab:
1481    case 0xac: case 0xad: case 0xae: case 0xaf:
1482    case 0xb0: case 0xb1: case 0xb2: case 0xb3:
1483    case 0xb4: case 0xb5: case 0xb6: case 0xb7:
1484    case 0xb8: case 0xb9: case 0xba: case 0xbb:
1485    case 0xbc: case 0xbd: case 0xbe: case 0xbf:
1486        iT();
1487        break;
1470   case 0x80: case 0x81: case 0x82: case 0x83:
1471   case 0x84: case 0x85: case 0x86: case 0x87:
1472   case 0x88: case 0x89: case 0x8a: case 0x8b:
1473   case 0x8c: case 0x8d: case 0x8e: case 0x8f:
1474   case 0x90: case 0x91: case 0x92: case 0x93:
1475   case 0x94: case 0x95: case 0x96: case 0x97:
1476   case 0x98: case 0x99: case 0x9a: case 0x9b:
1477   case 0x9c: case 0x9d: case 0x9e: case 0x9f:
1478   case 0xa0: case 0xa1: case 0xa2: case 0xa3:
1479   case 0xa4: case 0xa5: case 0xa6: case 0xa7:
1480   case 0xa8: case 0xa9: case 0xaa: case 0xab:
1481   case 0xac: case 0xad: case 0xae: case 0xaf:
1482   case 0xb0: case 0xb1: case 0xb2: case 0xb3:
1483   case 0xb4: case 0xb5: case 0xb6: case 0xb7:
1484   case 0xb8: case 0xb9: case 0xba: case 0xbb:
1485   case 0xbc: case 0xbd: case 0xbe: case 0xbf:
1486      iT();
1487      break;
14881488
14891489
1490    case 0xc0: case 0xc1: case 0xc2: case 0xc3:
1491    case 0xc4: case 0xc5: case 0xc6: case 0xc7:
1492    case 0xc8: case 0xc9: case 0xca: case 0xcb:
1493    case 0xcc: case 0xcd: case 0xce: case 0xcf:
1494        iLB();
1495        break;
1490   case 0xc0: case 0xc1: case 0xc2: case 0xc3:
1491   case 0xc4: case 0xc5: case 0xc6: case 0xc7:
1492   case 0xc8: case 0xc9: case 0xca: case 0xcb:
1493   case 0xcc: case 0xcd: case 0xce: case 0xcf:
1494      iLB();
1495      break;
14961496
1497    default:
1498        iTM();
1499    }
1497   default:
1498      iTM();
1499   }
15001500}
15011501
15021502void pps4_device::execute_run()
15031503{
1504    do
1505    {
1506        debugger_instruction_hook(this, m_P);
1507        execute_one();
1504   do
1505   {
1506      debugger_instruction_hook(this, m_P);
1507      execute_one();
15081508
1509    } while (m_icount > 0);
1509   } while (m_icount > 0);
15101510}
15111511
15121512/***************************************************************************
r242631r242632
15151515
15161516void pps4_device::device_start()
15171517{
1518    m_program = &space(AS_PROGRAM);
1519    m_direct = &m_program->direct();
1520    m_data = &space(AS_DATA);
1521    m_io = &space(AS_IO);
1518   m_program = &space(AS_PROGRAM);
1519   m_direct = &m_program->direct();
1520   m_data = &space(AS_DATA);
1521   m_io = &space(AS_IO);
15221522
1523    save_item(NAME(m_A));
1524    save_item(NAME(m_X));
1525    save_item(NAME(m_P));
1526    save_item(NAME(m_SA));
1527    save_item(NAME(m_SB));
1528    save_item(NAME(m_Skip));
1529    save_item(NAME(m_SAG));
1530    save_item(NAME(m_B));
1531    save_item(NAME(m_C));
1532    save_item(NAME(m_FF1));
1533    save_item(NAME(m_FF2));
1534    save_item(NAME(m_I1));
1535    save_item(NAME(m_I2));
1536    save_item(NAME(m_Ip));
1523   save_item(NAME(m_A));
1524   save_item(NAME(m_X));
1525   save_item(NAME(m_P));
1526   save_item(NAME(m_SA));
1527   save_item(NAME(m_SB));
1528   save_item(NAME(m_Skip));
1529   save_item(NAME(m_SAG));
1530   save_item(NAME(m_B));
1531   save_item(NAME(m_C));
1532   save_item(NAME(m_FF1));
1533   save_item(NAME(m_FF2));
1534   save_item(NAME(m_I1));
1535   save_item(NAME(m_I2));
1536   save_item(NAME(m_Ip));
15371537
1538    state_add( PPS4_PC, "PC", m_P ).mask(0xFFF).formatstr("%03X");
1539    state_add( PPS4_A, "A",  m_A ).formatstr("%01X");
1540    state_add( PPS4_X, "X",  m_X ).formatstr("%01X");
1541    state_add( PPS4_SA, "SA", m_SA ).formatstr("%03X");
1542    state_add( PPS4_SB, "SB", m_SB ).formatstr("%03X");
1543    state_add( PPS4_Skip, "Skip",  m_Skip ).formatstr("%01X");
1544    state_add( PPS4_SAG, "SAG",  m_SAG ).formatstr("%03X");
1545    state_add( PPS4_B, "B",  m_B ).formatstr("%03X");
1546    state_add( PPS4_I1, "I1",  m_I1 ).formatstr("%02X").noshow();
1547    state_add( PPS4_I2, "I2",  m_I2 ).formatstr("%02X").noshow();
1548    state_add( PPS4_Ip, "Ip",  m_Ip ).formatstr("%02X").noshow();
1549    state_add( STATE_GENPC,    "GENPC", m_P ).noshow();
1550    state_add( STATE_GENFLAGS, "GENFLAGS", m_C).formatstr("%3s").noshow();
1538   state_add( PPS4_PC, "PC", m_P ).mask(0xFFF).formatstr("%03X");
1539   state_add( PPS4_A, "A",  m_A ).formatstr("%01X");
1540   state_add( PPS4_X, "X",  m_X ).formatstr("%01X");
1541   state_add( PPS4_SA, "SA", m_SA ).formatstr("%03X");
1542   state_add( PPS4_SB, "SB", m_SB ).formatstr("%03X");
1543   state_add( PPS4_Skip, "Skip",  m_Skip ).formatstr("%01X");
1544   state_add( PPS4_SAG, "SAG",  m_SAG ).formatstr("%03X");
1545   state_add( PPS4_B, "B",  m_B ).formatstr("%03X");
1546   state_add( PPS4_I1, "I1",  m_I1 ).formatstr("%02X").noshow();
1547   state_add( PPS4_I2, "I2",  m_I2 ).formatstr("%02X").noshow();
1548   state_add( PPS4_Ip, "Ip",  m_Ip ).formatstr("%02X").noshow();
1549   state_add( STATE_GENPC,    "GENPC", m_P ).noshow();
1550   state_add( STATE_GENFLAGS, "GENFLAGS", m_C).formatstr("%3s").noshow();
15511551
1552    m_icountptr = &m_icount;
1552   m_icountptr = &m_icount;
15531553}
15541554
15551555void pps4_device::state_string_export(const device_state_entry &entry, astring &string)
15561556{
1557    switch (entry.index())
1558    {
1559        case STATE_GENFLAGS:
1560            string.printf("%c%c%c",
1561                m_C ? 'C':'.',
1562                m_FF1 ? '1':'.',
1563                m_FF2 ? '2':'.');
1564            break;
1565    }
1557   switch (entry.index())
1558   {
1559      case STATE_GENFLAGS:
1560         string.printf("%c%c%c",
1561            m_C ? 'C':'.',
1562            m_FF1 ? '1':'.',
1563            m_FF2 ? '2':'.');
1564         break;
1565   }
15661566}
15671567
15681568/***************************************************************************
r242631r242632
15711571
15721572void pps4_device::device_reset()
15731573{
1574    m_A = 0;        // Accumulator A(4:1)
1575    m_X = 0;        // X register X(4:1)
1576    m_P = 0;        // program counter P(12:1)
1577    m_SA = 0;       // Shift register SA(12:1)
1578    m_SB = 0;       // Shift register SB(12:1)
1579    m_SAG = 0;      // Special address generation mask
1580    m_B = 0;        // B address register B(12:1) (BL, BM and BU)
1581    m_C = 0;        // Carry flip-flop
1582    m_FF1 = 0;      // Flip-flop 1
1583    m_FF2 = 0;      // Flip-flop 2
1584    m_I1 = 0;        // Most recent instruction I(8:1)
1585    m_I2 = 0;       // Most recent parameter I2(8:1)
1586    m_Ip = 0;       // Previous instruction I(8:1)
1574   m_A = 0;        // Accumulator A(4:1)
1575   m_X = 0;        // X register X(4:1)
1576   m_P = 0;        // program counter P(12:1)
1577   m_SA = 0;       // Shift register SA(12:1)
1578   m_SB = 0;       // Shift register SB(12:1)
1579   m_SAG = 0;      // Special address generation mask
1580   m_B = 0;        // B address register B(12:1) (BL, BM and BU)
1581   m_C = 0;        // Carry flip-flop
1582   m_FF1 = 0;      // Flip-flop 1
1583   m_FF2 = 0;      // Flip-flop 2
1584   m_I1 = 0;        // Most recent instruction I(8:1)
1585   m_I2 = 0;       // Most recent parameter I2(8:1)
1586   m_Ip = 0;       // Previous instruction I(8:1)
15871587}
trunk/src/emu/cpu/pps4/pps4.h
r242631r242632
99***************************************************************************/
1010enum
1111{
12    PPS4_PC,
13    PPS4_A,
14    PPS4_X,
15    PPS4_SA,
16    PPS4_SB,
17    PPS4_B,
18    PPS4_Skip,
19    PPS4_SAG,
20    PPS4_I1,
21    PPS4_I2,
22    PPS4_Ip,
23    PPS4_GENPC = STATE_GENPC,
24    PPS4_GENSP = STATE_GENSP,
25    PPS4_GENPCBASE = STATE_GENPCBASE,
26    PPS4_PORT_A = 256,
27    PPS4_PORT_B = 257
12   PPS4_PC,
13   PPS4_A,
14   PPS4_X,
15   PPS4_SA,
16   PPS4_SB,
17   PPS4_B,
18   PPS4_Skip,
19   PPS4_SAG,
20   PPS4_I1,
21   PPS4_I2,
22   PPS4_Ip,
23   PPS4_GENPC = STATE_GENPC,
24   PPS4_GENSP = STATE_GENSP,
25   PPS4_GENPCBASE = STATE_GENPCBASE,
26   PPS4_PORT_A = 256,
27   PPS4_PORT_B = 257
2828};
2929
3030/***************************************************************************
r242631r242632
4040class pps4_device : public cpu_device
4141{
4242public:
43    // construction/destruction
44    pps4_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
43   // construction/destruction
44   pps4_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
4545
4646protected:
47    // device-level overrides
48    virtual void device_start();
49    virtual void device_reset();
47   // device-level overrides
48   virtual void device_start();
49   virtual void device_reset();
5050
51    // device_execute_interface overrides
52    virtual UINT32 execute_min_cycles() const { return 1; }
53    virtual UINT32 execute_max_cycles() const { return 3; }
54    virtual UINT32 execute_input_lines() const { return 0; }
55    virtual UINT32 execute_default_irq_vector() const { return 0; }
56    virtual void execute_run();
51   // device_execute_interface overrides
52   virtual UINT32 execute_min_cycles() const { return 1; }
53   virtual UINT32 execute_max_cycles() const { return 3; }
54   virtual UINT32 execute_input_lines() const { return 0; }
55   virtual UINT32 execute_default_irq_vector() const { return 0; }
56   virtual void execute_run();
5757
58    // device_memory_interface overrides
59    virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const
60    {
61        return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_IO) ? &m_io_config : ( (spacenum == AS_DATA) ? &m_data_config : NULL ) );
62    }
58   // device_memory_interface overrides
59   virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const
60   {
61      return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_IO) ? &m_io_config : ( (spacenum == AS_DATA) ? &m_data_config : NULL ) );
62   }
6363
64    // device_state_interface overrides
65    void state_string_export(const device_state_entry &entry, astring &string);
64   // device_state_interface overrides
65   void state_string_export(const device_state_entry &entry, astring &string);
6666
67    // device_disasm_interface overrides
68    virtual UINT32 disasm_min_opcode_bytes() const { return 1; }
69    virtual UINT32 disasm_max_opcode_bytes() const { return 2; }
70    virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options);
67   // device_disasm_interface overrides
68   virtual UINT32 disasm_min_opcode_bytes() const { return 1; }
69   virtual UINT32 disasm_max_opcode_bytes() const { return 2; }
70   virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options);
7171
7272private:
73    address_space_config m_program_config;
74    address_space_config m_data_config;
75    address_space_config m_io_config;
73   address_space_config m_program_config;
74   address_space_config m_data_config;
75   address_space_config m_io_config;
7676
77    address_space *m_program;
78    direct_read_data *m_direct;
79    address_space *m_data;
80    address_space *m_io;
81    int     m_icount;
77   address_space *m_program;
78   direct_read_data *m_direct;
79   address_space *m_data;
80   address_space *m_io;
81   int     m_icount;
8282
83    UINT8   m_A;        //!< Accumulator A(4:1)
84    UINT8   m_X;        //!< X register X(4:1)
85    UINT16  m_P;        //!< program counter P(12:1)
86    UINT16  m_SA;       //!< Shift register SA(12:1)
87    UINT16  m_SB;       //!< Shift register SB(12:1)
88    UINT8   m_Skip;     //!< Skip next instruction
89    UINT16  m_SAG;      //!< Special address generation mask
90    UINT16  m_B;        //!< B register B(12:1) (BL, BM and BH)
91    UINT8   m_C;        //!< Carry flip-flop
92    UINT8   m_FF1;      //!< Flip-flop 1
93    UINT8   m_FF2;      //!< Flip-flop 2
94    UINT8   m_I1;        //!< Most recent instruction I(8:1)
95    UINT8   m_I2;       //!< Most recent parameter I2(8:1)
96    UINT8   m_Ip;       //!< Previous instruction I(8:1)
83   UINT8   m_A;        //!< Accumulator A(4:1)
84   UINT8   m_X;        //!< X register X(4:1)
85   UINT16  m_P;        //!< program counter P(12:1)
86   UINT16  m_SA;       //!< Shift register SA(12:1)
87   UINT16  m_SB;       //!< Shift register SB(12:1)
88   UINT8   m_Skip;     //!< Skip next instruction
89   UINT16  m_SAG;      //!< Special address generation mask
90   UINT16  m_B;        //!< B register B(12:1) (BL, BM and BH)
91   UINT8   m_C;        //!< Carry flip-flop
92   UINT8   m_FF1;      //!< Flip-flop 1
93   UINT8   m_FF2;      //!< Flip-flop 2
94   UINT8   m_I1;        //!< Most recent instruction I(8:1)
95   UINT8   m_I2;       //!< Most recent parameter I2(8:1)
96   UINT8   m_Ip;       //!< Previous instruction I(8:1)
9797
98    //! return the contents of B register (made of BU, BM and BL)
99    inline UINT16 B() const;
98   //! return the contents of B register (made of BU, BM and BL)
99   inline UINT16 B() const;
100100
101    //! return memory at address B(12:1)
102    inline UINT8 M();
101   //! return memory at address B(12:1)
102   inline UINT8 M();
103103
104    //! write to memory at address B(12:1)
105    inline void W(UINT8 data);
104   //! write to memory at address B(12:1)
105   inline void W(UINT8 data);
106106
107    //! return the next opcode (also in m_I)
108    inline UINT8 ROP();
107   //! return the next opcode (also in m_I)
108   inline UINT8 ROP();
109109
110    //! return the next argument (also in m_I2)
111    inline UINT8 ARG();
110   //! return the next argument (also in m_I2)
111   inline UINT8 ARG();
112112
113    void iAD();          //!< Add
114    void iADC();         //!< Add with carry-in
115    void iADSK();        //!< Add and skip on carry-out
116    void iADCSK();       //!< Add with carry-in and skip on carry-out
117    void iADI();         //!< Add immediate
118    void iDC();          //!< Decimal correction
119    void iAND();         //!< Logical AND
120    void iOR();          //!< Logical OR
121    void iEOR();         //!< Logical Exclusive-OR
122    void iCOMP();        //!< Complement
123    void iSC();          //!< Set Carry flip-flop
124    void iRC();          //!< Reset Carry flip-flop
125    void iSF1();         //!< Set FF1
126    void iRF1();         //!< Reset FF1
127    void iSF2();         //!< Set FF2
128    void iRF2();         //!< Reset FF2
129    void iLD();          //!< Load accumulator from memory
130    void iEX();          //!< Exchange accumulator and memory
131    void iEXD();         //!< Exchange accumulator and memory and decrement BL
132    void iLDI();         //!< Load accumulator immediate
133    void iLAX();         //!< Load accumulator from X register
134    void iLXA();         //!< Load X register from accumulator
135    void iLABL();        //!< Load accumulator with BL
136    void iLBMX();        //!< Load BM with X
137    void iLBUA();        //!< Load BU with A
138    void iXABL();        //!< Exchange accumulator and BL
139    void iXBMX();        //!< Exchange BM and X registers
140    void iXAX();         //!< Exchange accumulator and X
141    void iXS();          //!< Eychange SA and SB registers
142    void iCYS();         //!< Cycle SA register and accumulaor
143    void iLB();          //!< Load B indirect
144    void iLBL();         //!< Load B long
145    void iINCB();        //!< Increment BL
146    void iDECB();        //!< Decrement BL
147    void iT();           //!< Transfer
148    void iTM();          //!< Transfer and mark indirect
149    void iTL();          //!< Transfer long
150    void iTML();         //!< Transfer and mark long
151    void iSKC();         //!< Skip on carry flip-flop
152    void iSKZ();         //!< Skip on accumulator zero
153    void iSKBI();        //!< Skip if BL equal to immediate
154    void iSKF1();        //!< Skip if FF1 equals 1
155    void iSKF2();        //!< Skip if FF2 equals 1
156    void iRTN();         //!< Return
157    void iRTNSK();       //!< Return and skip
158    void iIOL();         //!< Input/Output long
159    void iDIA();         //!< Discrete input group A
160    void iDIB();         //!< Discrete input group B
161    void iDOA();         //!< Discrete output group A
162    void iSAG();         //!< Special address generation
113   void iAD();          //!< Add
114   void iADC();         //!< Add with carry-in
115   void iADSK();        //!< Add and skip on carry-out
116   void iADCSK();       //!< Add with carry-in and skip on carry-out
117   void iADI();         //!< Add immediate
118   void iDC();          //!< Decimal correction
119   void iAND();         //!< Logical AND
120   void iOR();          //!< Logical OR
121   void iEOR();         //!< Logical Exclusive-OR
122   void iCOMP();        //!< Complement
123   void iSC();          //!< Set Carry flip-flop
124   void iRC();          //!< Reset Carry flip-flop
125   void iSF1();         //!< Set FF1
126   void iRF1();         //!< Reset FF1
127   void iSF2();         //!< Set FF2
128   void iRF2();         //!< Reset FF2
129   void iLD();          //!< Load accumulator from memory
130   void iEX();          //!< Exchange accumulator and memory
131   void iEXD();         //!< Exchange accumulator and memory and decrement BL
132   void iLDI();         //!< Load accumulator immediate
133   void iLAX();         //!< Load accumulator from X register
134   void iLXA();         //!< Load X register from accumulator
135   void iLABL();        //!< Load accumulator with BL
136   void iLBMX();        //!< Load BM with X
137   void iLBUA();        //!< Load BU with A
138   void iXABL();        //!< Exchange accumulator and BL
139   void iXBMX();        //!< Exchange BM and X registers
140   void iXAX();         //!< Exchange accumulator and X
141   void iXS();          //!< Eychange SA and SB registers
142   void iCYS();         //!< Cycle SA register and accumulaor
143   void iLB();          //!< Load B indirect
144   void iLBL();         //!< Load B long
145   void iINCB();        //!< Increment BL
146   void iDECB();        //!< Decrement BL
147   void iT();           //!< Transfer
148   void iTM();          //!< Transfer and mark indirect
149   void iTL();          //!< Transfer long
150   void iTML();         //!< Transfer and mark long
151   void iSKC();         //!< Skip on carry flip-flop
152   void iSKZ();         //!< Skip on accumulator zero
153   void iSKBI();        //!< Skip if BL equal to immediate
154   void iSKF1();        //!< Skip if FF1 equals 1
155   void iSKF2();        //!< Skip if FF2 equals 1
156   void iRTN();         //!< Return
157   void iRTNSK();       //!< Return and skip
158   void iIOL();         //!< Input/Output long
159   void iDIA();         //!< Discrete input group A
160   void iDIB();         //!< Discrete input group B
161   void iDOA();         //!< Discrete output group A
162   void iSAG();         //!< Special address generation
163163
164    void execute_one(); //!< execute one instruction
164   void execute_one(); //!< execute one instruction
165165};
166166
167167#endif  // __PPS4_H__
trunk/src/emu/cpu/pps4/pps4dasm.c
r242631r242632
1616#define ARG(A)  opram[(A) - PC]
1717
1818typedef enum pps4_token_e {
19    t_AD,       t_ADC,      t_ADSK,     t_ADCSK,    t_ADI,
20    t_DC,       t_AND,      t_OR,       t_EOR,      t_COMP,
21    t_SC,       t_RC,       t_SF1,      t_RF1,      t_SF2,
22    t_RF2,      t_LD,       t_EX,       t_EXD,      t_LDI,
23    t_LAX,      t_LXA,      t_LABL,     t_LBMX,     t_LBUA,
24    t_XABL,     t_XBMX,     t_XAX,      t_XS,       t_CYS,
25    t_LB,       t_LBL,      t_INCB,     t_DECB,     t_T,
26    t_TM,       t_TL,       t_TML,      t_SKC,      t_SKZ,
27    t_SKBI,     t_SKF1,     t_SKF2,     t_RTN,      t_RTNSK,
28    t_IOL,      t_DIA,      t_DIB,      t_DOA,      t_SAG,
29    t_COUNT,
30    t_MASK = (1 << 6) - 1,
31    t_I3c  = 1 <<  6,   /* immediate 3 bit constant, complemented */
32    t_I4   = 1 <<  7,   /* immediate 4 bit constant */
33    t_I4c  = 1 <<  8,   /* immediate 4 bit constant, complemented */
34    t_I4p  = 1 <<  9,   /* immediate 4 bit offset into page 3 */
35    t_I6p  = 1 << 10,   /* immediate 6 bit constant; address in current page */
36    t_I6i  = 1 << 11,   /* immediate 6 bit indirect page 3 offset (16 ... 63) + followed by page 1 address */
37    t_I8   = 1 << 12,   /* immediate 8 bit constant (I/O port number) */
38    t_I8c  = 1 << 13,   /* immediate 8 bit constant inverted */
39    t_OVER = 1 << 14,   /* Debugger step over (CALL) */
40    t_OUT  = 1 << 15    /* Debugger step out (RETURN) */
19   t_AD,       t_ADC,      t_ADSK,     t_ADCSK,    t_ADI,
20   t_DC,       t_AND,      t_OR,       t_EOR,      t_COMP,
21   t_SC,       t_RC,       t_SF1,      t_RF1,      t_SF2,
22   t_RF2,      t_LD,       t_EX,       t_EXD,      t_LDI,
23   t_LAX,      t_LXA,      t_LABL,     t_LBMX,     t_LBUA,
24   t_XABL,     t_XBMX,     t_XAX,      t_XS,       t_CYS,
25   t_LB,       t_LBL,      t_INCB,     t_DECB,     t_T,
26   t_TM,       t_TL,       t_TML,      t_SKC,      t_SKZ,
27   t_SKBI,     t_SKF1,     t_SKF2,     t_RTN,      t_RTNSK,
28   t_IOL,      t_DIA,      t_DIB,      t_DOA,      t_SAG,
29   t_COUNT,
30   t_MASK = (1 << 6) - 1,
31   t_I3c  = 1 <<  6,   /* immediate 3 bit constant, complemented */
32   t_I4   = 1 <<  7,   /* immediate 4 bit constant */
33   t_I4c  = 1 <<  8,   /* immediate 4 bit constant, complemented */
34   t_I4p  = 1 <<  9,   /* immediate 4 bit offset into page 3 */
35   t_I6p  = 1 << 10,   /* immediate 6 bit constant; address in current page */
36   t_I6i  = 1 << 11,   /* immediate 6 bit indirect page 3 offset (16 ... 63) + followed by page 1 address */
37   t_I8   = 1 << 12,   /* immediate 8 bit constant (I/O port number) */
38   t_I8c  = 1 << 13,   /* immediate 8 bit constant inverted */
39   t_OVER = 1 << 14,   /* Debugger step over (CALL) */
40   t_OUT  = 1 << 15    /* Debugger step out (RETURN) */
4141}   pps4_token_e;
4242
4343static const char *token_str[t_COUNT] = {
44    "ad",           /* add */
45    "adc",          /* add with carry-in */
46    "adsk",         /* add and skip on carry-out */
47    "adcsk",        /* add with carry-in and skip on carry-out */
48    "adi",          /* add immediate */
49    "dc",           /* decimal correction */
50    "and",          /* logical and */
51    "or",           /* logical or */
52    "eor",          /* logical exclusive-orf */
53    "comp",         /* complement */
54    "sc",           /* set C flip-flop */
55    "rc",           /* reset C flip-flop */
56    "sf1",          /* set FF1 flip-flop */
57    "rf1",          /* reset FF1 flip-flop */
58    "sf2",          /* set FF2 flip-flop */
59    "rf2",          /* reset FF2 flip-flop */
60    "ld",           /* load accumulator from memory */
61    "ex",           /* exchange accumulator and memory */
62    "exd",          /* exchange accumulator and memory and decrement BL */
63    "ldi",          /* load accumulator immediate */
64    "lax",          /* load accumulator from X register */
65    "lxa",          /* load X register from accumulator */
66    "labl",         /* load accumulator with BL */
67    "lbmx",         /* load BM with X */
68    "lbua",         /* load BU with A */
69    "xabl",         /* exchange accumulator and BL */
70    "xbmx",         /* exchange BM and X */
71    "xax",          /* exchange accumulator and X */
72    "xs",           /* exchange SA and SB */
73    "cys",          /* cycle SA register and accumulator */
74    "lb",           /* load B indirect */
75    "lbl",          /* load B long */
76    "incb",         /* increment BL */
77    "decb",         /* decrement BL */
78    "t",            /* transfer */
79    "tm",           /* transfer and mark indirect */
80    "tl",           /* transfer long */
81    "tml",          /* transfer and mark long */
82    "skc",          /* skip on C flip-flop equals 1 */
83    "skz",          /* skip on accumulator zero */
84    "skbi",         /* skip on BL equal to immediate */
85    "skf1",         /* skip on FF1 flip-flop equals 1 */
86    "skf2",         /* skip on FF2 flip-flop equals 1 */
87    "rtn",          /* return */
88    "rtnsk",        /* return and skip */
89    "iol",          /* input/output long */
90    "dia",          /* discrete input group A */
91    "dib",          /* discrete input group B */
92    "doa",          /* discrete output */
93    "sag"           /* special address generation */
44   "ad",           /* add */
45   "adc",          /* add with carry-in */
46   "adsk",         /* add and skip on carry-out */
47   "adcsk",        /* add with carry-in and skip on carry-out */
48   "adi",          /* add immediate */
49   "dc",           /* decimal correction */
50   "and",          /* logical and */
51   "or",           /* logical or */
52   "eor",          /* logical exclusive-orf */
53   "comp",         /* complement */
54   "sc",           /* set C flip-flop */
55   "rc",           /* reset C flip-flop */
56   "sf1",          /* set FF1 flip-flop */
57   "rf1",          /* reset FF1 flip-flop */
58   "sf2",          /* set FF2 flip-flop */
59   "rf2",          /* reset FF2 flip-flop */
60   "ld",           /* load accumulator from memory */
61   "ex",           /* exchange accumulator and memory */
62   "exd",          /* exchange accumulator and memory and decrement BL */
63   "ldi",          /* load accumulator immediate */
64   "lax",          /* load accumulator from X register */
65   "lxa",          /* load X register from accumulator */
66   "labl",         /* load accumulator with BL */
67   "lbmx",         /* load BM with X */
68   "lbua",         /* load BU with A */
69   "xabl",         /* exchange accumulator and BL */
70   "xbmx",         /* exchange BM and X */
71   "xax",          /* exchange accumulator and X */
72   "xs",           /* exchange SA and SB */
73   "cys",          /* cycle SA register and accumulator */
74   "lb",           /* load B indirect */
75   "lbl",          /* load B long */
76   "incb",         /* increment BL */
77   "decb",         /* decrement BL */
78   "t",            /* transfer */
79   "tm",           /* transfer and mark indirect */
80   "tl",           /* transfer long */
81   "tml",          /* transfer and mark long */
82   "skc",          /* skip on C flip-flop equals 1 */
83   "skz",          /* skip on accumulator zero */
84   "skbi",         /* skip on BL equal to immediate */
85   "skf1",         /* skip on FF1 flip-flop equals 1 */
86   "skf2",         /* skip on FF2 flip-flop equals 1 */
87   "rtn",          /* return */
88   "rtnsk",        /* return and skip */
89   "iol",          /* input/output long */
90   "dia",          /* discrete input group A */
91   "dib",          /* discrete input group B */
92   "doa",          /* discrete output */
93   "sag"           /* special address generation */
9494};
9595
9696static const UINT16 table[] = {
r242631r242632
369369
370370CPU_DISASSEMBLE( pps4 )
371371{
372    UINT32 flags = 0;
373    unsigned PC = pc;
374    UINT8 op = OP(pc++);
375    UINT32 tok = table[op];
376    char *dst = 0;
372   UINT32 flags = 0;
373   unsigned PC = pc;
374   UINT8 op = OP(pc++);
375   UINT32 tok = table[op];
376   char *dst = 0;
377377
378    if (0 == (tok & t_MASK)) {
379        sprintf(buffer, "%s", token_str[tok & t_MASK]);
380    } else {
381        dst = buffer + sprintf(buffer, "%-7s", token_str[tok & t_MASK]);
382    }
378   if (0 == (tok & t_MASK)) {
379      sprintf(buffer, "%s", token_str[tok & t_MASK]);
380   } else {
381      dst = buffer + sprintf(buffer, "%-7s", token_str[tok & t_MASK]);
382   }
383383
384    if (tok & t_I3c) {
385        // 3 bit immediate, complemented
386        UINT8 i = ~op & 7;
387        if (0 != i)  // only print if non-zero
388            dst += sprintf(dst, "%x", i);
389    }
384   if (tok & t_I3c) {
385      // 3 bit immediate, complemented
386      UINT8 i = ~op & 7;
387      if (0 != i)  // only print if non-zero
388         dst += sprintf(dst, "%x", i);
389   }
390390
391    if (tok & t_I4) {
392        // 4 bit immediate
393        UINT8 i = op & 15;
394        dst += sprintf(dst, "%x", i);
395    }
391   if (tok & t_I4) {
392      // 4 bit immediate
393      UINT8 i = op & 15;
394      dst += sprintf(dst, "%x", i);
395   }
396396
397    if (tok & t_I4c) {
398        // 4 bit immediate, complemented
399        UINT8 i = ~op & 15;
400        dst += sprintf(dst, "%x", i);
401    }
397   if (tok & t_I4c) {
398      // 4 bit immediate, complemented
399      UINT8 i = ~op & 15;
400      dst += sprintf(dst, "%x", i);
401   }
402402
403    if (tok & t_I4p) {
404        // 4 bit immediate offset into page 3
405        UINT8 i = op & 15;
406        dst += sprintf(dst, "[%x]", 0x0c0 | i);
407    }
403   if (tok & t_I4p) {
404      // 4 bit immediate offset into page 3
405      UINT8 i = op & 15;
406      dst += sprintf(dst, "[%x]", 0x0c0 | i);
407   }
408408
409    if (tok & t_I6p) {
410        // 6 bit immediate offset into current page
411        UINT8 i = op & 63;
412        dst += sprintf(dst, "%x", (PC & ~63) | i);
413    }
409   if (tok & t_I6p) {
410      // 6 bit immediate offset into current page
411      UINT8 i = op & 63;
412      dst += sprintf(dst, "%x", (PC & ~63) | i);
413   }
414414
415    if (tok & t_I6i) {
416        // 6 bit immediate offset into page 3
417        UINT16 i6p3 = (3 << 6) | (op & 63);
418        // 8 bit absolute offset at 0x0100
419        UINT16 addr = (1 << 8) | 0;     // ROM[ip3] can't be reached!?
420        (void)addr; // avoid unused variable warning
421        dst += sprintf(dst, "[%x]", i6p3);
422    }
415   if (tok & t_I6i) {
416      // 6 bit immediate offset into page 3
417      UINT16 i6p3 = (3 << 6) | (op & 63);
418      // 8 bit absolute offset at 0x0100
419      UINT16 addr = (1 << 8) | 0;     // ROM[ip3] can't be reached!?
420      (void)addr; // avoid unused variable warning
421      dst += sprintf(dst, "[%x]", i6p3);
422   }
423423
424    if (tok & t_I8) {
425        // 8 bit immediate I/O port address
426        UINT8 arg = ARG(pc++);
427        dst += sprintf(dst, "%02x", arg);
428    }
424   if (tok & t_I8) {
425      // 8 bit immediate I/O port address
426      UINT8 arg = ARG(pc++);
427      dst += sprintf(dst, "%02x", arg);
428   }
429429
430    if (tok & t_I8c) {
431        // 8 bit immediate offset into page
432        UINT16 arg = ~ARG(pc++) & 255;
433        dst += sprintf(dst, "%02x", arg);
434    }
430   if (tok & t_I8c) {
431      // 8 bit immediate offset into page
432      UINT16 arg = ~ARG(pc++) & 255;
433      dst += sprintf(dst, "%02x", arg);
434   }
435435
436    if (tok & t_OVER)  // TL or TML
437            flags |= DASMFLAG_STEP_OVER;
436   if (tok & t_OVER)  // TL or TML
437         flags |= DASMFLAG_STEP_OVER;
438438
439    if (tok & t_OUT)   // RTN or RTNSK
440            flags |= DASMFLAG_STEP_OUT;
439   if (tok & t_OUT)   // RTN or RTNSK
440         flags |= DASMFLAG_STEP_OUT;
441441
442    return (pc - PC) | flags | DASMFLAG_SUPPORTED;
442   return (pc - PC) | flags | DASMFLAG_SUPPORTED;
443443}
trunk/src/emu/cpu/sh2/sh2comn.c
r242631r242632
699699   case 0x00:
700700      break;
701701   case 0x01:
702//      return m_m[1] | 0; // bit31 is TDRE: Trasmit Data Register Empty. Forcing it to be '1' breaks Saturn ...
702//      return m_m[1] | 0; // bit31 is TDRE: Trasmit Data Register Empty. Forcing it to be '1' breaks Saturn ...
703703      return m_m[1] | (0x84 << 24); // ... but this is actually needed to make EGWord on SS to boot?
704704
705705   case 0x04: // TIER, FTCSR, FRC
trunk/src/emu/cpu/tms0980/tms0980.c
r242631r242632
250250
251251
252252static MACHINE_CONFIG_FRAGMENT(tms1000)
253   
253
254254   // microinstructions PLA, output PLA
255255   MCFG_PLA_ADD("mpla", 8, 16, 30)
256256   MCFG_PLA_FILEFORMAT(PLA_FMT_BERKELEY)
r242631r242632
374374   m_r_mask = (1 << m_r_pins) - 1;
375375   m_pc_mask = (1 << m_pc_bits) - 1;
376376   m_x_mask = (1 << m_x_bits) - 1;
377   
377
378378   // zerofill
379379   m_pc = 0;
380380   m_sr = 0;
r242631r242632
401401   m_clatch = 0;
402402   m_add = 0;
403403   m_bl = 0;
404   
404
405405   m_ram_in = 0;
406406   m_dam_in = 0;
407407   m_ram_out = 0;
r242631r242632
484484   m_o_latch_low = 0;
485485   m_o_latch = 0;
486486   m_o_latch_prev = 0;
487   
487
488488   // register for savestates
489489   save_item(NAME(m_r_prev));
490490   save_item(NAME(m_chipsel));
r242631r242632
535535{
536536   // common reset
537537   tms1xxx_cpu_device::device_reset();
538   
538
539539   // pre-decode instructionset
540540   m_fixed_decode.resize_and_clear(0x100);
541541   m_micro_decode.resize_and_clear(0x100);
542   
542
543543   for (int op = 0; op < 0x100; op++)
544544   {
545545      //                                              _____              _____  ______  _____  ______  _____  _____  _____  _____
546546      const UINT32 md[16] = { M_STSL, M_AUTY, M_AUTA, M_CIN, M_C8, M_NE, M_CKN, M_15TN, M_MTN, M_NATN, M_ATN, M_MTP, M_YTP, M_CKP, M_CKM, M_STO };
547547      UINT16 mask = m_mpla->read(op);
548548      mask ^= 0x3fc8; // invert active-negative
549     
549
550550      for (int bit = 0; bit < 16; bit++)
551551         if (mask & (1 << bit))
552552            m_micro_decode[op] |= md[bit];
r242631r242632
559559   m_fixed_decode[0x0c] = F_RSTR;
560560   m_fixed_decode[0x0d] = F_SETR;
561561   m_fixed_decode[0x0f] = F_RETN;
562   
562
563563   for (int i = 0x10; i < 0x20; i++) m_fixed_decode[i] = F_LDP;
564564   for (int i = 0x30; i < 0x34; i++) m_fixed_decode[i] = F_SBIT;
565565   for (int i = 0x34; i < 0x38; i++) m_fixed_decode[i] = F_RBIT;
r242631r242632
572572void tms1100_cpu_device::device_reset()
573573{
574574   tms1000_cpu_device::device_reset();
575   
575
576576   // small differences in 00-3f area
577577   m_fixed_decode[0x00] = 0;
578578   m_fixed_decode[0x09] = F_COMX8; // !
r242631r242632
597597      // upper half of the opcodes is always branch/call
598598      if (op & 0x80)
599599         m_fixed_decode[op] = (op & 0x40) ? F_CALL: F_BR;
600     
600
601601      // 5 output bits select a microinstruction index
602602      UINT32 imask = m_ipla->read(op);
603603      UINT8 msel = imask & 0x1f;
604     
604
605605      // but if (from bottom to top) term 1 is active and output bit 5 is 0, R2,R4-R7 directly select a microinstruction index
606606      if (imask & 0x40 && (imask & 0x20) == 0)
607607         msel = (op & 0xf) | (op >> 1 & 0x10);
608     
608
609609      msel = BITSWAP8(msel,7,6,5,0,1,2,3,4); // lines are reversed
610610      UINT32 mmask = m_mpla->read(msel);
611611      mmask ^= 0x09fe; // invert active-negative
612     
612
613613      //                             _____  _____  _____  _____  ______  _____  ______  _____              _____
614614      const UINT32 md[15] = { M_CKM, M_CKP, M_YTP, M_MTP, M_ATN, M_NATN, M_MTN, M_15TN, M_CKN, M_NE, M_C8, M_CIN, M_AUTA, M_AUTY, M_STO };
615615
616616      for (int bit = 0; bit < 15; bit++)
617617         if (mmask & (1 << bit))
618618            m_micro_decode[op] |= md[bit];
619     
619
620620      // the other ipla terms each select a fixed instruction
621621      const UINT32 id[8] = { F_LDP, F_TDO, F_COMX, F_LDX, F_SBIT, F_RBIT, F_SETR, F_RETN };
622     
622
623623      for (int bit = 0; bit < 8; bit++)
624624         if (imask & (0x80 << bit))
625625            m_fixed_decode[op] |= id[bit];
r242631r242632
630630UINT32 tms0980_cpu_device::decode_micro(UINT8 sel)
631631{
632632   UINT32 decode = 0;
633   
633
634634   sel = BITSWAP8(sel,7,6,0,1,2,3,4,5); // lines are reversed
635635   UINT32 mask = m_mpla->read(sel);
636636   mask ^= 0x43fc3; // invert active-negative
637   
637
638638   // M_RSTR is specific to TMS02x0, it redirects to F_RSTR
639639   // M_UNK1 is specific to TMS0270, unknown yet
640640   //                      _______  ______                                _____  _____  _____  _____  ______  _____  ______  _____                            _____
641641   const UINT32 md[22] = { M_NDMTP, M_DMTP, M_AUTY, M_AUTA, M_CKM, M_SSE, M_CKP, M_YTP, M_MTP, M_ATN, M_NATN, M_MTN, M_15TN, M_CKN, M_NE, M_C8, M_SSS, M_CME, M_CIN, M_STO, M_RSTR, M_UNK1 };
642   
642
643643   for (int bit = 0; bit < 22 && bit < m_mpla->outputs(); bit++)
644644      if (mask & (1 << bit))
645645         decode |= md[bit];
646   
646
647647   return decode;
648648}
649649
r242631r242632
651651{
652652   // common reset
653653   tms1xxx_cpu_device::device_reset();
654   
654
655655   // pre-decode instructionset
656656   m_fixed_decode.resize_and_clear(0x200);
657657   m_micro_decode.resize_and_clear(0x200);
r242631r242632
661661      // upper half of the opcodes is always branch/call
662662      if (op & 0x100)
663663         m_fixed_decode[op] = (op & 0x80) ? F_CALL: F_BR;
664     
664
665665      UINT32 imask = m_ipla->read(op);
666666
667667      // 6 output bits select a microinstruction index
668668      m_micro_decode[op] = decode_micro(imask & 0x3f);
669     
669
670670      // the other ipla terms each select a fixed instruction
671671      const UINT32 id[15] = { F_LDP, F_SBL, F_OFF, F_RBIT, F_SAL, F_XDA, F_REAC, F_SETR, F_RETN, F_SBIT, F_TDO, F_COMX8, F_COMX, F_LDX, F_SEAC };
672     
672
673673      for (int bit = 0; bit < 15; bit++)
674674         if (imask & (0x80 << bit))
675675            m_fixed_decode[op] |= id[bit];
676676   }
677   
677
678678   // like on TMS0970, one of the terms directly select a microinstruction index (via R4-R8),
679679   // but it can't be pre-determined when it's active
680680   m_micro_direct.resize_and_clear(0x40);
r242631r242632
710710      fb = 1;
711711   else if (m_pc == m_pc_mask)
712712      fb = 0;
713   
713
714714   m_pc = (m_pc << 1 | fb) & m_pc_mask;
715715}
716716
r242631r242632
731731   debugger_instruction_hook(this, m_rom_address << 1);
732732   m_opcode = m_program->read_word(m_rom_address << 1) & 0x1ff;
733733   m_c4 = BITSWAP8(m_opcode,7,6,5,4,0,1,2,3) & 0xf; // opcode operand is bitswapped for most opcodes
734   
734
735735   m_fixed = m_fixed_decode[m_opcode];
736   
736
737737   // if ipla term 0 is active, R4-R8 directly select a microinstruction index when R0 or R0^BL is 0
738738   int r0 = m_opcode >> 8 & 1;
739739   if (m_ipla->read(m_opcode) & 0x40 && !((r0 & m_bl) ^ r0))
r242631r242632
747747void tms0270_cpu_device::read_opcode()
748748{
749749   tms0980_cpu_device::read_opcode();
750   
750
751751   // RSTR is on the mpla
752752   if (m_micro & M_RSTR)
753753      m_fixed |= F_RSTR;
r242631r242632
780780   // R13: power off, trigger on falling edge
781781   if ((m_r_prev >> 13 & 1) && !(m_r >> 13 & 1))
782782      m_power_off(1);
783   
783
784784   // R11: TMS5100 CTL port direction (0=read from TMS5100, 1=write to TMS5100)
785785   m_ctl_dir = m_r >> 11 & 1;
786786
787787   // R12: chip select (off=display via OPLA, on=TMS5100 via ACC/CKB)
788788   m_chipsel = m_r >> 12 & 1;
789   
789
790790   if (m_chipsel)
791791   {
792792      // ACC via SEG B,C,D,G: TMS5100 CTL pins
r242631r242632
812812         m_o_latch_prev = m_o_latch;
813813      }
814814   }
815   
815
816816   // standard R-output
817817   if (m_r != m_r_prev)
818818   {
r242631r242632
860860      case 0x30: case 0x38:
861861         m_cki_bus = 1 << (m_c4 >> 2) ^ 0xf;
862862         break;
863     
863
864864      // 01XXXXXX: constant
865865      case 0x00: // R2,3,4 are NANDed with eachother, and then ORed with R1, making 00000XXX valid too
866866      case 0x40: case 0x48: case 0x50: case 0x58: case 0x60: case 0x68: case 0x70: case 0x78:
r242631r242632
886886      case 0x020: case 0x0a0:
887887         m_cki_bus = 1 << (m_c4 >> 2) ^ 0xf;
888888         break;
889     
889
890890      // 0X1XXXXXX: constant
891891      case 0x040: case 0x048: case 0x050: case 0x058: case 0x060: case 0x068: case 0x070: case 0x078:
892892      case 0x0c0: case 0x0c8: case 0x0d0: case 0x0d8: case 0x0e0: case 0x0e8: case 0x0f0: case 0x0f8:
r242631r242632
10801080      m_o_latch_low = m_a;
10811081   else
10821082      m_o_latch = m_o_latch_low | (m_a << 4 & 0x30);
1083   
1083
10841084   // write to output is done in dynamic_output
10851085}
10861086
r242631r242632
11111111         if (m_status)
11121112         {
11131113            UINT8 new_pc = m_opcode & m_pc_mask;
1114           
1114
11151115            // BR: conditional branch
11161116            if (m_fixed & F_BR)
11171117            {
r242631r242632
11201120               m_ca = m_cb;
11211121               m_pc = new_pc;
11221122            }
1123           
1123
11241124            // CALL: conditional call
11251125            if (m_fixed & F_CALL)
11261126            {
r242631r242632
11661166      case 1:
11671167         // fetch: rom address 2/2
11681168         m_rom_address = (m_ca << (m_pc_bits+4)) | (m_pa << m_pc_bits) | m_pc;
1169         
1169
11701170         // execute: update alu inputs
11711171         // N inputs
11721172         if (m_micro & M_15TN)  m_n |= 0xf;
r242631r242632
12331233         if (m_fixed & F_SAL)   op_sal();
12341234         if (m_fixed & F_SBL)   op_sbl();
12351235         if (m_fixed & F_XDA)   op_xda();
1236         
1236
12371237         // after fixed opcode handling: store status, write ram
12381238         m_status = status;
12391239         if (m_ram_out != -1)
trunk/src/emu/cpu/tms0980/tms0980.h
r242631r242632
7777   template<class _Object> static devcb_base &set_write_r_callback(device_t &device, _Object object) { return downcast<tms1xxx_cpu_device &>(device).m_write_r.set_callback(object); }
7878   template<class _Object> static devcb_base &set_power_off_callback(device_t &device, _Object object) { return downcast<tms1xxx_cpu_device &>(device).m_power_off.set_callback(object); }
7979   static void set_output_pla(device_t &device, const UINT16 *output_pla) { downcast<tms1xxx_cpu_device &>(device).c_output_pla = output_pla; }
80   
80
8181protected:
8282   // device-level overrides
8383   virtual void device_start();
r242631r242632
184184   devcb_write16 m_write_o;
185185   devcb_write16 m_write_r;
186186   devcb_write_line m_power_off;
187   
187
188188   UINT32 m_o_mask;
189189   UINT32 m_r_mask;
190190   UINT32 m_k_mask;
r242631r242632
239239   virtual void device_reset();
240240
241241   virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options);
242   
242
243243   virtual void op_setr();
244244   virtual void op_rstr();
245245};
r242631r242632
263263   virtual machine_config_constructor device_mconfig_additions() const;
264264
265265   virtual void write_o_output(UINT8 index);
266   
266
267267   virtual void op_setr();
268268   virtual void op_tdo();
269269};
r242631r242632
284284   virtual UINT32 disasm_min_opcode_bytes() const { return 2; }
285285   virtual UINT32 disasm_max_opcode_bytes() const { return 2; }
286286   virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options);
287   
287
288288   virtual UINT8 read_k_input();
289289   virtual void set_cki_bus();
290290   virtual void read_opcode();
291   
291
292292   virtual void op_comx();
293293
294294   UINT32 decode_micro(UINT8 sel);
r242631r242632
299299{
300300public:
301301   tms0270_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
302   
302
303303   // static configuration helpers
304304   template<class _Object> static devcb_base &set_read_ctl_callback(device_t &device, _Object object) { return downcast<tms0270_cpu_device &>(device).m_read_ctl.set_callback(object); }
305305   template<class _Object> static devcb_base &set_write_ctl_callback(device_t &device, _Object object) { return downcast<tms0270_cpu_device &>(device).m_write_ctl.set_callback(object); }
r242631r242632
316316   virtual UINT8 read_k_input();
317317   virtual void dynamic_output();
318318   virtual void read_opcode();
319   
319
320320   virtual void op_setr();
321321   virtual void op_rstr();
322322   virtual void op_tdo();
trunk/src/emu/luaengine.c
r242631r242632
348348   luabridge::LuaRef devs_table = luabridge::LuaRef::newTable(L);
349349
350350   device_t *root = &(m->root_device());
351    devs_table = devtree_dfs(root, devs_table);
351   devs_table = devtree_dfs(root, devs_table);
352352
353353   return devs_table;
354354}
trunk/src/emu/machine.c
r242631r242632
255255      primary_screen->register_vblank_callback(vblank_state_delegate(FUNC(running_machine::watchdog_vblank), this));
256256   save().save_item(NAME(m_watchdog_enabled));
257257   save().save_item(NAME(m_watchdog_counter));
258   
258
259259   // save the random seed or save states might be broken in drivers that use the rand() method
260260   save().save_item(NAME(m_rand_seed));
261   
261
262262   // initialize image devices
263263   image_init(*this);
264264   m_tilemap.reset(global_alloc(tilemap_manager(*this)));
trunk/src/emu/machine/am9517a.c
r242631r242632
523523   save_item(NAME(m_status));
524524   save_item(NAME(m_temp));
525525   save_item(NAME(m_request));
526   
526
527527   for (int i = 0; i < 4; i++)
528528   {
529529      save_item(NAME(m_channel[i].m_address), i);
trunk/src/emu/machine/e05a30.c
r242631r242632
151151WRITE_LINE_MEMBER( e05a30_device::centronics_input_strobe )
152152{
153153   if (m_centronics_strobe == TRUE && state == FALSE && !m_centronics_busy) {
154
155154      m_centronics_data_latch   = m_centronics_data;
156155
157156      m_centronics_data_latched = TRUE;
trunk/src/emu/machine/i6300esb.c
r242631r242632
8383   AM_RANGE(0x00ec, 0x00ef) AM_WRITE8(                           nop_w,             0x0000ff00) // Non-existing, used for delays by the bios/os
8484ADDRESS_MAP_END
8585
86   
86
8787i6300esb_lpc_device::i6300esb_lpc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
8888   : pci_device(mconfig, I6300ESB_LPC, "i6300ESB southbridge ISA/LPC bridge", tag, owner, clock, "i6300esb_lpc", __FILE__),
89     acpi(*this, "acpi"),
90     rtc (*this, "rtc"),
91     pit (*this, "pit")
89      acpi(*this, "acpi"),
90      rtc (*this, "rtc"),
91      pit (*this, "pit")
9292{
9393}
9494
trunk/src/emu/machine/i82875p.h
r242631r242632
107107public:
108108   i82875p_overflow_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
109109
110   
110
111111   DECLARE_READ8_MEMBER  (dram_row_boundary_r);
112112   DECLARE_WRITE8_MEMBER (dram_row_boundary_w);
113113   DECLARE_READ8_MEMBER  (dram_row_attribute_r);
trunk/src/emu/machine/r10696.c
r242631r242632
3434#include "emu.h"
3535#include "machine/r10696.h"
3636
37#define   VERBOSE   1
37#define VERBOSE 1
3838#if VERBOSE
3939#define LOG(x) logerror x
4040#else
r242631r242632
5050const device_type R10696 = &device_creator<r10696_device>;
5151
5252r10696_device::r10696_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
53    : device_t(mconfig, R10696, "Rockwell 10696", tag, owner, clock, "r10696", __FILE__),
54        m_io_a(0), m_io_b(0), m_io_c(0),
55        m_iord(*this), m_iowr(*this)
53   : device_t(mconfig, R10696, "Rockwell 10696", tag, owner, clock, "r10696", __FILE__),
54      m_io_a(0), m_io_b(0), m_io_c(0),
55      m_iord(*this), m_iowr(*this)
5656{
5757}
5858
r242631r242632
6161 */
6262void r10696_device::device_start()
6363{
64    m_iord.resolve();
65    m_iowr.resolve();
64   m_iord.resolve();
65   m_iowr.resolve();
6666
67    save_item(NAME(m_io_a));
68    save_item(NAME(m_io_b));
69    save_item(NAME(m_io_c));
67   save_item(NAME(m_io_a));
68   save_item(NAME(m_io_b));
69   save_item(NAME(m_io_c));
7070}
7171
7272/**
r242631r242632
8787
8888WRITE8_MEMBER( r10696_device::io_w )
8989{
90    assert(offset < 16);
91    const UINT8 io_a = m_io_a;
92    const UINT8 io_b = m_io_b;
93    const UINT8 io_c = m_io_c;
94    switch (offset)
95    {
96    case 0x0A: // Read Group A
97    case 0x09: // Read Group B
98    case 0x03: // Read Group C
99    case 0x00: // Read Groups A | B | C
100    case 0x01: // Read Groups B | C
101    case 0x02: // Read Groups A | C
102    case 0x08: // Read Groups A | B
103        break;
90   assert(offset < 16);
91   const UINT8 io_a = m_io_a;
92   const UINT8 io_b = m_io_b;
93   const UINT8 io_c = m_io_c;
94   switch (offset)
95   {
96   case 0x0A: // Read Group A
97   case 0x09: // Read Group B
98   case 0x03: // Read Group C
99   case 0x00: // Read Groups A | B | C
100   case 0x01: // Read Groups B | C
101   case 0x02: // Read Groups A | C
102   case 0x08: // Read Groups A | B
103      break;
104104
105    case 0x0E: // Set Group A
106        m_io_a = data & 0x0f;
107        break;
108    case 0x0D: // Set Group B
109        m_io_b = data & 0x0f;
110        break;
111    case 0x07: // Set Group C
112        m_io_c = data & 0x0f;
113        break;
114    case 0x04: // Set Groups A, B and C
115        m_io_a = m_io_b = m_io_c = data & 0x0f;
116        break;
117    case 0x05: // Set Groups B and C
118        m_io_b = m_io_c = data & 0x0f;
119        break;
120    case 0x06: // Set Groups A and C
121        m_io_a = m_io_c = data & 0x0f;
122        break;
123    case 0x0C: // Set Groups A and B
124        m_io_a = m_io_b = data & 0x0f;
125        break;
126    }
127    if (io_a != m_io_a)
128        m_iowr(0, m_io_a, 0x0f);
129    if (io_b != m_io_b)
130        m_iowr(1, m_io_b, 0x0f);
131    if (io_c != m_io_c)
132        m_iowr(2, m_io_c, 0x0f);
105   case 0x0E: // Set Group A
106      m_io_a = data & 0x0f;
107      break;
108   case 0x0D: // Set Group B
109      m_io_b = data & 0x0f;
110      break;
111   case 0x07: // Set Group C
112      m_io_c = data & 0x0f;
113      break;
114   case 0x04: // Set Groups A, B and C
115      m_io_a = m_io_b = m_io_c = data & 0x0f;
116      break;
117   case 0x05: // Set Groups B and C
118      m_io_b = m_io_c = data & 0x0f;
119      break;
120   case 0x06: // Set Groups A and C
121      m_io_a = m_io_c = data & 0x0f;
122      break;
123   case 0x0C: // Set Groups A and B
124      m_io_a = m_io_b = data & 0x0f;
125      break;
126   }
127   if (io_a != m_io_a)
128      m_iowr(0, m_io_a, 0x0f);
129   if (io_b != m_io_b)
130      m_iowr(1, m_io_b, 0x0f);
131   if (io_c != m_io_c)
132      m_iowr(2, m_io_c, 0x0f);
133133}
134134
135135
136136READ8_MEMBER( r10696_device::io_r )
137137{
138    assert(offset < 16);
139    UINT8 io_a, io_b, io_c;
140    UINT8 data = 0xf;
141    switch (offset)
142    {
143    case 0x0A: // Read Group A
144        io_a = m_iord(0);
145        data = io_a & 0x0f;
146        break;
147    case 0x09: // Read Group B
148        io_b = m_iord(1);
149        data = io_b & 0x0f;
150        break;
151    case 0x03: // Read Group C
152        io_c = m_iord(2);
153        data = io_c & 0x0f;
154        break;
155    case 0x00: // Read Groups A | B | C
156        io_a = m_iord(0);
157        io_b = m_iord(1);
158        io_c = m_iord(2);
159        data = (io_a | io_b | io_a) & 0x0f;
160        break;
161    case 0x01: // Read Groups B | C
162        io_b = m_iord(1);
163        io_c = m_iord(2);
164        data = (io_b | io_c) & 0x0f;
165        break;
166    case 0x02: // Read Groups A | C
167        io_a = m_iord(0);
168        io_c = m_iord(2);
169        data = (io_a | io_c) & 0x0f;
170        break;
171    case 0x08: // Read Groups A | B
172        io_a = m_iord(0);
173        io_b = m_iord(1);
174        data = (io_a | io_b) & 0x0f;
175        break;
138   assert(offset < 16);
139   UINT8 io_a, io_b, io_c;
140   UINT8 data = 0xf;
141   switch (offset)
142   {
143   case 0x0A: // Read Group A
144      io_a = m_iord(0);
145      data = io_a & 0x0f;
146      break;
147   case 0x09: // Read Group B
148      io_b = m_iord(1);
149      data = io_b & 0x0f;
150      break;
151   case 0x03: // Read Group C
152      io_c = m_iord(2);
153      data = io_c & 0x0f;
154      break;
155   case 0x00: // Read Groups A | B | C
156      io_a = m_iord(0);
157      io_b = m_iord(1);
158      io_c = m_iord(2);
159      data = (io_a | io_b | io_a) & 0x0f;
160      break;
161   case 0x01: // Read Groups B | C
162      io_b = m_iord(1);
163      io_c = m_iord(2);
164      data = (io_b | io_c) & 0x0f;
165      break;
166   case 0x02: // Read Groups A | C
167      io_a = m_iord(0);
168      io_c = m_iord(2);
169      data = (io_a | io_c) & 0x0f;
170      break;
171   case 0x08: // Read Groups A | B
172      io_a = m_iord(0);
173      io_b = m_iord(1);
174      data = (io_a | io_b) & 0x0f;
175      break;
176176
177    case 0x0E: // Set Group A
178    case 0x0D: // Set Group B
179    case 0x07: // Set Group C
180    case 0x04: // Set Groups A, B and C
181    case 0x05: // Set Groups B and C
182    case 0x06: // Set Groups A and C
183    case 0x0C: // Set Groups A and B
184        break;
185    }
186    return data;
177   case 0x0E: // Set Group A
178   case 0x0D: // Set Group B
179   case 0x07: // Set Group C
180   case 0x04: // Set Groups A, B and C
181   case 0x05: // Set Groups B and C
182   case 0x06: // Set Groups A and C
183   case 0x0C: // Set Groups A and B
184      break;
185   }
186   return data;
187187}
trunk/src/emu/machine/r10696.h
r242631r242632
2424
2525/* Set the read and write group (4-bit; nibble) delegates */
2626#define MCFG_R10696_IO(_devcb_rd,_devcb_wr) \
27    r10696_device::set_iord(*device, DEVCB_##_devcb_rd); \
28    r10696_device::set_iowr(*device, DEVCB_##_devcb_wr);
27   r10696_device::set_iord(*device, DEVCB_##_devcb_rd); \
28   r10696_device::set_iowr(*device, DEVCB_##_devcb_wr);
2929
3030class r10696_device : public device_t
3131{
3232public:
33    r10696_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
34    ~r10696_device() {}
33   r10696_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
34   ~r10696_device() {}
3535
36    DECLARE_READ8_MEMBER ( io_r );
37    DECLARE_WRITE8_MEMBER( io_w );
36   DECLARE_READ8_MEMBER ( io_r );
37   DECLARE_WRITE8_MEMBER( io_w );
3838
39    template<class _Object> static devcb_base &set_iord(device_t &device, _Object object) { return downcast<r10696_device &>(device).m_iord.set_callback(object); }
40    template<class _Object> static devcb_base &set_iowr(device_t &device, _Object object) { return downcast<r10696_device &>(device).m_iowr.set_callback(object); }
39   template<class _Object> static devcb_base &set_iord(device_t &device, _Object object) { return downcast<r10696_device &>(device).m_iord.set_callback(object); }
40   template<class _Object> static devcb_base &set_iowr(device_t &device, _Object object) { return downcast<r10696_device &>(device).m_iowr.set_callback(object); }
4141protected:
42    // device-level overrides
43    virtual void device_start();
44    virtual void device_reset();
42   // device-level overrides
43   virtual void device_start();
44   virtual void device_reset();
4545
4646private:
47    UINT8         m_io_a;   //!< input/output flip-flops group A
48    UINT8         m_io_b;   //!< input/output flip-flops group B
49    UINT8         m_io_c;   //!< input/output flip-flops group C
50    devcb_read8   m_iord;   //!< input line (read, offset = group, data = 4 bits)
51    devcb_write8  m_iowr;   //!< output line (write, offset = group, data = 4 bits)
47   UINT8         m_io_a;   //!< input/output flip-flops group A
48   UINT8         m_io_b;   //!< input/output flip-flops group B
49   UINT8         m_io_c;   //!< input/output flip-flops group C
50   devcb_read8   m_iord;   //!< input line (read, offset = group, data = 4 bits)
51   devcb_write8  m_iowr;   //!< output line (write, offset = group, data = 4 bits)
5252};
5353
5454extern const device_type R10696;
trunk/src/emu/machine/r10788.c
r242631r242632
4141#include "emu.h"
4242#include "machine/r10788.h"
4343
44#define   VERBOSE   0
44#define VERBOSE 0
4545#if VERBOSE
4646#define LOG(x) logerror x
4747#else
r242631r242632
5757const device_type R10788 = &device_creator<r10788_device>;
5858
5959r10788_device::r10788_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
60    : device_t(mconfig, R10788, "Rockwell 10788", tag, owner, clock, "r10788", __FILE__),
61        m_ktr(0), m_kts(0), m_kla(0), m_klb(0), m_mask_a(15), m_mask_b(15), m_ker(0),
62        m_io_counter(0), m_scan_counter(0),
63        m_display(*this)
60   : device_t(mconfig, R10788, "Rockwell 10788", tag, owner, clock, "r10788", __FILE__),
61      m_ktr(0), m_kts(0), m_kla(0), m_klb(0), m_mask_a(15), m_mask_b(15), m_ker(0),
62      m_io_counter(0), m_scan_counter(0),
63      m_display(*this)
6464{
6565}
6666
r242631r242632
6969 */
7070void r10788_device::device_start()
7171{
72    m_display.resolve();
72   m_display.resolve();
7373
74    save_item(NAME(m_reg));
75    save_item(NAME(m_ktr));
76    save_item(NAME(m_kts));
77    save_item(NAME(m_kla));
78    save_item(NAME(m_klb));
79    save_item(NAME(m_mask_a));
80    save_item(NAME(m_mask_b));
81    save_item(NAME(m_ker));
82    save_item(NAME(m_io_counter));
83    save_item(NAME(m_scan_counter));
74   save_item(NAME(m_reg));
75   save_item(NAME(m_ktr));
76   save_item(NAME(m_kts));
77   save_item(NAME(m_kla));
78   save_item(NAME(m_klb));
79   save_item(NAME(m_mask_a));
80   save_item(NAME(m_mask_b));
81   save_item(NAME(m_ker));
82   save_item(NAME(m_io_counter));
83   save_item(NAME(m_scan_counter));
8484
85    m_timer = timer_alloc(TIMER_DISPLAY);
86    // recurring timer every 36 cycles
87    m_timer->adjust(clocks_to_attotime(36), 0, clocks_to_attotime(36));
85   m_timer = timer_alloc(TIMER_DISPLAY);
86   // recurring timer every 36 cycles
87   m_timer->adjust(clocks_to_attotime(36), 0, clocks_to_attotime(36));
8888}
8989
9090/**
r242631r242632
9393void r10788_device::device_reset()
9494{
9595   memset(m_reg, 0x00, sizeof(m_reg));
96    m_ktr = 0;
97    m_kts = 0;
98    m_kla = 0;
99    m_klb = 0;
100    m_mask_a = 15;
101    m_mask_b = 15;
102    m_ker = 0;
103    m_scan_counter = 0;
96   m_ktr = 0;
97   m_kts = 0;
98   m_kla = 0;
99   m_klb = 0;
100   m_mask_a = 15;
101   m_mask_b = 15;
102   m_ker = 0;
103   m_scan_counter = 0;
104104}
105105
106106
r242631r242632
113113 */
114114void r10788_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
115115{
116    UINT8 data;
117    switch (id)
118    {
119        case TIMER_DISPLAY:
120            data = (m_reg[0][m_scan_counter] & m_mask_a) +
121                   16 * (m_reg[1][m_scan_counter] & m_mask_b);
122            LOG(("%s: scan counter:%2d data:%02x\n", __FUNCTION__, m_scan_counter, data));
123            m_display(m_scan_counter, data, 0xff);
124            break;
125        default:
126            LOG(("%s: invalid timer id:%d\n", __FUNCTION__, id));
127    }
128    m_scan_counter = (m_scan_counter + 1) % 16;
116   UINT8 data;
117   switch (id)
118   {
119      case TIMER_DISPLAY:
120         data = (m_reg[0][m_scan_counter] & m_mask_a) +
121               16 * (m_reg[1][m_scan_counter] & m_mask_b);
122         LOG(("%s: scan counter:%2d data:%02x\n", __FUNCTION__, m_scan_counter, data));
123         m_display(m_scan_counter, data, 0xff);
124         break;
125      default:
126         LOG(("%s: invalid timer id:%d\n", __FUNCTION__, id));
127   }
128   m_scan_counter = (m_scan_counter + 1) % 16;
129129}
130130
131131/*************************************
r242631r242632
142142
143143WRITE8_MEMBER( r10788_device::io_w )
144144{
145    assert(offset < 16);
146    switch (offset)
147    {
148        case KTR:  // Transfer Keyboard Return
149            LOG(("%s: KTR data:%02x\n", __FUNCTION__, data));
150            m_ktr = data;
151            break;
152        case KTS:  // Transfer Keyboard Strobe
153            LOG(("%s: KTS data:%02x\n", __FUNCTION__, data));
154            m_kts = data;
155            break;
156        case KLA:  // Load Display Register A
157            LOG(("%s: KLA [%2d] data:%02x\n", __FUNCTION__, m_io_counter, data));
158            m_kla = data;
159            m_reg[0][m_io_counter] = m_kla;
160            break;
161        case KLB:  // Load Display Register B
162            LOG(("%s: KLB [%2d] data:%02x\n", __FUNCTION__, m_io_counter, data));
163            m_klb = data;
164            m_reg[1][m_io_counter] = m_kla;
165            break;
166        case KDN:  // Turn On Display
167            LOG(("%s: KDN data:%02x\n", __FUNCTION__, data));
168            m_mask_a = 15;
169            m_mask_b = 15;
170            break;
171        case KAF:  // Turn Off A
172            LOG(("%s: KAF data:%02x\n", __FUNCTION__, data));
173            m_mask_a = 0;
174            m_mask_b &= ~3;
175            break;
176        case KBF:  // Turn Off B
177            LOG(("%s: KBF data:%02x\n", __FUNCTION__, data));
178            m_mask_b &= ~12;
179            break;
180        case KER:  // Reset Keyboard Error
181            LOG(("%s: KER data:%02x\n", __FUNCTION__, data));
182            m_ker = 10;
183            break;
184    }
145   assert(offset < 16);
146   switch (offset)
147   {
148      case KTR:  // Transfer Keyboard Return
149         LOG(("%s: KTR data:%02x\n", __FUNCTION__, data));
150         m_ktr = data;
151         break;
152      case KTS:  // Transfer Keyboard Strobe
153         LOG(("%s: KTS data:%02x\n", __FUNCTION__, data));
154         m_kts = data;
155         break;
156      case KLA:  // Load Display Register A
157         LOG(("%s: KLA [%2d] data:%02x\n", __FUNCTION__, m_io_counter, data));
158         m_kla = data;
159         m_reg[0][m_io_counter] = m_kla;
160         break;
161      case KLB:  // Load Display Register B
162         LOG(("%s: KLB [%2d] data:%02x\n", __FUNCTION__, m_io_counter, data));
163         m_klb = data;
164         m_reg[1][m_io_counter] = m_kla;
165         break;
166      case KDN:  // Turn On Display
167         LOG(("%s: KDN data:%02x\n", __FUNCTION__, data));
168         m_mask_a = 15;
169         m_mask_b = 15;
170         break;
171      case KAF:  // Turn Off A
172         LOG(("%s: KAF data:%02x\n", __FUNCTION__, data));
173         m_mask_a = 0;
174         m_mask_b &= ~3;
175         break;
176      case KBF:  // Turn Off B
177         LOG(("%s: KBF data:%02x\n", __FUNCTION__, data));
178         m_mask_b &= ~12;
179         break;
180      case KER:  // Reset Keyboard Error
181         LOG(("%s: KER data:%02x\n", __FUNCTION__, data));
182         m_ker = 10;
183         break;
184   }
185185}
186186
187187
188188READ8_MEMBER( r10788_device::io_r )
189189{
190    assert(offset < 16);
191    UINT8 data = 0xf;
192    switch (offset)
193    {
194        case KTR:  // Transfer Keyboard Return
195            data = m_ktr;
196            LOG(("%s: KTR data:%02x\n", __FUNCTION__, data));
197            break;
198        case KTS:  // Transfer Keyboard Strobe
199            data = m_kts;
200            LOG(("%s: KTS data:%02x\n", __FUNCTION__, data));
201            break;
202        case KLA:  // Load Display Register A
203            m_kla = m_reg[0][m_io_counter];
204            data = m_kla;
205            LOG(("%s: KLA [%2d] data:%02x\n", __FUNCTION__, m_io_counter, data));
206            break;
207        case KLB:  // Load Display Register B
208            m_klb = m_reg[1][m_io_counter];
209            data = m_klb;
210            LOG(("%s: KLB [%2d] data:%02x\n", __FUNCTION__, m_io_counter, data));
211            // FIXME: does it automagically increment at KLB write?
212            m_io_counter = (m_io_counter + 1) % 16;
213            break;
214        case KDN:  // Turn On Display
215            LOG(("%s: KDN data:%02x\n", __FUNCTION__, data));
216            break;
217        case KAF:  // Turn Off A
218            LOG(("%s: KAF data:%02x\n", __FUNCTION__, data));
219            break;
220        case KBF:  // Turn Off B
221            LOG(("%s: KBF data:%02x\n", __FUNCTION__, data));
222            break;
223        case KER:  // Reset Keyboard Error
224            LOG(("%s: KER data:%02x\n", __FUNCTION__, data));
225            break;
226    }
227    return data;
190   assert(offset < 16);
191   UINT8 data = 0xf;
192   switch (offset)
193   {
194      case KTR:  // Transfer Keyboard Return
195         data = m_ktr;
196         LOG(("%s: KTR data:%02x\n", __FUNCTION__, data));
197         break;
198      case KTS:  // Transfer Keyboard Strobe
199         data = m_kts;
200         LOG(("%s: KTS data:%02x\n", __FUNCTION__, data));
201         break;
202      case KLA:  // Load Display Register A
203         m_kla = m_reg[0][m_io_counter];
204         data = m_kla;
205         LOG(("%s: KLA [%2d] data:%02x\n", __FUNCTION__, m_io_counter, data));
206         break;
207      case KLB:  // Load Display Register B
208         m_klb = m_reg[1][m_io_counter];
209         data = m_klb;
210         LOG(("%s: KLB [%2d] data:%02x\n", __FUNCTION__, m_io_counter, data));
211         // FIXME: does it automagically increment at KLB write?
212         m_io_counter = (m_io_counter + 1) % 16;
213         break;
214      case KDN:  // Turn On Display
215         LOG(("%s: KDN data:%02x\n", __FUNCTION__, data));
216         break;
217      case KAF:  // Turn Off A
218         LOG(("%s: KAF data:%02x\n", __FUNCTION__, data));
219         break;
220      case KBF:  // Turn Off B
221         LOG(("%s: KBF data:%02x\n", __FUNCTION__, data));
222         break;
223      case KER:  // Reset Keyboard Error
224         LOG(("%s: KER data:%02x\n", __FUNCTION__, data));
225         break;
226   }
227   return data;
228228}
trunk/src/emu/machine/r10788.h
r242631r242632
2323
2424/* Set the writer used to update a display digit */
2525#define MCFG_R10788_UPDATE(_devcb) \
26    r10788_device::set_update(*device, DEVCB_##_devcb);
26   r10788_device::set_update(*device, DEVCB_##_devcb);
2727
2828class r10788_device : public device_t
2929{
3030public:
31    r10788_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
32    ~r10788_device() {}
31   r10788_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
32   ~r10788_device() {}
3333
34    enum {
35        KTR = 0xc,  //!< Transfer Keyboard Return
36        KTS = 0xa,  //!< Transfer Keyboard Strobe
37        KLA = 0xe,  //!< Load Display Register A
38        KLB = 0xd,  //!< Load Display Register B
39        KDN = 0x3,  //!< Turn On Display
40        KAF = 0xb,  //!< Turn Off A
41        KBF = 0x7,  //!< Turn Off B
42        KER = 0x6   //!< Reset Keyboard Error
43    };
34   enum {
35      KTR = 0xc,  //!< Transfer Keyboard Return
36      KTS = 0xa,  //!< Transfer Keyboard Strobe
37      KLA = 0xe,  //!< Load Display Register A
38      KLB = 0xd,  //!< Load Display Register B
39      KDN = 0x3,  //!< Turn On Display
40      KAF = 0xb,  //!< Turn Off A
41      KBF = 0x7,  //!< Turn Off B
42      KER = 0x6   //!< Reset Keyboard Error
43   };
4444
45    DECLARE_READ8_MEMBER ( io_r );
46    DECLARE_WRITE8_MEMBER( io_w );
45   DECLARE_READ8_MEMBER ( io_r );
46   DECLARE_WRITE8_MEMBER( io_w );
4747
48    template<class _Object> static devcb_base &set_update(device_t &device, _Object object) { return downcast<r10788_device &>(device).m_display.set_callback(object); }
48   template<class _Object> static devcb_base &set_update(device_t &device, _Object object) { return downcast<r10788_device &>(device).m_display.set_callback(object); }
4949protected:
50    // device-level overrides
51    virtual void device_start();
52    virtual void device_reset();
53    virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
50   // device-level overrides
51   virtual void device_start();
52   virtual void device_reset();
53   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
5454
5555private:
56    static const device_timer_id TIMER_DISPLAY = 0;
56   static const device_timer_id TIMER_DISPLAY = 0;
5757
58    UINT8        m_reg[2][16];          //!< display registers
59    UINT8        m_ktr;                 //!< transfer keyboard return value
60    UINT8        m_kts;                 //!< transfer keyboard strobe value
61    UINT8        m_kla;                 //!< display register A value
62    UINT8        m_klb;                 //!< display register B value
63    UINT8        m_mask_a;              //!< display enable bits for A
64    UINT8        m_mask_b;              //!< display enable bits for B
65    UINT8        m_ker;                 //!< keyboard error value
66    int          m_io_counter;          //!< current I/O register index
67    int          m_scan_counter;        //!< current display scan
68    devcb_write8 m_display;             //!< display updater
69    emu_timer*   m_timer;               //!< timer running at clock / 18 / 36
58   UINT8        m_reg[2][16];          //!< display registers
59   UINT8        m_ktr;                 //!< transfer keyboard return value
60   UINT8        m_kts;                 //!< transfer keyboard strobe value
61   UINT8        m_kla;                 //!< display register A value
62   UINT8        m_klb;                 //!< display register B value
63   UINT8        m_mask_a;              //!< display enable bits for A
64   UINT8        m_mask_b;              //!< display enable bits for B
65   UINT8        m_ker;                 //!< keyboard error value
66   int          m_io_counter;          //!< current I/O register index
67   int          m_scan_counter;        //!< current display scan
68   devcb_write8 m_display;             //!< display updater
69   emu_timer*   m_timer;               //!< timer running at clock / 18 / 36
7070};
7171
7272extern const device_type R10788;
trunk/src/emu/machine/ra17xx.c
r242631r242632
4040#include "emu.h"
4141#include "machine/ra17xx.h"
4242
43#define   VERBOSE   1
43#define VERBOSE 1
4444#if VERBOSE
4545#define LOG(x) logerror x
4646#else
r242631r242632
5656const device_type RA17XX = &device_creator<ra17xx_device>;
5757
5858ra17xx_device::ra17xx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
59    : device_t(mconfig, RA17XX, "Rockwell A17XX", tag, owner, clock, "ra17xx", __FILE__),
60        m_enable(false),
61        m_iord(*this),
62        m_iowr(*this)
59   : device_t(mconfig, RA17XX, "Rockwell A17XX", tag, owner, clock, "ra17xx", __FILE__),
60      m_enable(false),
61      m_iord(*this),
62      m_iowr(*this)
6363{
6464}
6565
r242631r242632
6868 */
6969void ra17xx_device::device_start()
7070{
71    m_iord.resolve();
72    m_iowr.resolve();
71   m_iord.resolve();
72   m_iowr.resolve();
7373
74    save_item(NAME(m_line));
74   save_item(NAME(m_line));
7575}
7676
7777/**
r242631r242632
7979 */
8080void ra17xx_device::device_reset()
8181{
82    memset(m_line, 0, sizeof(m_line));
82   memset(m_line, 0, sizeof(m_line));
8383}
8484
8585
r242631r242632
9797
9898WRITE8_MEMBER( ra17xx_device::io_w )
9999{
100    assert(offset < 16);
101    m_bl = (data >> 4) & 15;    // BL on the data bus most significant bits
102    if (offset & 1) {
103        // SOS command
104        if (data & (1 << 3)) {
105            m_line[m_bl] = 1;   // enable output
100   assert(offset < 16);
101   m_bl = (data >> 4) & 15;    // BL on the data bus most significant bits
102   if (offset & 1) {
103      // SOS command
104      if (data & (1 << 3)) {
105         m_line[m_bl] = 1;   // enable output
106106//          if (m_enable)
107                m_iowr(m_bl, 1, 1);
108        } else {
109            m_line[m_bl] = 0;   // disable output
107            m_iowr(m_bl, 1, 1);
108      } else {
109         m_line[m_bl] = 0;   // disable output
110110//          if (m_enable)
111                m_iowr(m_bl, 0, 1);
112        }
113    } else {
114        // SES command
115        if (data & (1 << 3)) {
116            // enable all outputs
117            m_enable = true;
118            for (int i = 0; i < 16; i++)
119                m_iowr(i, m_line[i], 1);
120        } else {
121            // disable all outputs
122            m_enable = false;
123        }
124    }
111            m_iowr(m_bl, 0, 1);
112      }
113   } else {
114      // SES command
115      if (data & (1 << 3)) {
116         // enable all outputs
117         m_enable = true;
118         for (int i = 0; i < 16; i++)
119            m_iowr(i, m_line[i], 1);
120      } else {
121         // disable all outputs
122         m_enable = false;
123      }
124   }
125125}
126126
127127
128128READ8_MEMBER( ra17xx_device::io_r )
129129{
130    assert(offset < 16);
131    return (m_iord(m_bl) & 1) ? 0x0f : 0x07;
130   assert(offset < 16);
131   return (m_iord(m_bl) & 1) ? 0x0f : 0x07;
132132}
trunk/src/emu/machine/ra17xx.h
r242631r242632
2323
2424/* Set the read line handler */
2525#define MCFG_RA17XX_READ(_devcb) \
26    ra17xx_device::set_iord(*device, DEVCB_##_devcb); \
27
26   ra17xx_device::set_iord(*device, DEVCB_##_devcb);
2827/* Set the write line handler */
2928#define MCFG_RA17XX_WRITE(_devcb) \
30    ra17xx_device::set_iowr(*device, DEVCB_##_devcb); \
31
29   ra17xx_device::set_iowr(*device, DEVCB_##_devcb);
3230class ra17xx_device : public device_t
3331{
3432public:
35    ra17xx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
36    ~ra17xx_device() {}
33   ra17xx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
34   ~ra17xx_device() {}
3735
38    DECLARE_READ8_MEMBER ( io_r );
39    DECLARE_WRITE8_MEMBER( io_w );
36   DECLARE_READ8_MEMBER ( io_r );
37   DECLARE_WRITE8_MEMBER( io_w );
4038
41    template<class _Object> static devcb_base &set_iord(device_t &device, _Object object) { return downcast<ra17xx_device &>(device).m_iord.set_callback(object); }
42    template<class _Object> static devcb_base &set_iowr(device_t &device, _Object object) { return downcast<ra17xx_device &>(device).m_iowr.set_callback(object); }
39   template<class _Object> static devcb_base &set_iord(device_t &device, _Object object) { return downcast<ra17xx_device &>(device).m_iord.set_callback(object); }
40   template<class _Object> static devcb_base &set_iowr(device_t &device, _Object object) { return downcast<ra17xx_device &>(device).m_iowr.set_callback(object); }
4341protected:
44    // device-level overrides
45    virtual void device_start();
46    virtual void device_reset();
42   // device-level overrides
43   virtual void device_start();
44   virtual void device_reset();
4745
4846private:
49    UINT8           m_line[16];   //!< input/output flip-flops for 16 I/O lines
50    UINT8           m_bl;         //!< value of BL during the most recent output
51    bool            m_enable;     //!< true if outputs are enabled
52    devcb_read8     m_iord;       //!< input line (read, offset = line, data = 0/1)
53    devcb_write8    m_iowr;       //!< output line (write, offset = line, data = 0/1)
47   UINT8           m_line[16];   //!< input/output flip-flops for 16 I/O lines
48   UINT8           m_bl;         //!< value of BL during the most recent output
49   bool            m_enable;     //!< true if outputs are enabled
50   devcb_read8     m_iord;       //!< input line (read, offset = line, data = 0/1)
51   devcb_write8    m_iowr;       //!< output line (write, offset = line, data = 0/1)
5452};
5553
5654extern const device_type RA17XX;
trunk/src/emu/machine/smpc.c
r242631r242632
393393void saturn_state::smpc_keyboard(UINT8 pad_num, UINT8 offset)
394394{
395395   UINT16 game_key;
396   
396
397397   game_key = 0xffff;
398398
399399   game_key ^= ((ioport("KEYS_1")->read() & 0x80) << 8); // right
r242631r242632
415415   m_smpc.OREG[2+pad_num*offset] = game_key>>8; // game buttons, TODO
416416   m_smpc.OREG[3+pad_num*offset] = game_key & 0xff;
417417   /*
418      Keyboard Status hook-up
419      TODO: how shift key actually works? EGWord uses it in order to switch between hiragana and katakana modes.
418       Keyboard Status hook-up
419       TODO: how shift key actually works? EGWord uses it in order to switch between hiragana and katakana modes.
420420       x--- ---- 0
421421       -x-- ---- caps lock
422422       --x- ---- num lock
trunk/src/emu/machine/steppers.c
r242631r242632
4646      m_optic_cb(*this)
4747   {
4848      m_max_steps=(48*2);
49   }   
49   }
5050///////////////////////////////////////////////////////////////////////////
5151
5252void stepper_device::update_optic()
trunk/src/emu/machine/steppers.h
r242631r242632
3131
3232#define MCFG_STEPPER_ADD(_tag)\
3333   MCFG_DEVICE_ADD(_tag, STEPPER, 0)
34   
34
3535#define MCFG_STEPPER_REEL_TYPE(_data) \
3636   stepper_device::set_reel_type(*device, _data);
3737
3838/* total size of reel (in half steps) */
3939#define MCFG_STEPPER_MAX_STEPS(_write) \
40   stepper_device::set_max_steps(*device, _write);   
41   
40   stepper_device::set_max_steps(*device, _write);
41
4242/* start position of index (in half steps) */
4343#define MCFG_STEPPER_START_INDEX(_write) \
44   stepper_device::set_start_index(*device, _write);   
44   stepper_device::set_start_index(*device, _write);
4545
46/* end position of index (in half steps) */   
46/* end position of index (in half steps) */
4747#define MCFG_STEPPER_END_INDEX(_write) \
48   stepper_device::set_end_index(*device, _write);   
48   stepper_device::set_end_index(*device, _write);
4949
50/* end position of index (in half steps) */   
50/* end position of index (in half steps) */
5151#define MCFG_STEPPER_INDEX_PATTERN(_write) \
52   stepper_device::set_index_pattern(*device, _write);   
53   
52   stepper_device::set_index_pattern(*device, _write);
53
5454/* Phase at 0, for opto linkage */
5555#define MCFG_STEPPER_INIT_PHASE(_write) \
56   stepper_device::set_init_phase(*device, _write);   
56   stepper_device::set_init_phase(*device, _write);
5757
5858#define MCFG_STARPOINT_48STEP_ADD(_tag)\
5959   MCFG_STEPPER_ADD(_tag)\
r242631r242632
103103
104104   template<class _Object> static devcb_base &set_optic_handler(device_t &device, _Object object) { return downcast<stepper_device &>(device).m_optic_cb.set_callback(object); }
105105
106   static void set_reel_type(device_t &device, UINT8 type)
107   {
108      downcast<stepper_device &>(device).m_type = type;
106   static void set_reel_type(device_t &device, UINT8 type)
107   {
108      downcast<stepper_device &>(device).m_type = type;
109109      switch ( type )
110110      {   default:
111111         case STARPOINT_48STEP_REEL:  /* STARPOINT RMxxx */
r242631r242632
127127         case ECOIN_200STEP_REEL :
128128         downcast<stepper_device &>(device).m_max_steps = (200*2);
129129         break;
130      }   
130      }
131131   }
132132   static void set_max_steps(device_t &device, INT16 steps) { downcast<stepper_device &>(device).m_max_steps = steps; }
133133   static void set_start_index(device_t &device, INT16 index) { downcast<stepper_device &>(device).m_index_start = index; }
134   static void set_end_index(device_t &device, INT16 index) { downcast<stepper_device &>(device).m_index_end = index; }   
135   static void set_index_pattern(device_t &device, INT16 index) { downcast<stepper_device &>(device).m_index_patt = index; }   
136   static void set_init_phase(device_t &device, UINT8 phase)
134   static void set_end_index(device_t &device, INT16 index) { downcast<stepper_device &>(device).m_index_end = index; }
135   static void set_index_pattern(device_t &device, INT16 index) { downcast<stepper_device &>(device).m_index_patt = index; }
136   static void set_init_phase(device_t &device, UINT8 phase)
137137   {
138      downcast<stepper_device &>(device).m_initphase = phase;
139      downcast<stepper_device &>(device).m_phase = phase;
140      downcast<stepper_device &>(device).m_old_phase = phase;
138      downcast<stepper_device &>(device).m_initphase = phase;
139      downcast<stepper_device &>(device).m_phase = phase;
140      downcast<stepper_device &>(device).m_old_phase = phase;
141141   }
142142
143143   /* update a motor */
trunk/src/emu/rendlay.c
r242631r242632
9494
9595enum
9696{
97    LINE_CAP_NONE = 0,
98    LINE_CAP_START = 1,
99    LINE_CAP_END = 2
97   LINE_CAP_NONE = 0,
98   LINE_CAP_START = 1,
99   LINE_CAP_END = 2
100100};
101101
102102
r242631r242632
120120
121121inline int gcd(int a, int b)
122122{
123    while (b != 0)
124    {
125        int t = b;
126        b = a % b;
127        a = t;
128    }
129    return a;
123   while (b != 0)
124   {
125      int t = b;
126      b = a % b;
127      a = t;
128   }
129   return a;
130130}
131131
132132
r242631r242632
137137
138138inline void reduce_fraction(int &num, int &den)
139139{
140    // search the greatest common divisor
141    int div = gcd(num, den);
140   // search the greatest common divisor
141   int div = gcd(num, den);
142142
143    // reduce the fraction if a common divisor has been found
144    if (div > 1)
145    {
146        num /= div;
147        den /= div;
148    }
143   // reduce the fraction if a common divisor has been found
144   if (div > 1)
145   {
146      num /= div;
147      den /= div;
148   }
149149}
150150
151151
r242631r242632
161161
162162static int get_variable_value(running_machine &machine, const char *string, char **outputptr)
163163{
164    char temp[100];
164   char temp[100];
165165
166    // screen 0 parameters
167    screen_device_iterator iter(machine.root_device());
168    int scrnum = 0;
169    for (const screen_device *device = iter.first(); device != NULL; device = iter.next(), scrnum++)
170    {
171        // native X aspect factor
172        sprintf(temp, "~scr%dnativexaspect~", scrnum);
173        if (!strncmp(string, temp, strlen(temp)))
174        {
175            int num = device->visible_area().width();
176            int den = device->visible_area().height();
177            reduce_fraction(num, den);
178            *outputptr += sprintf(*outputptr, "%d", num);
179            return strlen(temp);
180        }
166   // screen 0 parameters
167   screen_device_iterator iter(machine.root_device());
168   int scrnum = 0;
169   for (const screen_device *device = iter.first(); device != NULL; device = iter.next(), scrnum++)
170   {
171      // native X aspect factor
172      sprintf(temp, "~scr%dnativexaspect~", scrnum);
173      if (!strncmp(string, temp, strlen(temp)))
174      {
175         int num = device->visible_area().width();
176         int den = device->visible_area().height();
177         reduce_fraction(num, den);
178         *outputptr += sprintf(*outputptr, "%d", num);
179         return strlen(temp);
180      }
181181
182        // native Y aspect factor
183        sprintf(temp, "~scr%dnativeyaspect~", scrnum);
184        if (!strncmp(string, temp, strlen(temp)))
185        {
186            int num = device->visible_area().width();
187            int den = device->visible_area().height();
188            reduce_fraction(num, den);
189            *outputptr += sprintf(*outputptr, "%d", den);
190            return strlen(temp);
191        }
182      // native Y aspect factor
183      sprintf(temp, "~scr%dnativeyaspect~", scrnum);
184      if (!strncmp(string, temp, strlen(temp)))
185      {
186         int num = device->visible_area().width();
187         int den = device->visible_area().height();
188         reduce_fraction(num, den);
189         *outputptr += sprintf(*outputptr, "%d", den);
190         return strlen(temp);
191      }
192192
193        // native width
194        sprintf(temp, "~scr%dwidth~", scrnum);
195        if (!strncmp(string, temp, strlen(temp)))
196        {
197            *outputptr += sprintf(*outputptr, "%d", device->visible_area().width());
198            return strlen(temp);
199        }
193      // native width
194      sprintf(temp, "~scr%dwidth~", scrnum);
195      if (!strncmp(string, temp, strlen(temp)))
196      {
197         *outputptr += sprintf(*outputptr, "%d", device->visible_area().width());
198         return strlen(temp);
199      }
200200
201        // native height
202        sprintf(temp, "~scr%dheight~", scrnum);
203        if (!strncmp(string, temp, strlen(temp)))
204        {
205            *outputptr += sprintf(*outputptr, "%d", device->visible_area().height());
206            return strlen(temp);
207        }
208    }
201      // native height
202      sprintf(temp, "~scr%dheight~", scrnum);
203      if (!strncmp(string, temp, strlen(temp)))
204      {
205         *outputptr += sprintf(*outputptr, "%d", device->visible_area().height());
206         return strlen(temp);
207      }
208   }
209209
210    // default: copy the first character and continue
211    **outputptr = *string;
212    *outputptr += 1;
213    return 1;
210   // default: copy the first character and continue
211   **outputptr = *string;
212   *outputptr += 1;
213   return 1;
214214}
215215
216216
r242631r242632
222222
223223static const char *xml_get_attribute_string_with_subst(running_machine &machine, xml_data_node &node, const char *attribute, const char *defvalue)
224224{
225    const char *str = xml_get_attribute_string(&node, attribute, NULL);
226    static char buffer[1000];
225   const char *str = xml_get_attribute_string(&node, attribute, NULL);
226   static char buffer[1000];
227227
228    // if nothing, just return the default
229    if (str == NULL)
230        return defvalue;
228   // if nothing, just return the default
229   if (str == NULL)
230      return defvalue;
231231
232    // if no tildes, don't worry
233    if (strchr(str, '~') == NULL)
234        return str;
232   // if no tildes, don't worry
233   if (strchr(str, '~') == NULL)
234      return str;
235235
236    // make a copy of the string, doing substitutions along the way
237    const char *s;
238    char *d;
239    for (s = str, d = buffer; *s != 0; )
240    {
241        // if not a variable, just copy
242        if (*s != '~')
243            *d++ = *s++;
236   // make a copy of the string, doing substitutions along the way
237   const char *s;
238   char *d;
239   for (s = str, d = buffer; *s != 0; )
240   {
241      // if not a variable, just copy
242      if (*s != '~')
243         *d++ = *s++;
244244
245        // extract the variable
246        else
247            s += get_variable_value(machine, s, &d);
248    }
249    *d = 0;
250    return buffer;
245      // extract the variable
246      else
247         s += get_variable_value(machine, s, &d);
248   }
249   *d = 0;
250   return buffer;
251251}
252252
253253
r242631r242632
259259
260260static int xml_get_attribute_int_with_subst(running_machine &machine, xml_data_node &node, const char *attribute, int defvalue)
261261{
262    const char *string = xml_get_attribute_string_with_subst(machine, node, attribute, NULL);
263    int value;
262   const char *string = xml_get_attribute_string_with_subst(machine, node, attribute, NULL);
263   int value;
264264
265    if (string == NULL)
266        return defvalue;
267    if (string[0] == '$')
268        return (sscanf(&string[1], "%X", &value) == 1) ? value : defvalue;
269    if (string[0] == '0' && string[1] == 'x')
270        return (sscanf(&string[2], "%X", &value) == 1) ? value : defvalue;
271    if (string[0] == '#')
272        return (sscanf(&string[1], "%d", &value) == 1) ? value : defvalue;
273    return (sscanf(&string[0], "%d", &value) == 1) ? value : defvalue;
265   if (string == NULL)
266      return defvalue;
267   if (string[0] == '$')
268      return (sscanf(&string[1], "%X", &value) == 1) ? value : defvalue;
269   if (string[0] == '0' && string[1] == 'x')
270      return (sscanf(&string[2], "%X", &value) == 1) ? value : defvalue;
271   if (string[0] == '#')
272      return (sscanf(&string[1], "%d", &value) == 1) ? value : defvalue;
273   return (sscanf(&string[0], "%d", &value) == 1) ? value : defvalue;
274274}
275275
276276
r242631r242632
282282
283283static float xml_get_attribute_float_with_subst(running_machine &machine, xml_data_node &node, const char *attribute, float defvalue)
284284{
285    const char *string = xml_get_attribute_string_with_subst(machine, node, attribute, NULL);
286    float value;
285   const char *string = xml_get_attribute_string_with_subst(machine, node, attribute, NULL);
286   float value;
287287
288    if (string == NULL || sscanf(string, "%f", &value) != 1)
289        return defvalue;
290    return value;
288   if (string == NULL || sscanf(string, "%f", &value) != 1)
289      return defvalue;
290   return value;
291291}
292292
293293
r242631r242632
297297
298298void parse_bounds(running_machine &machine, xml_data_node *boundsnode, render_bounds &bounds)
299299{
300    // skip if nothing
301    if (boundsnode == NULL)
302    {
303        bounds.x0 = bounds.y0 = 0.0f;
304        bounds.x1 = bounds.y1 = 1.0f;
305        return;
306    }
300   // skip if nothing
301   if (boundsnode == NULL)
302   {
303      bounds.x0 = bounds.y0 = 0.0f;
304      bounds.x1 = bounds.y1 = 1.0f;
305      return;
306   }
307307
308    // parse out the data
309    if (xml_get_attribute(boundsnode, "left") != NULL)
310    {
311        // left/right/top/bottom format
312        bounds.x0 = xml_get_attribute_float_with_subst(machine, *boundsnode, "left", 0.0f);
313        bounds.x1 = xml_get_attribute_float_with_subst(machine, *boundsnode, "right", 1.0f);
314        bounds.y0 = xml_get_attribute_float_with_subst(machine, *boundsnode, "top", 0.0f);
315        bounds.y1 = xml_get_attribute_float_with_subst(machine, *boundsnode, "bottom", 1.0f);
316    }
317    else if (xml_get_attribute(boundsnode, "x") != NULL)
318    {
319        // x/y/width/height format
320        bounds.x0 = xml_get_attribute_float_with_subst(machine, *boundsnode, "x", 0.0f);
321        bounds.x1 = bounds.x0 + xml_get_attribute_float_with_subst(machine, *boundsnode, "width", 1.0f);
322        bounds.y0 = xml_get_attribute_float_with_subst(machine, *boundsnode, "y", 0.0f);
323        bounds.y1 = bounds.y0 + xml_get_attribute_float_with_subst(machine, *boundsnode, "height", 1.0f);
324    }
325    else
326        throw emu_fatalerror("Illegal bounds value in XML");
308   // parse out the data
309   if (xml_get_attribute(boundsnode, "left") != NULL)
310   {
311      // left/right/top/bottom format
312      bounds.x0 = xml_get_attribute_float_with_subst(machine, *boundsnode, "left", 0.0f);
313      bounds.x1 = xml_get_attribute_float_with_subst(machine, *boundsnode, "right", 1.0f);
314      bounds.y0 = xml_get_attribute_float_with_subst(machine, *boundsnode, "top", 0.0f);
315      bounds.y1 = xml_get_attribute_float_with_subst(machine, *boundsnode, "bottom", 1.0f);
316   }
317   else if (xml_get_attribute(boundsnode, "x") != NULL)
318   {
319      // x/y/width/height format
320      bounds.x0 = xml_get_attribute_float_with_subst(machine, *boundsnode, "x", 0.0f);
321      bounds.x1 = bounds.x0 + xml_get_attribute_float_with_subst(machine, *boundsnode, "width", 1.0f);
322      bounds.y0 = xml_get_attribute_float_with_subst(machine, *boundsnode, "y", 0.0f);
323      bounds.y1 = bounds.y0 + xml_get_attribute_float_with_subst(machine, *boundsnode, "height", 1.0f);
324   }
325   else
326      throw emu_fatalerror("Illegal bounds value in XML");
327327
328    // check for errors
329    if (bounds.x0 > bounds.x1 || bounds.y0 > bounds.y1)
330        throw emu_fatalerror("Illegal bounds value in XML: (%f-%f)-(%f-%f)", bounds.x0, bounds.x1, bounds.y0, bounds.y1);
328   // check for errors
329   if (bounds.x0 > bounds.x1 || bounds.y0 > bounds.y1)
330      throw emu_fatalerror("Illegal bounds value in XML: (%f-%f)-(%f-%f)", bounds.x0, bounds.x1, bounds.y0, bounds.y1);
331331}
332332
333333
r242631r242632
337337
338338void parse_color(running_machine &machine, xml_data_node *colornode, render_color &color)
339339{
340    // skip if nothing
341    if (colornode == NULL)
342    {
343        color.r = color.g = color.b = color.a = 1.0f;
344        return;
345    }
340   // skip if nothing
341   if (colornode == NULL)
342   {
343      color.r = color.g = color.b = color.a = 1.0f;
344      return;
345   }
346346
347    // parse out the data
348    color.r = xml_get_attribute_float_with_subst(machine, *colornode, "red", 1.0);
349    color.g = xml_get_attribute_float_with_subst(machine, *colornode, "green", 1.0);
350    color.b = xml_get_attribute_float_with_subst(machine, *colornode, "blue", 1.0);
351    color.a = xml_get_attribute_float_with_subst(machine, *colornode, "alpha", 1.0);
347   // parse out the data
348   color.r = xml_get_attribute_float_with_subst(machine, *colornode, "red", 1.0);
349   color.g = xml_get_attribute_float_with_subst(machine, *colornode, "green", 1.0);
350   color.b = xml_get_attribute_float_with_subst(machine, *colornode, "blue", 1.0);
351   color.a = xml_get_attribute_float_with_subst(machine, *colornode, "alpha", 1.0);
352352
353    // check for errors
354    if (color.r < 0.0 || color.r > 1.0 || color.g < 0.0 || color.g > 1.0 ||
355        color.b < 0.0 || color.b > 1.0 || color.a < 0.0 || color.a > 1.0)
356        throw emu_fatalerror("Illegal ARGB color value in XML: %f,%f,%f,%f", color.r, color.g, color.b, color.a);
353   // check for errors
354   if (color.r < 0.0 || color.r > 1.0 || color.g < 0.0 || color.g > 1.0 ||
355      color.b < 0.0 || color.b > 1.0 || color.a < 0.0 || color.a > 1.0)
356      throw emu_fatalerror("Illegal ARGB color value in XML: %f,%f,%f,%f", color.r, color.g, color.b, color.a);
357357}
358358
359359
r242631r242632
364364
365365static void parse_orientation(running_machine &machine, xml_data_node *orientnode, int &orientation)
366366{
367    // skip if nothing
368    if (orientnode == NULL)
369    {
370        orientation = ROT0;
371        return;
372    }
367   // skip if nothing
368   if (orientnode == NULL)
369   {
370      orientation = ROT0;
371      return;
372   }
373373
374    // parse out the data
375    int rotate = xml_get_attribute_int_with_subst(machine, *orientnode, "rotate", 0);
376    switch (rotate)
377    {
378        case 0:     orientation = ROT0;     break;
379        case 90:    orientation = ROT90;    break;
380        case 180:   orientation = ROT180;   break;
381        case 270:   orientation = ROT270;   break;
382        default:    throw emu_fatalerror("Invalid rotation in XML orientation node: %d", rotate);
383    }
384    if (strcmp("yes", xml_get_attribute_string_with_subst(machine, *orientnode, "swapxy", "no")) == 0)
385        orientation ^= ORIENTATION_SWAP_XY;
386    if (strcmp("yes", xml_get_attribute_string_with_subst(machine, *orientnode, "flipx", "no")) == 0)
387        orientation ^= ORIENTATION_FLIP_X;
388    if (strcmp("yes", xml_get_attribute_string_with_subst(machine, *orientnode, "flipy", "no")) == 0)
389        orientation ^= ORIENTATION_FLIP_Y;
374   // parse out the data
375   int rotate = xml_get_attribute_int_with_subst(machine, *orientnode, "rotate", 0);
376   switch (rotate)
377   {
378      case 0:     orientation = ROT0;     break;
379      case 90:    orientation = ROT90;    break;
380      case 180:   orientation = ROT180;   break;
381      case 270:   orientation = ROT270;   break;
382      default:    throw emu_fatalerror("Invalid rotation in XML orientation node: %d", rotate);
383   }
384   if (strcmp("yes", xml_get_attribute_string_with_subst(machine, *orientnode, "swapxy", "no")) == 0)
385      orientation ^= ORIENTATION_SWAP_XY;
386   if (strcmp("yes", xml_get_attribute_string_with_subst(machine, *orientnode, "flipx", "no")) == 0)
387      orientation ^= ORIENTATION_FLIP_X;
388   if (strcmp("yes", xml_get_attribute_string_with_subst(machine, *orientnode, "flipy", "no")) == 0)
389      orientation ^= ORIENTATION_FLIP_Y;
390390}
391391
392392
r242631r242632
400400//-------------------------------------------------
401401
402402layout_element::layout_element(running_machine &machine, xml_data_node &elemnode, const char *dirname)
403    : m_next(NULL),
404        m_machine(machine),
405        m_defstate(0),
406        m_maxstate(0)
403   : m_next(NULL),
404      m_machine(machine),
405      m_defstate(0),
406      m_maxstate(0)
407407{
408    // extract the name
409    const char *name = xml_get_attribute_string_with_subst(machine, elemnode, "name", NULL);
410    if (name == NULL)
411        throw emu_fatalerror("All layout elements must have a name!\n");
412    m_name = name;
408   // extract the name
409   const char *name = xml_get_attribute_string_with_subst(machine, elemnode, "name", NULL);
410   if (name == NULL)
411      throw emu_fatalerror("All layout elements must have a name!\n");
412   m_name = name;
413413
414    // get the default state
415    m_defstate = xml_get_attribute_int_with_subst(machine, elemnode, "defstate", -1);
414   // get the default state
415   m_defstate = xml_get_attribute_int_with_subst(machine, elemnode, "defstate", -1);
416416
417    // parse components in order
418    bool first = true;
419    render_bounds bounds = { 0 };
420    for (xml_data_node *compnode = elemnode.child; compnode != NULL; compnode = compnode->next)
421    {
422        // allocate a new component
423        component &newcomp = m_complist.append(*global_alloc(component(machine, *compnode, dirname)));
417   // parse components in order
418   bool first = true;
419   render_bounds bounds = { 0 };
420   for (xml_data_node *compnode = elemnode.child; compnode != NULL; compnode = compnode->next)
421   {
422      // allocate a new component
423      component &newcomp = m_complist.append(*global_alloc(component(machine, *compnode, dirname)));
424424
425        // accumulate bounds
426        if (first)
427            bounds = newcomp.m_bounds;
428        else
429            union_render_bounds(&bounds, &newcomp.m_bounds);
430        first = false;
425      // accumulate bounds
426      if (first)
427         bounds = newcomp.m_bounds;
428      else
429         union_render_bounds(&bounds, &newcomp.m_bounds);
430      first = false;
431431
432        // determine the maximum state
433        if (newcomp.m_state > m_maxstate)
434            m_maxstate = newcomp.m_state;
435        if (newcomp.m_type == component::CTYPE_LED7SEG || newcomp.m_type == component::CTYPE_LED8SEG_GTS1)
436            m_maxstate = 255;
437        if (newcomp.m_type == component::CTYPE_LED14SEG)
438            m_maxstate = 16383;
439        if (newcomp.m_type == component::CTYPE_LED14SEGSC || newcomp.m_type == component::CTYPE_LED16SEG)
440            m_maxstate = 65535;
441        if (newcomp.m_type == component::CTYPE_LED16SEGSC)
442            m_maxstate = 262143;
443        if (newcomp.m_type == component::CTYPE_DOTMATRIX)
444            m_maxstate = 255;
445        if (newcomp.m_type == component::CTYPE_DOTMATRIX5DOT)
446            m_maxstate = 31;
447        if (newcomp.m_type == component::CTYPE_DOTMATRIXDOT)
448            m_maxstate = 1;
449        if (newcomp.m_type == component::CTYPE_SIMPLECOUNTER)
450            m_maxstate = xml_get_attribute_int_with_subst(machine, *compnode, "maxstate", 999);
451        if (newcomp.m_type == component::CTYPE_REEL)
452            m_maxstate = 65536;
453    }
432      // determine the maximum state
433      if (newcomp.m_state > m_maxstate)
434         m_maxstate = newcomp.m_state;
435      if (newcomp.m_type == component::CTYPE_LED7SEG || newcomp.m_type == component::CTYPE_LED8SEG_GTS1)
436         m_maxstate = 255;
437      if (newcomp.m_type == component::CTYPE_LED14SEG)
438         m_maxstate = 16383;
439      if (newcomp.m_type == component::CTYPE_LED14SEGSC || newcomp.m_type == component::CTYPE_LED16SEG)
440         m_maxstate = 65535;
441      if (newcomp.m_type == component::CTYPE_LED16SEGSC)
442         m_maxstate = 262143;
443      if (newcomp.m_type == component::CTYPE_DOTMATRIX)
444         m_maxstate = 255;
445      if (newcomp.m_type == component::CTYPE_DOTMATRIX5DOT)
446         m_maxstate = 31;
447      if (newcomp.m_type == component::CTYPE_DOTMATRIXDOT)
448         m_maxstate = 1;
449      if (newcomp.m_type == component::CTYPE_SIMPLECOUNTER)
450         m_maxstate = xml_get_attribute_int_with_subst(machine, *compnode, "maxstate", 999);
451      if (newcomp.m_type == component::CTYPE_REEL)
452         m_maxstate = 65536;
453   }
454454
455    if (m_complist.first() != NULL)
456    {
457        // determine the scale/offset for normalization
458        float xoffs = bounds.x0;
459        float yoffs = bounds.y0;
460        float xscale = 1.0f / (bounds.x1 - bounds.x0);
461        float yscale = 1.0f / (bounds.y1 - bounds.y0);
455   if (m_complist.first() != NULL)
456   {
457      // determine the scale/offset for normalization
458      float xoffs = bounds.x0;
459      float yoffs = bounds.y0;
460      float xscale = 1.0f / (bounds.x1 - bounds.x0);
461      float yscale = 1.0f / (bounds.y1 - bounds.y0);
462462
463        // normalize all the component bounds
464        for (component *curcomp = m_complist.first(); curcomp != NULL; curcomp = curcomp->next())
465        {
466            curcomp->m_bounds.x0 = (curcomp->m_bounds.x0 - xoffs) * xscale;
467            curcomp->m_bounds.x1 = (curcomp->m_bounds.x1 - xoffs) * xscale;
468            curcomp->m_bounds.y0 = (curcomp->m_bounds.y0 - yoffs) * yscale;
469            curcomp->m_bounds.y1 = (curcomp->m_bounds.y1 - yoffs) * yscale;
470        }
471    }
463      // normalize all the component bounds
464      for (component *curcomp = m_complist.first(); curcomp != NULL; curcomp = curcomp->next())
465      {
466         curcomp->m_bounds.x0 = (curcomp->m_bounds.x0 - xoffs) * xscale;
467         curcomp->m_bounds.x1 = (curcomp->m_bounds.x1 - xoffs) * xscale;
468         curcomp->m_bounds.y0 = (curcomp->m_bounds.y0 - yoffs) * yscale;
469         curcomp->m_bounds.y1 = (curcomp->m_bounds.y1 - yoffs) * yscale;
470      }
471   }
472472
473    // allocate an array of element textures for the states
474    m_elemtex.resize(m_maxstate + 1);
473   // allocate an array of element textures for the states
474   m_elemtex.resize(m_maxstate + 1);
475475}
476476
477477
r242631r242632
492492
493493render_texture *layout_element::state_texture(int state)
494494{
495    assert(state <= m_maxstate);
496    if (m_elemtex[state].m_texture == NULL)
497    {
498        m_elemtex[state].m_element = this;
499        m_elemtex[state].m_state = state;
500        m_elemtex[state].m_texture = machine().render().texture_alloc(element_scale, &m_elemtex[state]);
501    }
502    return m_elemtex[state].m_texture;
495   assert(state <= m_maxstate);
496   if (m_elemtex[state].m_texture == NULL)
497   {
498      m_elemtex[state].m_element = this;
499      m_elemtex[state].m_state = state;
500      m_elemtex[state].m_texture = machine().render().texture_alloc(element_scale, &m_elemtex[state]);
501   }
502   return m_elemtex[state].m_texture;
503503}
504504
505505
r242631r242632
511511
512512void layout_element::element_scale(bitmap_argb32 &dest, bitmap_argb32 &source, const rectangle &sbounds, void *param)
513513{
514    texture *elemtex = (texture *)param;
514   texture *elemtex = (texture *)param;
515515
516    // iterate over components that are part of the current state
517    for (component *curcomp = elemtex->m_element->m_complist.first(); curcomp != NULL; curcomp = curcomp->next())
518        if (curcomp->m_state == -1 || curcomp->m_state == elemtex->m_state)
519        {
520            // get the local scaled bounds
521            rectangle bounds;
522            bounds.min_x = render_round_nearest(curcomp->bounds().x0 * dest.width());
523            bounds.min_y = render_round_nearest(curcomp->bounds().y0 * dest.height());
524            bounds.max_x = render_round_nearest(curcomp->bounds().x1 * dest.width());
525            bounds.max_y = render_round_nearest(curcomp->bounds().y1 * dest.height());
526            bounds &= dest.cliprect();
516   // iterate over components that are part of the current state
517   for (component *curcomp = elemtex->m_element->m_complist.first(); curcomp != NULL; curcomp = curcomp->next())
518      if (curcomp->m_state == -1 || curcomp->m_state == elemtex->m_state)
519      {
520         // get the local scaled bounds
521         rectangle bounds;
522         bounds.min_x = render_round_nearest(curcomp->bounds().x0 * dest.width());
523         bounds.min_y = render_round_nearest(curcomp->bounds().y0 * dest.height());
524         bounds.max_x = render_round_nearest(curcomp->bounds().x1 * dest.width());
525         bounds.max_y = render_round_nearest(curcomp->bounds().y1 * dest.height());
526         bounds &= dest.cliprect();
527527
528            // based on the component type, add to the texture
529            curcomp->draw(elemtex->m_element->machine(), dest, bounds, elemtex->m_state);
530        }
528         // based on the component type, add to the texture
529         curcomp->draw(elemtex->m_element->machine(), dest, bounds, elemtex->m_state);
530      }
531531}
532532
533533
r242631r242632
540540//-------------------------------------------------
541541
542542layout_element::texture::texture()
543    : m_element(NULL),
544        m_texture(NULL),
545        m_state(0)
543   : m_element(NULL),
544      m_texture(NULL),
545      m_state(0)
546546{
547547}
548548
r242631r242632
553553
554554layout_element::texture::~texture()
555555{
556    if (m_element != NULL)
557        m_element->machine().render().texture_free(m_texture);
556   if (m_element != NULL)
557      m_element->machine().render().texture_free(m_texture);
558558}
559559
560560
r242631r242632
568568//-------------------------------------------------
569569
570570layout_element::component::component(running_machine &machine, xml_data_node &compnode, const char *dirname)
571    : m_next(NULL),
572        m_type(CTYPE_INVALID),
573        m_state(0)
571   : m_next(NULL),
572      m_type(CTYPE_INVALID),
573      m_state(0)
574574{
575    for (int i=0;i<MAX_BITMAPS;i++)
576        m_hasalpha[i] = false;
575   for (int i=0;i<MAX_BITMAPS;i++)
576      m_hasalpha[i] = false;
577577
578    // fetch common data
579    m_state = xml_get_attribute_int_with_subst(machine, compnode, "state", -1);
580    parse_bounds(machine, xml_get_sibling(compnode.child, "bounds"), m_bounds);
581    parse_color(machine, xml_get_sibling(compnode.child, "color"), m_color);
578   // fetch common data
579   m_state = xml_get_attribute_int_with_subst(machine, compnode, "state", -1);
580   parse_bounds(machine, xml_get_sibling(compnode.child, "bounds"), m_bounds);
581   parse_color(machine, xml_get_sibling(compnode.child, "color"), m_color);
582582
583    // image nodes
584    if (strcmp(compnode.name, "image") == 0)
585    {
586        m_type = CTYPE_IMAGE;
587        if (dirname != NULL)
588            m_dirname = dirname;
589        m_imagefile[0] = xml_get_attribute_string_with_subst(machine, compnode, "file", "");
590        m_alphafile[0] = xml_get_attribute_string_with_subst(machine, compnode, "alphafile", "");
591        m_file[0].reset(global_alloc(emu_file(machine.options().art_path(), OPEN_FLAG_READ)));
592    }
583   // image nodes
584   if (strcmp(compnode.name, "image") == 0)
585   {
586      m_type = CTYPE_IMAGE;
587      if (dirname != NULL)
588         m_dirname = dirname;
589      m_imagefile[0] = xml_get_attribute_string_with_subst(machine, compnode, "file", "");
590      m_alphafile[0] = xml_get_attribute_string_with_subst(machine, compnode, "alphafile", "");
591      m_file[0].reset(global_alloc(emu_file(machine.options().art_path(), OPEN_FLAG_READ)));
592   }
593593
594    // text nodes
595    else if (strcmp(compnode.name, "text") == 0)
596    {
597        m_type = CTYPE_TEXT;
598        m_string = xml_get_attribute_string_with_subst(machine, compnode, "string", "");
599        m_textalign = xml_get_attribute_int_with_subst(machine, compnode, "align", 0);
600    }
594   // text nodes
595   else if (strcmp(compnode.name, "text") == 0)
596   {
597      m_type = CTYPE_TEXT;
598      m_string = xml_get_attribute_string_with_subst(machine, compnode, "string", "");
599      m_textalign = xml_get_attribute_int_with_subst(machine, compnode, "align", 0);
600   }
601601
602    // dotmatrix nodes
603    else if (strcmp(compnode.name, "dotmatrix") == 0)
604    {
605        m_type = CTYPE_DOTMATRIX;
606    }
607    else if (strcmp(compnode.name, "dotmatrix5dot") == 0)
608    {
609        m_type = CTYPE_DOTMATRIX5DOT;
610    }
611    else if (strcmp(compnode.name, "dotmatrixdot") == 0)
612    {
613        m_type = CTYPE_DOTMATRIXDOT;
614    }
602   // dotmatrix nodes
603   else if (strcmp(compnode.name, "dotmatrix") == 0)
604   {
605      m_type = CTYPE_DOTMATRIX;
606   }
607   else if (strcmp(compnode.name, "dotmatrix5dot") == 0)
608   {
609      m_type = CTYPE_DOTMATRIX5DOT;
610   }
611   else if (strcmp(compnode.name, "dotmatrixdot") == 0)
612   {
613      m_type = CTYPE_DOTMATRIXDOT;
614   }
615615
616    // simplecounter nodes
617    else if (strcmp(compnode.name, "simplecounter") == 0)
618    {
619        m_type = CTYPE_SIMPLECOUNTER;
620        m_digits = xml_get_attribute_int_with_subst(machine, compnode, "digits", 2);
621        m_textalign = xml_get_attribute_int_with_subst(machine, compnode, "align", 0);
622    }
616   // simplecounter nodes
617   else if (strcmp(compnode.name, "simplecounter") == 0)
618   {
619      m_type = CTYPE_SIMPLECOUNTER;
620      m_digits = xml_get_attribute_int_with_subst(machine, compnode, "digits", 2);
621      m_textalign = xml_get_attribute_int_with_subst(machine, compnode, "align", 0);
622   }
623623
624    // fruit machine reels
625    else if (strcmp(compnode.name, "reel") == 0)
626    {
627        m_type = CTYPE_REEL;
624   // fruit machine reels
625   else if (strcmp(compnode.name, "reel") == 0)
626   {
627      m_type = CTYPE_REEL;
628628
629        astring symbollist = xml_get_attribute_string_with_subst(machine, compnode, "symbollist", "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15");
629      astring symbollist = xml_get_attribute_string_with_subst(machine, compnode, "symbollist", "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15");
630630
631        // split out position names from string and figure out our number of symbols
632        int location = -1;
633        m_numstops = 0;
634        location=symbollist.find(0,",");
635        while (location!=-1)
636        {
637            m_stopnames[m_numstops] = symbollist;
638            m_stopnames[m_numstops].substr(0, location);
639            symbollist.substr(location+1, symbollist.len()-(location-1));
640            m_numstops++;
641            location=symbollist.find(0,",");
642        }
643        m_stopnames[m_numstops++] = symbollist;
631      // split out position names from string and figure out our number of symbols
632      int location = -1;
633      m_numstops = 0;
634      location=symbollist.find(0,",");
635      while (location!=-1)
636      {
637         m_stopnames[m_numstops] = symbollist;
638         m_stopnames[m_numstops].substr(0, location);
639         symbollist.substr(location+1, symbollist.len()-(location-1));
640         m_numstops++;
641         location=symbollist.find(0,",");
642      }
643      m_stopnames[m_numstops++] = symbollist;
644644
645        // careful, dirname is NULL if we're coming from internal layout, and our string assignment doesn't like that
646        if (dirname != NULL)
647            m_dirname = dirname;
645      // careful, dirname is NULL if we're coming from internal layout, and our string assignment doesn't like that
646      if (dirname != NULL)
647         m_dirname = dirname;
648648
649        for (int i=0;i<m_numstops;i++)
650        {
651            location=m_stopnames[i].find(0,":");
652            if (location!=-1)
653            {
654                m_imagefile[i] = m_stopnames[i];
655                m_stopnames[i].substr(0, location);
656                m_imagefile[i].substr(location+1, m_imagefile[i].len()-(location-1));
649      for (int i=0;i<m_numstops;i++)
650      {
651         location=m_stopnames[i].find(0,":");
652         if (location!=-1)
653         {
654            m_imagefile[i] = m_stopnames[i];
655            m_stopnames[i].substr(0, location);
656            m_imagefile[i].substr(location+1, m_imagefile[i].len()-(location-1));
657657
658                //m_alphafile[i] =
659                m_file[i].reset(global_alloc(emu_file(machine.options().art_path(), OPEN_FLAG_READ)));
660            }
661            else
662            {
663                //m_imagefile[i] = 0;
664                //m_alphafile[i] = 0;
665                m_file[i].reset();
666            }
667        }
658            //m_alphafile[i] =
659            m_file[i].reset(global_alloc(emu_file(machine.options().art_path(), OPEN_FLAG_READ)));
660         }
661         else
662         {
663            //m_imagefile[i] = 0;
664            //m_alphafile[i] = 0;
665            m_file[i].reset();
666         }
667      }
668668
669        m_stateoffset = xml_get_attribute_int_with_subst(machine, compnode, "stateoffset", 0);
670        m_numsymbolsvisible = xml_get_attribute_int_with_subst(machine, compnode, "numsymbolsvisible", 3);
671        m_reelreversed = xml_get_attribute_int_with_subst(machine, compnode, "reelreversed", 0);
672        m_beltreel = xml_get_attribute_int_with_subst(machine, compnode, "beltreel", 0);
669      m_stateoffset = xml_get_attribute_int_with_subst(machine, compnode, "stateoffset", 0);
670      m_numsymbolsvisible = xml_get_attribute_int_with_subst(machine, compnode, "numsymbolsvisible", 3);
671      m_reelreversed = xml_get_attribute_int_with_subst(machine, compnode, "reelreversed", 0);
672      m_beltreel = xml_get_attribute_int_with_subst(machine, compnode, "beltreel", 0);
673673
674    }
674   }
675675
676    // led7seg nodes
677    else if (strcmp(compnode.name, "led7seg") == 0)
678        m_type = CTYPE_LED7SEG;
676   // led7seg nodes
677   else if (strcmp(compnode.name, "led7seg") == 0)
678      m_type = CTYPE_LED7SEG;
679679
680    // led8seg_gts1 nodes
681    else if (strcmp(compnode.name, "led8seg_gts1") == 0)
682        m_type = CTYPE_LED8SEG_GTS1;
680   // led8seg_gts1 nodes
681   else if (strcmp(compnode.name, "led8seg_gts1") == 0)
682      m_type = CTYPE_LED8SEG_GTS1;
683683
684    // led14seg nodes
685    else if (strcmp(compnode.name, "led14seg") == 0)
686        m_type = CTYPE_LED14SEG;
684   // led14seg nodes
685   else if (strcmp(compnode.name, "led14seg") == 0)
686      m_type = CTYPE_LED14SEG;
687687
688    // led14segsc nodes
689    else if (strcmp(compnode.name, "led14segsc") == 0)
690        m_type = CTYPE_LED14SEGSC;
688   // led14segsc nodes
689   else if (strcmp(compnode.name, "led14segsc") == 0)
690      m_type = CTYPE_LED14SEGSC;
691691
692    // led16seg nodes
693    else if (strcmp(compnode.name, "led16seg") == 0)
694        m_type = CTYPE_LED16SEG;
692   // led16seg nodes
693   else if (strcmp(compnode.name, "led16seg") == 0)
694      m_type = CTYPE_LED16SEG;
695695
696    // led16segsc nodes
697    else if (strcmp(compnode.name, "led16segsc") == 0)
698        m_type = CTYPE_LED16SEGSC;
696   // led16segsc nodes
697   else if (strcmp(compnode.name, "led16segsc") == 0)
698      m_type = CTYPE_LED16SEGSC;
699699
700    // rect nodes
701    else if (strcmp(compnode.name, "rect") == 0)
702        m_type = CTYPE_RECT;
700   // rect nodes
701   else if (strcmp(compnode.name, "rect") == 0)
702      m_type = CTYPE_RECT;
703703
704    // disk nodes
705    else if (strcmp(compnode.name, "disk") == 0)
706        m_type = CTYPE_DISK;
704   // disk nodes
705   else if (strcmp(compnode.name, "disk") == 0)
706      m_type = CTYPE_DISK;
707707
708    // error otherwise
709    else
710        throw emu_fatalerror("Unknown element component: %s", compnode.name);
708   // error otherwise
709   else
710      throw emu_fatalerror("Unknown element component: %s", compnode.name);
711711}
712712
713713
r242631r242632
726726
727727void layout_element::component::draw(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state)
728728{
729    switch (m_type)
730    {
731        case CTYPE_IMAGE:
732            if (!m_bitmap[0].valid())
733                load_bitmap();
734            {
735                bitmap_argb32 destsub(dest, bounds);
736                render_resample_argb_bitmap_hq(destsub, m_bitmap[0], m_color);
737            }
738            break;
729   switch (m_type)
730   {
731      case CTYPE_IMAGE:
732         if (!m_bitmap[0].valid())
733            load_bitmap();
734         {
735            bitmap_argb32 destsub(dest, bounds);
736            render_resample_argb_bitmap_hq(destsub, m_bitmap[0], m_color);
737         }
738         break;
739739
740        case CTYPE_RECT:
741            draw_rect(dest, bounds);
742            break;
740      case CTYPE_RECT:
741         draw_rect(dest, bounds);
742         break;
743743
744        case CTYPE_DISK:
745            draw_disk(dest, bounds);
746            break;
744      case CTYPE_DISK:
745         draw_disk(dest, bounds);
746         break;
747747
748        case CTYPE_TEXT:
749            draw_text(machine, dest, bounds);
750            break;
748      case CTYPE_TEXT:
749         draw_text(machine, dest, bounds);
750         break;
751751
752        case CTYPE_LED7SEG:
753            draw_led7seg(dest, bounds, state);
754            break;
752      case CTYPE_LED7SEG:
753         draw_led7seg(dest, bounds, state);
754         break;
755755
756        case CTYPE_LED8SEG_GTS1:
757            draw_led8seg_gts1(dest, bounds, state);
758            break;
756      case CTYPE_LED8SEG_GTS1:
757         draw_led8seg_gts1(dest, bounds, state);
758         break;
759759
760        case CTYPE_LED14SEG:
761            draw_led14seg(dest, bounds, state);
762            break;
760      case CTYPE_LED14SEG:
761         draw_led14seg(dest, bounds, state);
762         break;
763763
764        case CTYPE_LED16SEG:
765            draw_led16seg(dest, bounds, state);
766            break;
764      case CTYPE_LED16SEG:
765         draw_led16seg(dest, bounds, state);
766         break;
767767
768        case CTYPE_LED14SEGSC:
769            draw_led14segsc(dest, bounds, state);
770            break;
768      case CTYPE_LED14SEGSC:
769         draw_led14segsc(dest, bounds, state);
770         break;
771771
772        case CTYPE_LED16SEGSC:
773            draw_led16segsc(dest, bounds, state);
774            break;
772      case CTYPE_LED16SEGSC:
773         draw_led16segsc(dest, bounds, state);
774         break;
775775
776        case CTYPE_DOTMATRIX:
777            draw_dotmatrix(8, dest, bounds, state);
778            break;
776      case CTYPE_DOTMATRIX:
777         draw_dotmatrix(8, dest, bounds, state);
778         break;
779779
780        case CTYPE_DOTMATRIX5DOT:
781            draw_dotmatrix(5, dest, bounds, state);
782            break;
780      case CTYPE_DOTMATRIX5DOT:
781         draw_dotmatrix(5, dest, bounds, state);
782         break;
783783
784        case CTYPE_DOTMATRIXDOT:
785            draw_dotmatrix(1, dest, bounds, state);
786            break;
784      case CTYPE_DOTMATRIXDOT:
785         draw_dotmatrix(1, dest, bounds, state);
786         break;
787787
788        case CTYPE_SIMPLECOUNTER:
789            draw_simplecounter(machine, dest, bounds, state);
790            break;
788      case CTYPE_SIMPLECOUNTER:
789         draw_simplecounter(machine, dest, bounds, state);
790         break;
791791
792        case CTYPE_REEL:
793            draw_reel(machine, dest, bounds, state);
794            break;
792      case CTYPE_REEL:
793         draw_reel(machine, dest, bounds, state);
794         break;
795795
796        default:
797            throw emu_fatalerror("Unknown component type requested draw()");
798    }
796      default:
797         throw emu_fatalerror("Unknown component type requested draw()");
798   }
799799}
800800
801801
r242631r242632
806806
807807void layout_element::component::draw_rect(bitmap_argb32 &dest, const rectangle &bounds)
808808{
809    // compute premultiplied colors
810    UINT32 r = m_color.r * m_color.a * 255.0;
811    UINT32 g = m_color.g * m_color.a * 255.0;
812    UINT32 b = m_color.b * m_color.a * 255.0;
813    UINT32 inva = (1.0f - m_color.a) * 255.0;
809   // compute premultiplied colors
810   UINT32 r = m_color.r * m_color.a * 255.0;
811   UINT32 g = m_color.g * m_color.a * 255.0;
812   UINT32 b = m_color.b * m_color.a * 255.0;
813   UINT32 inva = (1.0f - m_color.a) * 255.0;
814814
815    // iterate over X and Y
816    for (UINT32 y = bounds.min_y; y <= bounds.max_y; y++)
817    {
818        for (UINT32 x = bounds.min_x; x <= bounds.max_x; x++)
819        {
820            UINT32 finalr = r;
821            UINT32 finalg = g;
822            UINT32 finalb = b;
815   // iterate over X and Y
816   for (UINT32 y = bounds.min_y; y <= bounds.max_y; y++)
817   {
818      for (UINT32 x = bounds.min_x; x <= bounds.max_x; x++)
819      {
820         UINT32 finalr = r;
821         UINT32 finalg = g;
822         UINT32 finalb = b;
823823
824            // if we're translucent, add in the destination pixel contribution
825            if (inva > 0)
826            {
827                rgb_t dpix = dest.pix32(y, x);
828                finalr += (dpix.r() * inva) >> 8;
829                finalg += (dpix.g() * inva) >> 8;
830                finalb += (dpix.b() * inva) >> 8;
831            }
824         // if we're translucent, add in the destination pixel contribution
825         if (inva > 0)
826         {
827            rgb_t dpix = dest.pix32(y, x);
828            finalr += (dpix.r() * inva) >> 8;
829            finalg += (dpix.g() * inva) >> 8;
830            finalb += (dpix.b() * inva) >> 8;
831         }
832832
833            // store the target pixel, dividing the RGBA values by the overall scale factor
834            dest.pix32(y, x) = rgb_t(finalr, finalg, finalb);
835        }
836    }
833         // store the target pixel, dividing the RGBA values by the overall scale factor
834         dest.pix32(y, x) = rgb_t(finalr, finalg, finalb);
835      }
836   }
837837}
838838
839839
r242631r242632
844844
845845void layout_element::component::draw_disk(bitmap_argb32 &dest, const rectangle &bounds)
846846{
847    // compute premultiplied colors
848    UINT32 r = m_color.r * m_color.a * 255.0;
849    UINT32 g = m_color.g * m_color.a * 255.0;
850    UINT32 b = m_color.b * m_color.a * 255.0;
851    UINT32 inva = (1.0f - m_color.a) * 255.0;
847   // compute premultiplied colors
848   UINT32 r = m_color.r * m_color.a * 255.0;
849   UINT32 g = m_color.g * m_color.a * 255.0;
850   UINT32 b = m_color.b * m_color.a * 255.0;
851   UINT32 inva = (1.0f - m_color.a) * 255.0;
852852
853    // find the center
854    float xcenter = float(bounds.xcenter());
855    float ycenter = float(bounds.ycenter());
856    float xradius = float(bounds.width()) * 0.5f;
857    float yradius = float(bounds.height()) * 0.5f;
858    float ooyradius2 = 1.0f / (yradius * yradius);
853   // find the center
854   float xcenter = float(bounds.xcenter());
855   float ycenter = float(bounds.ycenter());
856   float xradius = float(bounds.width()) * 0.5f;
857   float yradius = float(bounds.height()) * 0.5f;
858   float ooyradius2 = 1.0f / (yradius * yradius);
859859
860    // iterate over y
861    for (UINT32 y = bounds.min_y; y <= bounds.max_y; y++)
862    {
863        float ycoord = ycenter - ((float)y + 0.5f);
864        float xval = xradius * sqrt(1.0f - (ycoord * ycoord) * ooyradius2);
860   // iterate over y
861   for (UINT32 y = bounds.min_y; y <= bounds.max_y; y++)
862   {
863      float ycoord = ycenter - ((float)y + 0.5f);
864      float xval = xradius * sqrt(1.0f - (ycoord * ycoord) * ooyradius2);
865865
866        // compute left/right coordinates
867        INT32 left = (INT32)(xcenter - xval + 0.5f);
868        INT32 right = (INT32)(xcenter + xval + 0.5f);
866      // compute left/right coordinates
867      INT32 left = (INT32)(xcenter - xval + 0.5f);
868      INT32 right = (INT32)(xcenter + xval + 0.5f);
869869
870        // draw this scanline
871        for (UINT32 x = left; x < right; x++)
872        {
873            UINT32 finalr = r;
874            UINT32 finalg = g;
875            UINT32 finalb = b;
870      // draw this scanline
871      for (UINT32 x = left; x < right; x++)
872      {
873         UINT32 finalr = r;
874         UINT32 finalg = g;
875         UINT32 finalb = b;
876876
877            // if we're translucent, add in the destination pixel contribution
878            if (inva > 0)
879            {
880                rgb_t dpix = dest.pix32(y, x);
881                finalr += (dpix.r() * inva) >> 8;
882                finalg += (dpix.g() * inva) >> 8;
883                finalb += (dpix.b() * inva) >> 8;
884            }
877         // if we're translucent, add in the destination pixel contribution
878         if (inva > 0)
879         {
880            rgb_t dpix = dest.pix32(y, x);
881            finalr += (dpix.r() * inva) >> 8;
882            finalg += (dpix.g() * inva) >> 8;
883            finalb += (dpix.b() * inva) >> 8;
884         }
885885
886            // store the target pixel, dividing the RGBA values by the overall scale factor
887            dest.pix32(y, x) = rgb_t(finalr, finalg, finalb);
888        }
889    }
886         // store the target pixel, dividing the RGBA values by the overall scale factor
887         dest.pix32(y, x) = rgb_t(finalr, finalg, finalb);
888      }
889   }
890890}
891891
892892
r242631r242632
896896
897897void layout_element::component::draw_text(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds)
898898{
899    // compute premultiplied colors
900    UINT32 r = m_color.r * 255.0;
901    UINT32 g = m_color.g * 255.0;
902    UINT32 b = m_color.b * 255.0;
903    UINT32 a = m_color.a * 255.0;
899   // compute premultiplied colors
900   UINT32 r = m_color.r * 255.0;
901   UINT32 g = m_color.g * 255.0;
902   UINT32 b = m_color.b * 255.0;
903   UINT32 a = m_color.a * 255.0;
904904
905    // get the width of the string
906    render_font *font = machine.render().font_alloc("default");
907    float aspect = 1.0f;
908    INT32 width;
905   // get the width of the string
906   render_font *font = machine.render().font_alloc("default");
907   float aspect = 1.0f;
908   INT32 width;
909909
910910
911    while (1)
912    {
913        width = font->string_width(bounds.height(), aspect, m_string);
914        if (width < bounds.width())
915            break;
916        aspect *= 0.9f;
917    }
911   while (1)
912   {
913      width = font->string_width(bounds.height(), aspect, m_string);
914      if (width < bounds.width())
915         break;
916      aspect *= 0.9f;
917   }
918918
919919
920    // get alignment
921    INT32 curx;
922    switch (m_textalign)
923    {
924        // left
925        case 1:
926            curx = bounds.min_x;
927            break;
920   // get alignment
921   INT32 curx;
922   switch (m_textalign)
923   {
924      // left
925      case 1:
926         curx = bounds.min_x;
927         break;
928928
929        // right
930        case 2:
931            curx = bounds.max_x - width;
932            break;
929      // right
930      case 2:
931         curx = bounds.max_x - width;
932         break;
933933
934        // default to center
935        default:
936            curx = bounds.min_x + (bounds.width() - width) / 2;
937            break;
938    }
934      // default to center
935      default:
936         curx = bounds.min_x + (bounds.width() - width) / 2;
937         break;
938   }
939939
940    // allocate a temporary bitmap
941    bitmap_argb32 tempbitmap(dest.width(), dest.height());
940   // allocate a temporary bitmap
941   bitmap_argb32 tempbitmap(dest.width(), dest.height());
942942
943    // loop over characters
944    for (const char *s = m_string; *s != 0; s++)
945    {
946        // get the font bitmap
947        rectangle chbounds;
948        font->get_scaled_bitmap_and_bounds(tempbitmap, bounds.height(), aspect, *s, chbounds);
943   // loop over characters
944   for (const char *s = m_string; *s != 0; s++)
945   {
946      // get the font bitmap
947      rectangle chbounds;
948      font->get_scaled_bitmap_and_bounds(tempbitmap, bounds.height(), aspect, *s, chbounds);
949949
950        // copy the data into the target
951        for (int y = 0; y < chbounds.height(); y++)
952        {
953            int effy = bounds.min_y + y;
954            if (effy >= bounds.min_y && effy <= bounds.max_y)
955            {
956                UINT32 *src = &tempbitmap.pix32(y);
957                UINT32 *d = &dest.pix32(effy);
958                for (int x = 0; x < chbounds.width(); x++)
959                {
960                    int effx = curx + x + chbounds.min_x;
961                    if (effx >= bounds.min_x && effx <= bounds.max_x)
962                    {
963                        UINT32 spix = rgb_t(src[x]).a();
964                        if (spix != 0)
965                        {
966                            rgb_t dpix = d[effx];
967                            UINT32 ta = (a * (spix + 1)) >> 8;
968                            UINT32 tr = (r * ta + dpix.r() * (0x100 - ta)) >> 8;
969                            UINT32 tg = (g * ta + dpix.g() * (0x100 - ta)) >> 8;
970                            UINT32 tb = (b * ta + dpix.b() * (0x100 - ta)) >> 8;
971                            d[effx] = rgb_t(tr, tg, tb);
972                        }
973                    }
974                }
975            }
976        }
950      // copy the data into the target
951      for (int y = 0; y < chbounds.height(); y++)
952      {
953         int effy = bounds.min_y + y;
954         if (effy >= bounds.min_y && effy <= bounds.max_y)
955         {
956            UINT32 *src = &tempbitmap.pix32(y);
957            UINT32 *d = &dest.pix32(effy);
958            for (int x = 0; x < chbounds.width(); x++)
959            {
960               int effx = curx + x + chbounds.min_x;
961               if (effx >= bounds.min_x && effx <= bounds.max_x)
962               {
963                  UINT32 spix = rgb_t(src[x]).a();
964                  if (spix != 0)
965                  {
966                     rgb_t dpix = d[effx];
967                     UINT32 ta = (a * (spix + 1)) >> 8;
968                     UINT32 tr = (r * ta + dpix.r() * (0x100 - ta)) >> 8;
969                     UINT32 tg = (g * ta + dpix.g() * (0x100 - ta)) >> 8;
970                     UINT32 tb = (b * ta + dpix.b() * (0x100 - ta)) >> 8;
971                     d[effx] = rgb_t(tr, tg, tb);
972                  }
973               }
974            }
975         }
976      }
977977
978        // advance in the X direction
979        curx += font->char_width(bounds.height(), aspect, *s);
980    }
978      // advance in the X direction
979      curx += font->char_width(bounds.height(), aspect, *s);
980   }
981981
982    // free the temporary bitmap and font
983    machine.render().font_free(font);
982   // free the temporary bitmap and font
983   machine.render().font_free(font);
984984}
985985
986986void layout_element::component::draw_simplecounter(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state)
987987{
988    char temp[256];
989    sprintf(temp, "%0*d", m_digits, state);
990    m_string = astring(temp);
991    draw_text(machine, dest, bounds);
988   char temp[256];
989   sprintf(temp, "%0*d", m_digits, state);
990   m_string = astring(temp);
991   draw_text(machine, dest, bounds);
992992}
993993
994994/* state is a normalized value between 0 and 65536 so that we don't need to worry about how many motor steps here or in the .lay, only the number of symbols */
995995void layout_element::component::draw_reel(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state)
996996{
997    if (m_beltreel)
998    {
999        draw_beltreel(machine,dest,bounds,state);
1000    }
1001    else
1002    {
1003        const int max_state_used = 0x10000;
997   if (m_beltreel)
998   {
999      draw_beltreel(machine,dest,bounds,state);
1000   }
1001   else
1002   {
1003      const int max_state_used = 0x10000;
10041004
1005        // shift the reels a bit based on this param, allows fine tuning
1006        int use_state = (state + m_stateoffset) % max_state_used;
1005      // shift the reels a bit based on this param, allows fine tuning
1006      int use_state = (state + m_stateoffset) % max_state_used;
10071007
1008        // compute premultiplied colors
1009        UINT32 r = m_color.r * 255.0;
1010        UINT32 g = m_color.g * 255.0;
1011        UINT32 b = m_color.b * 255.0;
1012        UINT32 a = m_color.a * 255.0;
1008      // compute premultiplied colors
1009      UINT32 r = m_color.r * 255.0;
1010      UINT32 g = m_color.g * 255.0;
1011      UINT32 b = m_color.b * 255.0;
1012      UINT32 a = m_color.a * 255.0;
10131013
1014        // get the width of the string
1015        render_font *font = machine.render().font_alloc("default");
1016        float aspect = 1.0f;
1017        INT32 width;
1014      // get the width of the string
1015      render_font *font = machine.render().font_alloc("default");
1016      float aspect = 1.0f;
1017      INT32 width;
10181018
10191019
1020        int curry = 0;
1021        int num_shown = m_numsymbolsvisible;
1020      int curry = 0;
1021      int num_shown = m_numsymbolsvisible;
10221022
1023        int ourheight = bounds.height();
1023      int ourheight = bounds.height();
10241024
1025        for (int fruit = 0;fruit<m_numstops;fruit++)
1026        {
1027            int basey;
1025      for (int fruit = 0;fruit<m_numstops;fruit++)
1026      {
1027         int basey;
10281028
1029            if (m_reelreversed==1)
1030            {
1031                basey = bounds.min_y + ((use_state)*(ourheight/num_shown)/(max_state_used/m_numstops)) + curry;
1032            }
1033            else
1034            {
1035                basey = bounds.min_y - ((use_state)*(ourheight/num_shown)/(max_state_used/m_numstops)) + curry;
1036            }
1029         if (m_reelreversed==1)
1030         {
1031            basey = bounds.min_y + ((use_state)*(ourheight/num_shown)/(max_state_used/m_numstops)) + curry;
1032         }
1033         else
1034         {
1035            basey = bounds.min_y - ((use_state)*(ourheight/num_shown)/(max_state_used/m_numstops)) + curry;
1036         }
10371037
1038            // wrap around...
1039            if (basey < bounds.min_y)
1040                basey += ((max_state_used)*(ourheight/num_shown)/(max_state_used/m_numstops));
1041            if (basey > bounds.max_y)
1042                basey -= ((max_state_used)*(ourheight/num_shown)/(max_state_used/m_numstops));
1038         // wrap around...
1039         if (basey < bounds.min_y)
1040            basey += ((max_state_used)*(ourheight/num_shown)/(max_state_used/m_numstops));
1041         if (basey > bounds.max_y)
1042            basey -= ((max_state_used)*(ourheight/num_shown)/(max_state_used/m_numstops));
10431043
1044            int endpos = basey+ourheight/num_shown;
1044         int endpos = basey+ourheight/num_shown;
10451045
1046            // only render the symbol / text if it's atually in view because the code is SLOW
1047            if ((endpos >= bounds.min_y) && (basey <= bounds.max_y))
1048            {
1049                while (1)
1050                {
1051                    width = font->string_width(ourheight/num_shown, aspect, m_stopnames[fruit]);
1052                    if (width < bounds.width())
1053                        break;
1054                    aspect *= 0.9f;
1055                }
1046         // only render the symbol / text if it's atually in view because the code is SLOW
1047         if ((endpos >= bounds.min_y) && (basey <= bounds.max_y))
1048         {
1049            while (1)
1050            {
1051               width = font->string_width(ourheight/num_shown, aspect, m_stopnames[fruit]);
1052               if (width < bounds.width())
1053                  break;
1054               aspect *= 0.9f;
1055            }
10561056
1057                INT32 curx;
1058                curx = bounds.min_x + (bounds.width() - width) / 2;
1057            INT32 curx;
1058            curx = bounds.min_x + (bounds.width() - width) / 2;
10591059
1060                if (m_file[fruit])
1061                    if (!m_bitmap[fruit].valid())
1062                        load_reel_bitmap(fruit);
1060            if (m_file[fruit])
1061               if (!m_bitmap[fruit].valid())
1062                  load_reel_bitmap(fruit);
10631063
1064                if (m_file[fruit]) // render gfx
1065                {
1066                    bitmap_argb32 tempbitmap2(dest.width(), ourheight/num_shown);
1064            if (m_file[fruit]) // render gfx
1065            {
1066               bitmap_argb32 tempbitmap2(dest.width(), ourheight/num_shown);
10671067
1068                    if (m_bitmap[fruit].valid())
1069                    {
1070                        render_resample_argb_bitmap_hq(tempbitmap2, m_bitmap[fruit], m_color);
1068               if (m_bitmap[fruit].valid())
1069               {
1070                  render_resample_argb_bitmap_hq(tempbitmap2, m_bitmap[fruit], m_color);
10711071
1072                        for (int y = 0; y < ourheight/num_shown; y++)
1073                        {
1074                            int effy = basey + y;
1072                  for (int y = 0; y < ourheight/num_shown; y++)
1073                  {
1074                     int effy = basey + y;
10751075
1076                            if (effy >= bounds.min_y && effy <= bounds.max_y)
1077                            {
1078                                UINT32 *src = &tempbitmap2.pix32(y);
1079                                UINT32 *d = &dest.pix32(effy);
1080                                for (int x = 0; x < dest.width(); x++)
1081                                {
1082                                    int effx = x;
1083                                    if (effx >= bounds.min_x && effx <= bounds.max_x)
1084                                    {
1085                                        UINT32 spix = rgb_t(src[x]).a();
1086                                        if (spix != 0)
1087                                        {
1088                                            d[effx] = src[x];
1089                                        }
1090                                    }
1091                                }
1092                            }
1076                     if (effy >= bounds.min_y && effy <= bounds.max_y)
1077                     {
1078                        UINT32 *src = &tempbitmap2.pix32(y);
1079                        UINT32 *d = &dest.pix32(effy);
1080                        for (int x = 0; x < dest.width(); x++)
1081                        {
1082                           int effx = x;
1083                           if (effx >= bounds.min_x && effx <= bounds.max_x)
1084                           {
1085                              UINT32 spix = rgb_t(src[x]).a();
1086                              if (spix != 0)
1087                              {
1088                                 d[effx] = src[x];
1089                              }
1090                           }
1091                        }
1092                     }
10931093
1094                        }
1095                    }
1096                }
1097                else // render text (fallback)
1098                {
1099                    // allocate a temporary bitmap
1100                    bitmap_argb32 tempbitmap(dest.width(), dest.height());
1094                  }
1095               }
1096            }
1097            else // render text (fallback)
1098            {
1099               // allocate a temporary bitmap
1100               bitmap_argb32 tempbitmap(dest.width(), dest.height());
11011101
1102                    // loop over characters
1103                    for (const char *s = m_stopnames[fruit]; *s != 0; s++)
1104                    {
1105                        // get the font bitmap
1106                        rectangle chbounds;
1107                        font->get_scaled_bitmap_and_bounds(tempbitmap, ourheight/num_shown, aspect, *s, chbounds);
1102               // loop over characters
1103               for (const char *s = m_stopnames[fruit]; *s != 0; s++)
1104               {
1105                  // get the font bitmap
1106                  rectangle chbounds;
1107                  font->get_scaled_bitmap_and_bounds(tempbitmap, ourheight/num_shown, aspect, *s, chbounds);
11081108
1109                        // copy the data into the target
1110                        for (int y = 0; y < chbounds.height(); y++)
1111                        {
1112                            int effy = basey + y;
1109                  // copy the data into the target
1110                  for (int y = 0; y < chbounds.height(); y++)
1111                  {
1112                     int effy = basey + y;
11131113
1114                            if (effy >= bounds.min_y && effy <= bounds.max_y)
1115                            {
1116                                UINT32 *src = &tempbitmap.pix32(y);
1117                                UINT32 *d = &dest.pix32(effy);
1118                                for (int x = 0; x < chbounds.width(); x++)
1119                                {
1120                                    int effx = curx + x + chbounds.min_x;
1121                                    if (effx >= bounds.min_x && effx <= bounds.max_x)
1122                                    {
1123                                        UINT32 spix = rgb_t(src[x]).a();
1124                                        if (spix != 0)
1125                                        {
1126                                            rgb_t dpix = d[effx];
1127                                            UINT32 ta = (a * (spix + 1)) >> 8;
1128                                            UINT32 tr = (r * ta + dpix.r() * (0x100 - ta)) >> 8;
1129                                            UINT32 tg = (g * ta + dpix.g() * (0x100 - ta)) >> 8;
1130                                            UINT32 tb = (b * ta + dpix.b() * (0x100 - ta)) >> 8;
1131                                            d[effx] = rgb_t(tr, tg, tb);
1132                                        }
1133                                    }
1134                                }
1135                            }
1136                        }
1114                     if (effy >= bounds.min_y && effy <= bounds.max_y)
1115                     {
1116                        UINT32 *src = &tempbitmap.pix32(y);
1117                        UINT32 *d = &dest.pix32(effy);
1118                        for (int x = 0; x < chbounds.width(); x++)
1119                        {
1120                           int effx = curx + x + chbounds.min_x;
1121                           if (effx >= bounds.min_x && effx <= bounds.max_x)
1122                           {
1123                              UINT32 spix = rgb_t(src[x]).a();
1124                              if (spix != 0)
1125                              {
1126                                 rgb_t dpix = d[effx];
1127                                 UINT32 ta = (a * (spix + 1)) >> 8;
1128                                 UINT32 tr = (r * ta + dpix.r() * (0x100 - ta)) >> 8;
1129                                 UINT32 tg = (g * ta + dpix.g() * (0x100 - ta)) >> 8;
1130                                 UINT32 tb = (b * ta + dpix.b() * (0x100 - ta)) >> 8;
1131                                 d[effx] = rgb_t(tr, tg, tb);
1132                              }
1133                           }
1134                        }
1135                     }
1136                  }
11371137
1138                        // advance in the X direction
1139                        curx += font->char_width(ourheight/num_shown, aspect, *s);
1138                  // advance in the X direction
1139                  curx += font->char_width(ourheight/num_shown, aspect, *s);
11401140
1141                    }
1141               }
11421142
1143                }
1144            }
1143            }
1144         }
11451145
1146            curry += ourheight/num_shown;
1147        }
1148    // free the temporary bitmap and font
1149    machine.render().font_free(font);
1150    }
1146         curry += ourheight/num_shown;
1147      }
1148   // free the temporary bitmap and font
1149   machine.render().font_free(font);
1150   }
11511151}
11521152
11531153
11541154void layout_element::component::draw_beltreel(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state)
11551155{
1156    const int max_state_used = 0x10000;
1156   const int max_state_used = 0x10000;
11571157
1158    // shift the reels a bit based on this param, allows fine tuning
1159    int use_state = (state + m_stateoffset) % max_state_used;
1158   // shift the reels a bit based on this param, allows fine tuning
1159   int use_state = (state + m_stateoffset) % max_state_used;
11601160
1161    // compute premultiplied colors
1162    UINT32 r = m_color.r * 255.0;
1163    UINT32 g = m_color.g * 255.0;
1164    UINT32 b = m_color.b * 255.0;
1165    UINT32 a = m_color.a * 255.0;
1161   // compute premultiplied colors
1162   UINT32 r = m_color.r * 255.0;
1163   UINT32 g = m_color.g * 255.0;
1164   UINT32 b = m_color.b * 255.0;
1165   UINT32 a = m_color.a * 255.0;
11661166
1167    // get the width of the string
1168    render_font *font = machine.render().font_alloc("default");
1169    float aspect = 1.0f;
1170    INT32 width;
1171    int currx = 0;
1172    int num_shown = m_numsymbolsvisible;
1167   // get the width of the string
1168   render_font *font = machine.render().font_alloc("default");
1169   float aspect = 1.0f;
1170   INT32 width;
1171   int currx = 0;
1172   int num_shown = m_numsymbolsvisible;
11731173
1174    int ourwidth = bounds.width();
1174   int ourwidth = bounds.width();
11751175
1176    for (int fruit = 0;fruit<m_numstops;fruit++)
1177    {
1178        int basex;
1179        if (m_reelreversed==1)
1180        {
1181            basex = bounds.min_x + ((use_state)*(ourwidth/num_shown)/(max_state_used/m_numstops)) + currx;
1182        }
1183        else
1184        {
1185            basex = bounds.min_x - ((use_state)*(ourwidth/num_shown)/(max_state_used/m_numstops)) + currx;
1186        }
1176   for (int fruit = 0;fruit<m_numstops;fruit++)
1177   {
1178      int basex;
1179      if (m_reelreversed==1)
1180      {
1181         basex = bounds.min_x + ((use_state)*(ourwidth/num_shown)/(max_state_used/m_numstops)) + currx;
1182      }
1183      else
1184      {
1185         basex = bounds.min_x - ((use_state)*(ourwidth/num_shown)/(max_state_used/m_numstops)) + currx;
1186      }
11871187
1188        // wrap around...
1189        if (basex < bounds.min_x)
1190            basex += ((max_state_used)*(ourwidth/num_shown)/(max_state_used/m_numstops));
1191        if (basex > bounds.max_x)
1192            basex -= ((max_state_used)*(ourwidth/num_shown)/(max_state_used/m_numstops));
1188      // wrap around...
1189      if (basex < bounds.min_x)
1190         basex += ((max_state_used)*(ourwidth/num_shown)/(max_state_used/m_numstops));
1191      if (basex > bounds.max_x)
1192         basex -= ((max_state_used)*(ourwidth/num_shown)/(max_state_used/m_numstops));
11931193
1194        int endpos = basex+(ourwidth/num_shown);
1194      int endpos = basex+(ourwidth/num_shown);
11951195
1196        // only render the symbol / text if it's atually in view because the code is SLOW
1197        if ((endpos >= bounds.min_x) && (basex <= bounds.max_x))
1198        {
1199            while (1)
1200            {
1201                width = font->string_width(dest.height(), aspect, m_stopnames[fruit]);
1202                if (width < bounds.width())
1203                    break;
1204                aspect *= 0.9f;
1205            }
1196      // only render the symbol / text if it's atually in view because the code is SLOW
1197      if ((endpos >= bounds.min_x) && (basex <= bounds.max_x))
1198      {
1199         while (1)
1200         {
1201            width = font->string_width(dest.height(), aspect, m_stopnames[fruit]);
1202            if (width < bounds.width())
1203               break;
1204            aspect *= 0.9f;
1205         }
12061206
1207            INT32 curx;
1208            curx = bounds.min_x;
1207         INT32 curx;
1208         curx = bounds.min_x;
12091209
1210            if (m_file[fruit])
1211                if (!m_bitmap[fruit].valid())
1212                    load_reel_bitmap(fruit);
1210         if (m_file[fruit])
1211            if (!m_bitmap[fruit].valid())
1212               load_reel_bitmap(fruit);
12131213
1214            if (m_file[fruit]) // render gfx
1215            {
1216                bitmap_argb32 tempbitmap2(ourwidth/num_shown, dest.height());
1214         if (m_file[fruit]) // render gfx
1215         {
1216            bitmap_argb32 tempbitmap2(ourwidth/num_shown, dest.height());
12171217
1218                if (m_bitmap[fruit].valid())
1219                {
1220                    render_resample_argb_bitmap_hq(tempbitmap2, m_bitmap[fruit], m_color);
1218            if (m_bitmap[fruit].valid())
1219            {
1220               render_resample_argb_bitmap_hq(tempbitmap2, m_bitmap[fruit], m_color);
12211221
1222                    for (int y = 0; y < dest.height(); y++)
1223                    {
1224                        int effy = y;
1222               for (int y = 0; y < dest.height(); y++)
1223               {
1224                  int effy = y;
12251225
1226                        if (effy >= bounds.min_y && effy <= bounds.max_y)
1227                        {
1228                            UINT32 *src = &tempbitmap2.pix32(y);
1229                            UINT32 *d = &dest.pix32(effy);
1230                            for (int x = 0; x < ourwidth/num_shown; x++)
1231                            {
1232                                int effx = basex + x;
1233                                if (effx >= bounds.min_x && effx <= bounds.max_x)
1234                                {
1235                                    UINT32 spix = rgb_t(src[x]).a();
1236                                    if (spix != 0)
1237                                    {
1238                                        d[effx] = src[x];
1239                                    }
1240                                }
1241                            }
1242                        }
1226                  if (effy >= bounds.min_y && effy <= bounds.max_y)
1227                  {
1228                     UINT32 *src = &tempbitmap2.pix32(y);
1229                     UINT32 *d = &dest.pix32(effy);
1230                     for (int x = 0; x < ourwidth/num_shown; x++)
1231                     {
1232                        int effx = basex + x;
1233                        if (effx >= bounds.min_x && effx <= bounds.max_x)
1234                        {
1235                           UINT32 spix = rgb_t(src[x]).a();
1236                           if (spix != 0)
1237                           {
1238                              d[effx] = src[x];
1239                           }
1240                        }
1241                     }
1242                  }
12431243
1244                    }
1245                }
1246            }
1247            else // render text (fallback)
1248            {
1249                // allocate a temporary bitmap
1250                bitmap_argb32 tempbitmap(dest.width(), dest.height());
1244               }
1245            }
1246         }
1247         else // render text (fallback)
1248         {
1249            // allocate a temporary bitmap
1250            bitmap_argb32 tempbitmap(dest.width(), dest.height());
12511251
1252                // loop over characters
1253                for (const char *s = m_stopnames[fruit]; *s != 0; s++)
1254                {
1255                    // get the font bitmap
1256                    rectangle chbounds;
1257                    font->get_scaled_bitmap_and_bounds(tempbitmap, dest.height(), aspect, *s, chbounds);
1252            // loop over characters
1253            for (const char *s = m_stopnames[fruit]; *s != 0; s++)
1254            {
1255               // get the font bitmap
1256               rectangle chbounds;
1257               font->get_scaled_bitmap_and_bounds(tempbitmap, dest.height(), aspect, *s, chbounds);
12581258
1259                    // copy the data into the target
1260                    for (int y = 0; y < chbounds.height(); y++)
1261                    {
1262                        int effy = y;
1259               // copy the data into the target
1260               for (int y = 0; y < chbounds.height(); y++)
1261               {
1262                  int effy = y;
12631263
1264                        if (effy >= bounds.min_y && effy <= bounds.max_y)
1265                        {
1266                            UINT32 *src = &tempbitmap.pix32(y);
1267                            UINT32 *d = &dest.pix32(effy);
1268                            for (int x = 0; x < chbounds.width(); x++)
1269                            {
1270                                int effx = basex + curx + x;
1271                                if (effx >= bounds.min_x && effx <= bounds.max_x)
1272                                {
1273                                    UINT32 spix = rgb_t(src[x]).a();
1274                                    if (spix != 0)
1275                                    {
1276                                        rgb_t dpix = d[effx];
1277                                        UINT32 ta = (a * (spix + 1)) >> 8;
1278                                        UINT32 tr = (r * ta + dpix.r() * (0x100 - ta)) >> 8;
1279                                        UINT32 tg = (g * ta + dpix.g() * (0x100 - ta)) >> 8;
1280                                        UINT32 tb = (b * ta + dpix.b() * (0x100 - ta)) >> 8;
1281                                        d[effx] = rgb_t(tr, tg, tb);
1282                                    }
1283                                }
1284                            }
1285                        }
1286                    }
1264                  if (effy >= bounds.min_y && effy <= bounds.max_y)
1265                  {
1266                     UINT32 *src = &tempbitmap.pix32(y);
1267                     UINT32 *d = &dest.pix32(effy);
1268                     for (int x = 0; x < chbounds.width(); x++)
1269                     {
1270                        int effx = basex + curx + x;
1271                        if (effx >= bounds.min_x && effx <= bounds.max_x)
1272                        {
1273                           UINT32 spix = rgb_t(src[x]).a();
1274                           if (spix != 0)
1275                           {
1276                              rgb_t dpix = d[effx];
1277                              UINT32 ta = (a * (spix + 1)) >> 8;
1278                              UINT32 tr = (r * ta + dpix.r() * (0x100 - ta)) >> 8;
1279                              UINT32 tg = (g * ta + dpix.g() * (0x100 - ta)) >> 8;
1280                              UINT32 tb = (b * ta + dpix.b() * (0x100 - ta)) >> 8;
1281                              d[effx] = rgb_t(tr, tg, tb);
1282                           }
1283                        }
1284                     }
1285                  }
1286               }
12871287
1288                    // advance in the X direction
1289                    curx += font->char_width(dest.height(), aspect, *s);
1288               // advance in the X direction
1289               curx += font->char_width(dest.height(), aspect, *s);
12901290
1291                }
1291            }
12921292
1293            }
1294        }
1293         }
1294      }
12951295
1296        currx += ourwidth/num_shown;
1297    }
1296      currx += ourwidth/num_shown;
1297   }
12981298
1299    // free the temporary bitmap and font
1300    machine.render().font_free(font);
1299   // free the temporary bitmap and font
1300   machine.render().font_free(font);
13011301}
13021302
13031303
r242631r242632
13081308
13091309void layout_element::component::load_bitmap()
13101310{
1311    // load the basic bitmap
1312    assert(m_file[0] != NULL);
1313    m_hasalpha[0] = render_load_png(m_bitmap[0], *m_file[0], m_dirname, m_imagefile[0]);
1311   // load the basic bitmap
1312   assert(m_file[0] != NULL);
1313   m_hasalpha[0] = render_load_png(m_bitmap[0], *m_file[0], m_dirname, m_imagefile[0]);
13141314
1315    // load the alpha bitmap if specified
1316    if (m_bitmap[0].valid() && m_alphafile[0])
1317        render_load_png(m_bitmap[0], *m_file[0], m_dirname, m_alphafile[0], true);
1315   // load the alpha bitmap if specified
1316   if (m_bitmap[0].valid() && m_alphafile[0])
1317      render_load_png(m_bitmap[0], *m_file[0], m_dirname, m_alphafile[0], true);
13181318
1319    // if we can't load the bitmap, allocate a dummy one and report an error
1320    if (!m_bitmap[0].valid())
1321    {
1322        // draw some stripes in the bitmap
1323        m_bitmap[0].allocate(100, 100);
1324        m_bitmap[0].fill(0);
1325        for (int step = 0; step < 100; step += 25)
1326            for (int line = 0; line < 100; line++)
1327                m_bitmap[0].pix32((step + line) % 100, line % 100) = rgb_t(0xff,0xff,0xff,0xff);
1319   // if we can't load the bitmap, allocate a dummy one and report an error
1320   if (!m_bitmap[0].valid())
1321   {
1322      // draw some stripes in the bitmap
1323      m_bitmap[0].allocate(100, 100);
1324      m_bitmap[0].fill(0);
1325      for (int step = 0; step < 100; step += 25)
1326         for (int line = 0; line < 100; line++)
1327            m_bitmap[0].pix32((step + line) % 100, line % 100) = rgb_t(0xff,0xff,0xff,0xff);
13281328
1329        // log an error
1330        if (!m_alphafile[0])
1331            osd_printf_warning("Unable to load component bitmap '%s'\n", m_imagefile[0].cstr());
1332        else
1333            osd_printf_warning("Unable to load component bitmap '%s'/'%s'\n", m_imagefile[0].cstr(), m_alphafile[0].cstr());
1334    }
1329      // log an error
1330      if (!m_alphafile[0])
1331         osd_printf_warning("Unable to load component bitmap '%s'\n", m_imagefile[0].cstr());
1332      else
1333         osd_printf_warning("Unable to load component bitmap '%s'/'%s'\n", m_imagefile[0].cstr(), m_alphafile[0].cstr());
1334   }
13351335}
13361336
13371337
13381338void layout_element::component::load_reel_bitmap(int number)
13391339{
1340    // load the basic bitmap
1341    assert(m_file != NULL);
1342    /*m_hasalpha[number] = */ render_load_png(m_bitmap[number], *m_file[number], m_dirname, m_imagefile[number]);
1340   // load the basic bitmap
1341   assert(m_file != NULL);
1342   /*m_hasalpha[number] = */ render_load_png(m_bitmap[number], *m_file[number], m_dirname, m_imagefile[number]);
13431343
1344    // load the alpha bitmap if specified
1345    //if (m_bitmap[number].valid() && m_alphafile[number])
1346    //  render_load_png(m_bitmap[number], *m_file[number], m_dirname, m_alphafile[number], true);
1344   // load the alpha bitmap if specified
1345   //if (m_bitmap[number].valid() && m_alphafile[number])
1346   //  render_load_png(m_bitmap[number], *m_file[number], m_dirname, m_alphafile[number], true);
13471347
1348    // if we can't load the bitmap just use text rendering
1349    if (!m_bitmap[number].valid())
1350    {
1351        // fallback to text rendering
1352        m_file[number].reset();
1353    }
1348   // if we can't load the bitmap just use text rendering
1349   if (!m_bitmap[number].valid())
1350   {
1351      // fallback to text rendering
1352      m_file[number].reset();
1353   }
13541354
13551355}
13561356
r242631r242632
13621362
13631363void layout_element::component::draw_led7seg(bitmap_argb32 &dest, const rectangle &bounds, int pattern)
13641364{
1365    const rgb_t onpen = rgb_t(0xff,0xff,0xff,0xff);
1366    const rgb_t offpen = rgb_t(0xff,0x20,0x20,0x20);
1365   const rgb_t onpen = rgb_t(0xff,0xff,0xff,0xff);
1366   const rgb_t offpen = rgb_t(0xff,0x20,0x20,0x20);
13671367
1368    // sizes for computation
1369    int bmwidth = 250;
1370    int bmheight = 400;
1371    int segwidth = 40;
1372    int skewwidth = 40;
1368   // sizes for computation
1369   int bmwidth = 250;
1370   int bmheight = 400;
1371   int segwidth = 40;
1372   int skewwidth = 40;
13731373
1374    // allocate a temporary bitmap for drawing
1375    bitmap_argb32 tempbitmap(bmwidth + skewwidth, bmheight);
1376    tempbitmap.fill(rgb_t(0xff,0x00,0x00,0x00));
1374   // allocate a temporary bitmap for drawing
1375   bitmap_argb32 tempbitmap(bmwidth + skewwidth, bmheight);
1376   tempbitmap.fill(rgb_t(0xff,0x00,0x00,0x00));
13771377
1378    // top bar
1379    draw_segment_horizontal(tempbitmap, 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, 0 + segwidth/2, segwidth, (pattern & (1 << 0)) ? onpen : offpen);
1378   // top bar
1379   draw_segment_horizontal(tempbitmap, 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, 0 + segwidth/2, segwidth, (pattern & (1 << 0)) ? onpen : offpen);
13801380
1381    // top-right bar
1382    draw_segment_vertical(tempbitmap, 0 + 2*segwidth/3, bmheight/2 - segwidth/3, bmwidth - segwidth/2, segwidth, (pattern & (1 << 1)) ? onpen : offpen);
1381   // top-right bar
1382   draw_segment_vertical(tempbitmap, 0 + 2*segwidth/3, bmheight/2 - segwidth/3, bmwidth - segwidth/2, segwidth, (pattern & (1 << 1)) ? onpen : offpen);
13831383
1384    // bottom-right bar
1385    draw_segment_vertical(tempbitmap, bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, bmwidth - segwidth/2, segwidth, (pattern & (1 << 2)) ? onpen : offpen);
1384   // bottom-right bar
1385   draw_segment_vertical(tempbitmap, bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, bmwidth - segwidth/2, segwidth, (pattern & (1 << 2)) ? onpen : offpen);
13861386
1387    // bottom bar
1388    draw_segment_horizontal(tempbitmap, 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, bmheight - segwidth/2, segwidth, (pattern & (1 << 3)) ? onpen : offpen);
1387   // bottom bar
1388   draw_segment_horizontal(tempbitmap, 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, bmheight - segwidth/2, segwidth, (pattern & (1 << 3)) ? onpen : offpen);
13891389
1390    // bottom-left bar
1391    draw_segment_vertical(tempbitmap, bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, 0 + segwidth/2, segwidth, (pattern & (1 << 4)) ? onpen : offpen);
1390   // bottom-left bar
1391   draw_segment_vertical(tempbitmap, bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, 0 + segwidth/2, segwidth, (pattern & (1 << 4)) ? onpen : offpen);
13921392
1393    // top-left bar
1394    draw_segment_vertical(tempbitmap, 0 + 2*segwidth/3, bmheight/2 - segwidth/3, 0 + segwidth/2, segwidth, (pattern & (1 << 5)) ? onpen : offpen);
1393   // top-left bar
1394   draw_segment_vertical(tempbitmap, 0 + 2*segwidth/3, bmheight/2 - segwidth/3, 0 + segwidth/2, segwidth, (pattern & (1 << 5)) ? onpen : offpen);
13951395
1396    // middle bar
1397    draw_segment_horizontal(tempbitmap, 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, bmheight/2, segwidth, (pattern & (1 << 6)) ? onpen : offpen);
1396   // middle bar
1397   draw_segment_horizontal(tempbitmap, 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, bmheight/2, segwidth, (pattern & (1 << 6)) ? onpen : offpen);
13981398
1399    // apply skew
1400    apply_skew(tempbitmap, 40);
1399   // apply skew
1400   apply_skew(tempbitmap, 40);
14011401
1402    // decimal point
1403    draw_segment_decimal(tempbitmap, bmwidth + segwidth/2, bmheight - segwidth/2, segwidth, (pattern & (1 << 7)) ? onpen : offpen);
1402   // decimal point
1403   draw_segment_decimal(tempbitmap, bmwidth + segwidth/2, bmheight - segwidth/2, segwidth, (pattern & (1 << 7)) ? onpen : offpen);
14041404
1405    // resample to the target size
1406    render_resample_argb_bitmap_hq(dest, tempbitmap, m_color);
1405   // resample to the target size
1406   render_resample_argb_bitmap_hq(dest, tempbitmap, m_color);
14071407}
14081408
14091409
r242631r242632
14131413
14141414void layout_element::component::draw_led8seg_gts1(bitmap_argb32 &dest, const rectangle &bounds, int pattern)
14151415{
1416    const rgb_t onpen = rgb_t(0xff,0xff,0xff,0xff);
1417    const rgb_t offpen = rgb_t(0xff,0x20,0x20,0x20);
1418    const rgb_t backpen = rgb_t(0xff,0x00,0x00,0x00);
1416   const rgb_t onpen = rgb_t(0xff,0xff,0xff,0xff);
1417   const rgb_t offpen = rgb_t(0xff,0x20,0x20,0x20);
1418   const rgb_t backpen = rgb_t(0xff,0x00,0x00,0x00);
14191419
1420    // sizes for computation
1421    int bmwidth = 250;
1422    int bmheight = 400;
1423    int segwidth = 40;
1424    int skewwidth = 40;
1420   // sizes for computation
1421   int bmwidth = 250;
1422   int bmheight = 400;
1423   int segwidth = 40;
1424   int skewwidth = 40;
14251425
1426    // allocate a temporary bitmap for drawing
1427    bitmap_argb32 tempbitmap(bmwidth + skewwidth, bmheight);
1428    tempbitmap.fill(backpen);
1426   // allocate a temporary bitmap for drawing
1427   bitmap_argb32 tempbitmap(bmwidth + skewwidth, bmheight);
1428   tempbitmap.fill(backpen);
14291429
1430    // top bar
1431    draw_segment_horizontal(tempbitmap, 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, 0 + segwidth/2, segwidth, (pattern & (1 << 0)) ? onpen : offpen);
1430   // top bar
1431   draw_segment_horizontal(tempbitmap, 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, 0 + segwidth/2, segwidth, (pattern & (1 << 0)) ? onpen : offpen);
14321432
1433    // top-right bar
1434    draw_segment_vertical(tempbitmap, 0 + 2*segwidth/3, bmheight/2 - segwidth/3, bmwidth - segwidth/2, segwidth, (pattern & (1 << 1)) ? onpen : offpen);
1433   // top-right bar
1434   draw_segment_vertical(tempbitmap, 0 + 2*segwidth/3, bmheight/2 - segwidth/3, bmwidth - segwidth/2, segwidth, (pattern & (1 << 1)) ? onpen : offpen);
14351435
1436    // bottom-right bar
1437    draw_segment_vertical(tempbitmap, bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, bmwidth - segwidth/2, segwidth, (pattern & (1 << 2)) ? onpen : offpen);
1436   // bottom-right bar
1437   draw_segment_vertical(tempbitmap, bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, bmwidth - segwidth/2, segwidth, (pattern & (1 << 2)) ? onpen : offpen);
14381438
1439    // bottom bar
1440    draw_segment_horizontal(tempbitmap, 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, bmheight - segwidth/2, segwidth, (pattern & (1 << 3)) ? onpen : offpen);
1439   // bottom bar
1440   draw_segment_horizontal(tempbitmap, 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, bmheight - segwidth/2, segwidth, (pattern & (1 << 3)) ? onpen : offpen);
14411441
1442    // bottom-left bar
1443    draw_segment_vertical(tempbitmap, bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, 0 + segwidth/2, segwidth, (pattern & (1 << 4)) ? onpen : offpen);
1442   // bottom-left bar
1443   draw_segment_vertical(tempbitmap, bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, 0 + segwidth/2, segwidth, (pattern & (1 << 4)) ? onpen : offpen);
14441444
1445    // top-left bar
1446    draw_segment_vertical(tempbitmap, 0 + 2*segwidth/3, bmheight/2 - segwidth/3, 0 + segwidth/2, segwidth, (pattern & (1 << 5)) ? onpen : offpen);
1445   // top-left bar
1446   draw_segment_vertical(tempbitmap, 0 + 2*segwidth/3, bmheight/2 - segwidth/3, 0 + segwidth/2, segwidth, (pattern & (1 << 5)) ? onpen : offpen);
14471447
1448    // horizontal bars
1449    draw_segment_horizontal(tempbitmap, 0 + 2*segwidth/3, 2*bmwidth/3 - 2*segwidth/3, bmheight/2, segwidth, (pattern & (1 << 6)) ? onpen : offpen);
1450    draw_segment_horizontal(tempbitmap, 0 + 2*segwidth/3 + bmwidth/2, bmwidth - 2*segwidth/3, bmheight/2, segwidth, (pattern & (1 << 6)) ? onpen : offpen);
1448   // horizontal bars
1449   draw_segment_horizontal(tempbitmap, 0 + 2*segwidth/3, 2*bmwidth/3 - 2*segwidth/3, bmheight/2, segwidth, (pattern & (1 << 6)) ? onpen : offpen);
1450   draw_segment_horizontal(tempbitmap, 0 + 2*segwidth/3 + bmwidth/2, bmwidth - 2*segwidth/3, bmheight/2, segwidth, (pattern & (1 << 6)) ? onpen : offpen);
14511451
1452    // vertical bars
1453    draw_segment_vertical(tempbitmap, 0 + segwidth/3 - 8, bmheight/2 - segwidth/3 + 2, 2*bmwidth/3 - segwidth/2 - 4, segwidth + 8, backpen);
1454    draw_segment_vertical(tempbitmap, 0 + segwidth/3, bmheight/2 - segwidth/3, 2*bmwidth/3 - segwidth/2 - 4, segwidth, (pattern & (1 << 7)) ? onpen : offpen);
1452   // vertical bars
1453   draw_segment_vertical(tempbitmap, 0 + segwidth/3 - 8, bmheight/2 - segwidth/3 + 2, 2*bmwidth/3 - segwidth/2 - 4, segwidth + 8, backpen);
1454   draw_segment_vertical(tempbitmap, 0 + segwidth/3, bmheight/2 - segwidth/3, 2*bmwidth/3 - segwidth/2 - 4, segwidth, (pattern & (1 << 7)) ? onpen : offpen);
14551455
1456    draw_segment_vertical(tempbitmap, bmheight/2 + segwidth/3 - 2, bmheight - segwidth/3 + 8, 2*bmwidth/3 - segwidth/2 - 4, segwidth + 8, backpen);
1457    draw_segment_vertical(tempbitmap, bmheight/2 + segwidth/3, bmheight - segwidth/3, 2*bmwidth/3 - segwidth/2 - 4, segwidth, (pattern & (1 << 7)) ? onpen : offpen);
1456   draw_segment_vertical(tempbitmap, bmheight/2 + segwidth/3 - 2, bmheight - segwidth/3 + 8, 2*bmwidth/3 - segwidth/2 - 4, segwidth + 8, backpen);
1457   draw_segment_vertical(tempbitmap, bmheight/2 + segwidth/3, bmheight - segwidth/3, 2*bmwidth/3 - segwidth/2 - 4, segwidth, (pattern & (1 << 7)) ? onpen : offpen);
14581458
1459    // apply skew
1460    apply_skew(tempbitmap, 40);
1459   // apply skew
1460   apply_skew(tempbitmap, 40);
14611461
1462    // resample to the target size
1463    render_resample_argb_bitmap_hq(dest, tempbitmap, m_color);
1462   // resample to the target size
1463   render_resample_argb_bitmap_hq(dest, tempbitmap, m_color);
14641464}
14651465
14661466
r242631r242632
14701470
14711471void layout_element::component::draw_led14seg(bitmap_argb32 &dest, const rectangle &bounds, int pattern)
14721472{
1473    const rgb_t onpen = rgb_t(0xff, 0xff, 0xff, 0xff);
1474    const rgb_t offpen = rgb_t(0xff, 0x20, 0x20, 0x20);
1473   const rgb_t onpen = rgb_t(0xff, 0xff, 0xff, 0xff);
1474   const rgb_t offpen = rgb_t(0xff, 0x20, 0x20, 0x20);
14751475
1476    // sizes for computation
1477    int bmwidth = 250;
1478    int bmheight = 400;
1479    int segwidth = 40;
1480    int skewwidth = 40;
1476   // sizes for computation
1477   int bmwidth = 250;
1478   int bmheight = 400;
1479   int segwidth = 40;
1480   int skewwidth = 40;
14811481
1482    // allocate a temporary bitmap for drawing
1483    bitmap_argb32 tempbitmap(bmwidth + skewwidth, bmheight);
1484    tempbitmap.fill(rgb_t(0xff, 0x00, 0x00, 0x00));
1482   // allocate a temporary bitmap for drawing
1483   bitmap_argb32 tempbitmap(bmwidth + skewwidth, bmheight);
1484   tempbitmap.fill(rgb_t(0xff, 0x00, 0x00, 0x00));
14851485
1486    // top bar
1487    draw_segment_horizontal(tempbitmap,
1488        0 + 2*segwidth/3, bmwidth - 2*segwidth/3, 0 + segwidth/2,
1489        segwidth, (pattern & (1 << 0)) ? onpen : offpen);
1486   // top bar
1487   draw_segment_horizontal(tempbitmap,
1488      0 + 2*segwidth/3, bmwidth - 2*segwidth/3, 0 + segwidth/2,
1489      segwidth, (pattern & (1 << 0)) ? onpen : offpen);
14901490
1491    // right-top bar
1492    draw_segment_vertical(tempbitmap,
1493        0 + 2*segwidth/3, bmheight/2 - segwidth/3, bmwidth - segwidth/2,
1494        segwidth, (pattern & (1 << 1)) ? onpen : offpen);
1491   // right-top bar
1492   draw_segment_vertical(tempbitmap,
1493      0 + 2*segwidth/3, bmheight/2 - segwidth/3, bmwidth - segwidth/2,
1494      segwidth, (pattern & (1 << 1)) ? onpen : offpen);
14951495
1496    // right-bottom bar
1497    draw_segment_vertical(tempbitmap,
1498        bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, bmwidth - segwidth/2,
1499        segwidth, (pattern & (1 << 2)) ? onpen : offpen);
1496   // right-bottom bar
1497   draw_segment_vertical(tempbitmap,
1498      bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, bmwidth - segwidth/2,
1499      segwidth, (pattern & (1 << 2)) ? onpen : offpen);
15001500
1501    // bottom bar
1502    draw_segment_horizontal(tempbitmap,
1503        0 + 2*segwidth/3, bmwidth - 2*segwidth/3, bmheight - segwidth/2,
1504        segwidth, (pattern & (1 << 3)) ? onpen : offpen);
1501   // bottom bar
1502   draw_segment_horizontal(tempbitmap,
1503      0 + 2*segwidth/3, bmwidth - 2*segwidth/3, bmheight - segwidth/2,
1504      segwidth, (pattern & (1 << 3)) ? onpen : offpen);
15051505
1506    // left-bottom bar
1507    draw_segment_vertical(tempbitmap,
1508        bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, 0 + segwidth/2,
1509        segwidth, (pattern & (1 << 4)) ? onpen : offpen);
1506   // left-bottom bar
1507   draw_segment_vertical(tempbitmap,
1508      bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, 0 + segwidth/2,
1509      segwidth, (pattern & (1 << 4)) ? onpen : offpen);
15101510
1511    // left-top bar
1512    draw_segment_vertical(tempbitmap,
1513        0 + 2*segwidth/3, bmheight/2 - segwidth/3, 0 + segwidth/2,
1514        segwidth, (pattern & (1 << 5)) ? onpen : offpen);
1511   // left-top bar
1512   draw_segment_vertical(tempbitmap,
1513      0 + 2*segwidth/3, bmheight/2 - segwidth/3, 0 + segwidth/2,
1514      segwidth, (pattern & (1 << 5)) ? onpen : offpen);
15151515
1516    // horizontal-middle-left bar
1517    draw_segment_horizontal_caps(tempbitmap,
1518        0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight/2,
1519        segwidth, LINE_CAP_START, (pattern & (1 << 6)) ? onpen : offpen);
1516   // horizontal-middle-left bar
1517   draw_segment_horizontal_caps(tempbitmap,
1518      0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight/2,
1519      segwidth, LINE_CAP_START, (pattern & (1 << 6)) ? onpen : offpen);
15201520
1521    // horizontal-middle-right bar
1522    draw_segment_horizontal_caps(tempbitmap,
1523        0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight/2,
1524        segwidth, LINE_CAP_END, (pattern & (1 << 7)) ? onpen : offpen);
1521   // horizontal-middle-right bar
1522   draw_segment_horizontal_caps(tempbitmap,
1523      0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight/2,
1524      segwidth, LINE_CAP_END, (pattern & (1 << 7)) ? onpen : offpen);
15251525
1526    // vertical-middle-top bar
1527    draw_segment_vertical_caps(tempbitmap,
1528        0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, bmwidth/2,
1529        segwidth, LINE_CAP_NONE, (pattern & (1 << 8)) ? onpen : offpen);
1526   // vertical-middle-top bar
1527   draw_segment_vertical_caps(tempbitmap,
1528      0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, bmwidth/2,
1529      segwidth, LINE_CAP_NONE, (pattern & (1 << 8)) ? onpen : offpen);
15301530
1531    // vertical-middle-bottom bar
1532    draw_segment_vertical_caps(tempbitmap,
1533        bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, bmwidth/2,
1534        segwidth, LINE_CAP_NONE, (pattern & (1 << 9)) ? onpen : offpen);
1531   // vertical-middle-bottom bar
1532   draw_segment_vertical_caps(tempbitmap,
1533      bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, bmwidth/2,
1534      segwidth, LINE_CAP_NONE, (pattern & (1 << 9)) ? onpen : offpen);
15351535
1536    // diagonal-left-bottom bar
1537    draw_segment_diagonal_1(tempbitmap,
1538        0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
1539        bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
1540        segwidth, (pattern & (1 << 10)) ? onpen : offpen);
1536   // diagonal-left-bottom bar
1537   draw_segment_diagonal_1(tempbitmap,
1538      0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
1539      bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
1540      segwidth, (pattern & (1 << 10)) ? onpen : offpen);
15411541
1542    // diagonal-left-top bar
1543    draw_segment_diagonal_2(tempbitmap,
1544        0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
1545        0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
1546        segwidth, (pattern & (1 << 11)) ? onpen : offpen);
1542   // diagonal-left-top bar
1543   draw_segment_diagonal_2(tempbitmap,
1544      0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
1545      0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
1546      segwidth, (pattern & (1 << 11)) ? onpen : offpen);
15471547
1548    // diagonal-right-top bar
1549    draw_segment_diagonal_1(tempbitmap,
1550        bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
1551        0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
1552        segwidth, (pattern & (1 << 12)) ? onpen : offpen);
1548   // diagonal-right-top bar
1549   draw_segment_diagonal_1(tempbitmap,
1550      bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
1551      0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
1552      segwidth, (pattern & (1 << 12)) ? onpen : offpen);
15531553
1554    // diagonal-right-bottom bar
1555    draw_segment_diagonal_2(tempbitmap,
1556        bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
1557        bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
1558        segwidth, (pattern & (1 << 13)) ? onpen : offpen);
1554   // diagonal-right-bottom bar
1555   draw_segment_diagonal_2(tempbitmap,
1556      bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
1557      bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
1558      segwidth, (pattern & (1 << 13)) ? onpen : offpen);
15591559
1560    // apply skew
1561    apply_skew(tempbitmap, 40);
1560   // apply skew
1561   apply_skew(tempbitmap, 40);
15621562
1563    // resample to the target size
1564    render_resample_argb_bitmap_hq(dest, tempbitmap, m_color);
1563   // resample to the target size
1564   render_resample_argb_bitmap_hq(dest, tempbitmap, m_color);
15651565}
15661566
15671567
r242631r242632
15721572
15731573void layout_element::component::draw_led14segsc(bitmap_argb32 &dest, const rectangle &bounds, int pattern)
15741574{
1575    const rgb_t onpen = rgb_t(0xff, 0xff, 0xff, 0xff);
1576    const rgb_t offpen = rgb_t(0xff, 0x20, 0x20, 0x20);
1575   const rgb_t onpen = rgb_t(0xff, 0xff, 0xff, 0xff);
1576   const rgb_t offpen = rgb_t(0xff, 0x20, 0x20, 0x20);
15771577
1578    // sizes for computation
1579    int bmwidth = 250;
1580    int bmheight = 400;
1581    int segwidth = 40;
1582    int skewwidth = 40;
1578   // sizes for computation
1579   int bmwidth = 250;
1580   int bmheight = 400;
1581   int segwidth = 40;
1582   int skewwidth = 40;
15831583
1584    // allocate a temporary bitmap for drawing, adding some extra space for the tail
1585    bitmap_argb32 tempbitmap(bmwidth + skewwidth, bmheight + segwidth);
1586    tempbitmap.fill(rgb_t(0xff, 0x00, 0x00, 0x00));
1584   // allocate a temporary bitmap for drawing, adding some extra space for the tail
1585   bitmap_argb32 tempbitmap(bmwidth + skewwidth, bmheight + segwidth);
1586   tempbitmap.fill(rgb_t(0xff, 0x00, 0x00, 0x00));
15871587
1588    // top bar
1589    draw_segment_horizontal(tempbitmap,
1590        0 + 2*segwidth/3, bmwidth - 2*segwidth/3, 0 + segwidth/2,
1591        segwidth, (pattern & (1 << 0)) ? onpen : offpen);
1588   // top bar
1589   draw_segment_horizontal(tempbitmap,
1590      0 + 2*segwidth/3, bmwidth - 2*segwidth/3, 0 + segwidth/2,
1591      segwidth, (pattern & (1 << 0)) ? onpen : offpen);
15921592
1593    // right-top bar
1594    draw_segment_vertical(tempbitmap,
1595        0 + 2*segwidth/3, bmheight/2 - segwidth/3, bmwidth - segwidth/2,
1596        segwidth, (pattern & (1 << 1)) ? onpen : offpen);
1593   // right-top bar
1594   draw_segment_vertical(tempbitmap,
1595      0 + 2*segwidth/3, bmheight/2 - segwidth/3, bmwidth - segwidth/2,
1596      segwidth, (pattern & (1 << 1)) ? onpen : offpen);
15971597
1598    // right-bottom bar
1599    draw_segment_vertical(tempbitmap,
1600        bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, bmwidth - segwidth/2,
1601        segwidth, (pattern & (1 << 2)) ? onpen : offpen);
1598   // right-bottom bar
1599   draw_segment_vertical(tempbitmap,
1600      bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, bmwidth - segwidth/2,
1601      segwidth, (pattern & (1 << 2)) ? onpen : offpen);
16021602
1603    // bottom bar
1604    draw_segment_horizontal(tempbitmap,
1605        0 + 2*segwidth/3, bmwidth - 2*segwidth/3, bmheight - segwidth/2,
1606        segwidth, (pattern & (1 << 3)) ? onpen : offpen);
1603   // bottom bar
1604   draw_segment_horizontal(tempbitmap,
1605      0 + 2*segwidth/3, bmwidth - 2*segwidth/3, bmheight - segwidth/2,
1606      segwidth, (pattern & (1 << 3)) ? onpen : offpen);
16071607
1608    // left-bottom bar
1609    draw_segment_vertical(tempbitmap,
1610        bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, 0 + segwidth/2,
1611        segwidth, (pattern & (1 << 4)) ? onpen : offpen);
1608   // left-bottom bar
1609   draw_segment_vertical(tempbitmap,
1610      bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, 0 + segwidth/2,
1611      segwidth, (pattern & (1 << 4)) ? onpen : offpen);
16121612
1613    // left-top bar
1614    draw_segment_vertical(tempbitmap,
1615        0 + 2*segwidth/3, bmheight/2 - segwidth/3, 0 + segwidth/2,
1616        segwidth, (pattern & (1 << 5)) ? onpen : offpen);
1613   // left-top bar
1614   draw_segment_vertical(tempbitmap,
1615      0 + 2*segwidth/3, bmheight/2 - segwidth/3, 0 + segwidth/2,
1616      segwidth, (pattern & (1 << 5)) ? onpen : offpen);
16171617
1618    // horizontal-middle-left bar
1619    draw_segment_horizontal_caps(tempbitmap,
1620        0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight/2,
1621        segwidth, LINE_CAP_START, (pattern & (1 << 6)) ? onpen : offpen);
1618   // horizontal-middle-left bar
1619   draw_segment_horizontal_caps(tempbitmap,
1620      0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight/2,
1621      segwidth, LINE_CAP_START, (pattern & (1 << 6)) ? onpen : offpen);
16221622
1623    // horizontal-middle-right bar
1624    draw_segment_horizontal_caps(tempbitmap,
1625        0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight/2,
1626        segwidth, LINE_CAP_END, (pattern & (1 << 7)) ? onpen : offpen);
1623   // horizontal-middle-right bar
1624   draw_segment_horizontal_caps(tempbitmap,
1625      0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight/2,
1626      segwidth, LINE_CAP_END, (pattern & (1 << 7)) ? onpen : offpen);
16271627
1628    // vertical-middle-top bar
1629    draw_segment_vertical_caps(tempbitmap,
1630        0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, bmwidth/2,
1631        segwidth, LINE_CAP_NONE, (pattern & (1 << 8)) ? onpen : offpen);
1628   // vertical-middle-top bar
1629   draw_segment_vertical_caps(tempbitmap,
1630      0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, bmwidth/2,
1631      segwidth, LINE_CAP_NONE, (pattern & (1 << 8)) ? onpen : offpen);
16321632
1633    // vertical-middle-bottom bar
1634    draw_segment_vertical_caps(tempbitmap,
1635        bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, bmwidth/2,
1636        segwidth, LINE_CAP_NONE, (pattern & (1 << 9)) ? onpen : offpen);
1633   // vertical-middle-bottom bar
1634   draw_segment_vertical_caps(tempbitmap,
1635      bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, bmwidth/2,
1636      segwidth, LINE_CAP_NONE, (pattern & (1 << 9)) ? onpen : offpen);
16371637
1638    // diagonal-left-bottom bar
1639    draw_segment_diagonal_1(tempbitmap,
1640        0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
1641        bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
1642        segwidth, (pattern & (1 << 10)) ? onpen : offpen);
1638   // diagonal-left-bottom bar
1639   draw_segment_diagonal_1(tempbitmap,
1640      0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
1641      bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
1642      segwidth, (pattern & (1 << 10)) ? onpen : offpen);
16431643
1644    // diagonal-left-top bar
1645    draw_segment_diagonal_2(tempbitmap,
1646        0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
1647        0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
1648        segwidth, (pattern & (1 << 11)) ? onpen : offpen);
1644   // diagonal-left-top bar
1645   draw_segment_diagonal_2(tempbitmap,
1646      0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
1647      0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
1648      segwidth, (pattern & (1 << 11)) ? onpen : offpen);
16491649
1650    // diagonal-right-top bar
1651    draw_segment_diagonal_1(tempbitmap,
1652        bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
1653        0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
1654        segwidth, (pattern & (1 << 12)) ? onpen : offpen);
1650   // diagonal-right-top bar
1651   draw_segment_diagonal_1(tempbitmap,
1652      bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
1653      0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
1654      segwidth, (pattern & (1 << 12)) ? onpen : offpen);
16551655
1656    // diagonal-right-bottom bar
1657    draw_segment_diagonal_2(tempbitmap,
1658        bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
1659        bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
1660        segwidth, (pattern & (1 << 13)) ? onpen : offpen);
1656   // diagonal-right-bottom bar
1657   draw_segment_diagonal_2(tempbitmap,
1658      bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
1659      bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
1660      segwidth, (pattern & (1 << 13)) ? onpen : offpen);
16611661
1662    // apply skew
1663    apply_skew(tempbitmap, 40);
1662   // apply skew
1663   apply_skew(tempbitmap, 40);
16641664
1665    // comma tail
1666    draw_segment_diagonal_1(tempbitmap,
1667        bmwidth - (segwidth/2), bmwidth + segwidth,
1668        bmheight - (segwidth), bmheight + segwidth*1.5,
1669        segwidth/2, (pattern & (1 << 15)) ? onpen : offpen);
1665   // comma tail
1666   draw_segment_diagonal_1(tempbitmap,
1667      bmwidth - (segwidth/2), bmwidth + segwidth,
1668      bmheight - (segwidth), bmheight + segwidth*1.5,
1669      segwidth/2, (pattern & (1 << 15)) ? onpen : offpen);
16701670
1671    // decimal point
1672    draw_segment_decimal(tempbitmap, bmwidth + segwidth/2, bmheight - segwidth/2, segwidth, (pattern & (1 << 14)) ? onpen : offpen);
1671   // decimal point
1672   draw_segment_decimal(tempbitmap, bmwidth + segwidth/2, bmheight - segwidth/2, segwidth, (pattern & (1 << 14)) ? onpen : offpen);
16731673
1674    // resample to the target size
1675    render_resample_argb_bitmap_hq(dest, tempbitmap, m_color);
1674   // resample to the target size
1675   render_resample_argb_bitmap_hq(dest, tempbitmap, m_color);
16761676}
16771677
16781678
r242631r242632
16821682
16831683void layout_element::component::draw_led16seg(bitmap_argb32 &dest, const rectangle &bounds, int pattern)
16841684{
1685    const rgb_t onpen = rgb_t(0xff, 0xff, 0xff, 0xff);
1686    const rgb_t offpen = rgb_t(0xff, 0x20, 0x20, 0x20);
1685   const rgb_t onpen = rgb_t(0xff, 0xff, 0xff, 0xff);
1686   const rgb_t offpen = rgb_t(0xff, 0x20, 0x20, 0x20);
16871687
1688    // sizes for computation
1689    int bmwidth = 250;
1690    int bmheight = 400;
1691    int segwidth = 40;
1692    int skewwidth = 40;
1688   // sizes for computation
1689   int bmwidth = 250;
1690   int bmheight = 400;
1691   int segwidth = 40;
1692   int skewwidth = 40;
16931693
1694    // allocate a temporary bitmap for drawing
1695    bitmap_argb32 tempbitmap(bmwidth + skewwidth, bmheight);
1696    tempbitmap.fill(rgb_t(0xff, 0x00, 0x00, 0x00));
1694   // allocate a temporary bitmap for drawing
1695   bitmap_argb32 tempbitmap(bmwidth + skewwidth, bmheight);
1696   tempbitmap.fill(rgb_t(0xff, 0x00, 0x00, 0x00));
16971697
1698    // top-left bar
1699    draw_segment_horizontal_caps(tempbitmap,
1700        0 + 2*segwidth/3, bmwidth/2 - segwidth/10, 0 + segwidth/2,
1701        segwidth, LINE_CAP_START, (pattern & (1 << 0)) ? onpen : offpen);
1698   // top-left bar
1699   draw_segment_horizontal_caps(tempbitmap,
1700      0 + 2*segwidth/3, bmwidth/2 - segwidth/10, 0 + segwidth/2,
1701      segwidth, LINE_CAP_START, (pattern & (1 << 0)) ? onpen : offpen);
17021702
1703    // top-right bar
1704    draw_segment_horizontal_caps(tempbitmap,
1705        0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, 0 + segwidth/2,
1706        segwidth, LINE_CAP_END, (pattern & (1 << 1)) ? onpen : offpen);
1703   // top-right bar
1704   draw_segment_horizontal_caps(tempbitmap,
1705      0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, 0 + segwidth/2,
1706      segwidth, LINE_CAP_END, (pattern & (1 << 1)) ? onpen : offpen);
17071707
1708    // right-top bar
1709    draw_segment_vertical(tempbitmap,
1710        0 + 2*segwidth/3, bmheight/2 - segwidth/3, bmwidth - segwidth/2,
1711        segwidth, (pattern & (1 << 2)) ? onpen : offpen);
1708   // right-top bar
1709   draw_segment_vertical(tempbitmap,
1710      0 + 2*segwidth/3, bmheight/2 - segwidth/3, bmwidth - segwidth/2,
1711      segwidth, (pattern & (1 << 2)) ? onpen : offpen);
17121712
1713    // right-bottom bar
1714    draw_segment_vertical(tempbitmap,
1715        bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, bmwidth - segwidth/2,
1716        segwidth, (pattern & (1 << 3)) ? onpen : offpen);
1713   // right-bottom bar
1714   draw_segment_vertical(tempbitmap,
1715      bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, bmwidth - segwidth/2,
1716      segwidth, (pattern & (1 << 3)) ? onpen : offpen);
17171717
1718    // bottom-right bar
1719    draw_segment_horizontal_caps(tempbitmap,
1720        0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight - segwidth/2,
1721        segwidth, LINE_CAP_END, (pattern & (1 << 4)) ? onpen : offpen);
1718   // bottom-right bar
1719   draw_segment_horizontal_caps(tempbitmap,
1720      0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight - segwidth/2,
1721      segwidth, LINE_CAP_END, (pattern & (1 << 4)) ? onpen : offpen);
17221722
1723    // bottom-left bar
1724    draw_segment_horizontal_caps(tempbitmap,
1725        0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight - segwidth/2,
1726        segwidth, LINE_CAP_START, (pattern & (1 << 5)) ? onpen : offpen);
1723   // bottom-left bar
1724   draw_segment_horizontal_caps(tempbitmap,
1725      0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight - segwidth/2,
1726      segwidth, LINE_CAP_START, (pattern & (1 << 5)) ? onpen : offpen);
17271727
1728    // left-bottom bar
1729    draw_segment_vertical(tempbitmap,
1730        bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, 0 + segwidth/2,
1731        segwidth, (pattern & (1 << 6)) ? onpen : offpen);
1728   // left-bottom bar
1729   draw_segment_vertical(tempbitmap,
1730      bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, 0 + segwidth/2,
1731      segwidth, (pattern & (1 << 6)) ? onpen : offpen);
17321732
1733    // left-top bar
1734    draw_segment_vertical(tempbitmap,
1735        0 + 2*segwidth/3, bmheight/2 - segwidth/3, 0 + segwidth/2,
1736        segwidth, (pattern & (1 << 7)) ? onpen : offpen);
1733   // left-top bar
1734   draw_segment_vertical(tempbitmap,
1735      0 + 2*segwidth/3, bmheight/2 - segwidth/3, 0 + segwidth/2,
1736      segwidth, (pattern & (1 << 7)) ? onpen : offpen);
17371737
1738    // horizontal-middle-left bar
1739    draw_segment_horizontal_caps(tempbitmap,
1740        0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight/2,
1741        segwidth, LINE_CAP_START, (pattern & (1 << 8)) ? onpen : offpen);
1738   // horizontal-middle-left bar
1739   draw_segment_horizontal_caps(tempbitmap,
1740      0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight/2,
1741      segwidth, LINE_CAP_START, (pattern & (1 << 8)) ? onpen : offpen);
17421742
1743    // horizontal-middle-right bar
1744    draw_segment_horizontal_caps(tempbitmap,
1745        0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight/2,
1746        segwidth, LINE_CAP_END, (pattern & (1 << 9)) ? onpen : offpen);
1743   // horizontal-middle-right bar
1744   draw_segment_horizontal_caps(tempbitmap,
1745      0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight/2,
1746      segwidth, LINE_CAP_END, (pattern & (1 << 9)) ? onpen : offpen);
17471747
1748    // vertical-middle-top bar
1749    draw_segment_vertical_caps(tempbitmap,
1750        0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, bmwidth/2,
1751        segwidth, LINE_CAP_NONE, (pattern & (1 << 10)) ? onpen : offpen);
1748   // vertical-middle-top bar
1749   draw_segment_vertical_caps(tempbitmap,
1750      0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, bmwidth/2,
1751      segwidth, LINE_CAP_NONE, (pattern & (1 << 10)) ? onpen : offpen);
17521752
1753    // vertical-middle-bottom bar
1754    draw_segment_vertical_caps(tempbitmap,
1755        bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, bmwidth/2,
1756        segwidth, LINE_CAP_NONE, (pattern & (1 << 11)) ? onpen : offpen);
1753   // vertical-middle-bottom bar
1754   draw_segment_vertical_caps(tempbitmap,
1755      bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, bmwidth/2,
1756      segwidth, LINE_CAP_NONE, (pattern & (1 << 11)) ? onpen : offpen);
17571757
1758    // diagonal-left-bottom bar
1759    draw_segment_diagonal_1(tempbitmap,
1760        0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
1761        bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
1762        segwidth, (pattern & (1 << 12)) ? onpen : offpen);
1758   // diagonal-left-bottom bar
1759   draw_segment_diagonal_1(tempbitmap,
1760      0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
1761      bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
1762      segwidth, (pattern & (1 << 12)) ? onpen : offpen);
17631763
1764    // diagonal-left-top bar
1765    draw_segment_diagonal_2(tempbitmap,
1766        0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
1767        0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
1768        segwidth, (pattern & (1 << 13)) ? onpen : offpen);
1764   // diagonal-left-top bar
1765   draw_segment_diagonal_2(tempbitmap,
1766      0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
1767      0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
1768      segwidth, (pattern & (1 << 13)) ? onpen : offpen);
17691769
1770    // diagonal-right-top bar
1771    draw_segment_diagonal_1(tempbitmap,
1772        bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
1773        0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
1774        segwidth, (pattern & (1 << 14)) ? onpen : offpen);
1770   // diagonal-right-top bar
1771   draw_segment_diagonal_1(tempbitmap,
1772      bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
1773      0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
1774      segwidth, (pattern & (1 << 14)) ? onpen : offpen);
17751775
1776    // diagonal-right-bottom bar
1777    draw_segment_diagonal_2(tempbitmap,
1778        bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
1779        bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
1780        segwidth, (pattern & (1 << 15)) ? onpen : offpen);
1776   // diagonal-right-bottom bar
1777   draw_segment_diagonal_2(tempbitmap,
1778      bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
1779      bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
1780      segwidth, (pattern & (1 << 15)) ? onpen : offpen);
17811781
1782    // apply skew
1783    apply_skew(tempbitmap, 40);
1782   // apply skew
1783   apply_skew(tempbitmap, 40);
17841784
1785    // resample to the target size
1786    render_resample_argb_bitmap_hq(dest, tempbitmap, m_color);
1785   // resample to the target size
1786   render_resample_argb_bitmap_hq(dest, tempbitmap, m_color);
17871787}
17881788
17891789
r242631r242632
17941794
17951795void layout_element::component::draw_led16segsc(bitmap_argb32 &dest, const rectangle &bounds, int pattern)
17961796{
1797    const rgb_t onpen = rgb_t(0xff, 0xff, 0xff, 0xff);
1798    const rgb_t offpen = rgb_t(0xff, 0x20, 0x20, 0x20);
1797   const rgb_t onpen = rgb_t(0xff, 0xff, 0xff, 0xff);
1798   const rgb_t offpen = rgb_t(0xff, 0x20, 0x20, 0x20);
17991799
1800    // sizes for computation
1801    int bmwidth = 250;
1802    int bmheight = 400;
1803    int segwidth = 40;
1804    int skewwidth = 40;
1800   // sizes for computation
1801   int bmwidth = 250;
1802   int bmheight = 400;
1803   int segwidth = 40;
1804   int skewwidth = 40;
18051805
1806    // allocate a temporary bitmap for drawing
1807    bitmap_argb32 tempbitmap(bmwidth + skewwidth, bmheight + segwidth);
1808    tempbitmap.fill(rgb_t(0xff, 0x00, 0x00, 0x00));
1806   // allocate a temporary bitmap for drawing
1807   bitmap_argb32 tempbitmap(bmwidth + skewwidth, bmheight + segwidth);
1808   tempbitmap.fill(rgb_t(0xff, 0x00, 0x00, 0x00));
18091809
1810    // top-left bar
1811    draw_segment_horizontal_caps(tempbitmap,
1812        0 + 2*segwidth/3, bmwidth/2 - segwidth/10, 0 + segwidth/2,
1813        segwidth, LINE_CAP_START, (pattern & (1 << 0)) ? onpen : offpen);
1810   // top-left bar
1811   draw_segment_horizontal_caps(tempbitmap,
1812      0 + 2*segwidth/3, bmwidth/2 - segwidth/10, 0 + segwidth/2,
1813      segwidth, LINE_CAP_START, (pattern & (1 << 0)) ? onpen : offpen);
18141814
1815    // top-right bar
1816    draw_segment_horizontal_caps(tempbitmap,
1817        0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, 0 + segwidth/2,
1818        segwidth, LINE_CAP_END, (pattern & (1 << 1)) ? onpen : offpen);
1815   // top-right bar
1816   draw_segment_horizontal_caps(tempbitmap,
1817      0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, 0 + segwidth/2,
1818      segwidth, LINE_CAP_END, (pattern & (1 << 1)) ? onpen : offpen);
18191819
1820    // right-top bar
1821    draw_segment_vertical(tempbitmap,
1822        0 + 2*segwidth/3, bmheight/2 - segwidth/3, bmwidth - segwidth/2,
1823        segwidth, (pattern & (1 << 2)) ? onpen : offpen);
1820   // right-top bar
1821   draw_segment_vertical(tempbitmap,
1822      0 + 2*segwidth/3, bmheight/2 - segwidth/3, bmwidth - segwidth/2,
1823      segwidth, (pattern & (1 << 2)) ? onpen : offpen);
18241824
1825    // right-bottom bar
1826    draw_segment_vertical(tempbitmap,
1827        bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, bmwidth - segwidth/2,
1828        segwidth, (pattern & (1 << 3)) ? onpen : offpen);
1825   // right-bottom bar
1826   draw_segment_vertical(tempbitmap,
1827      bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, bmwidth - segwidth/2,
1828      segwidth, (pattern & (1 << 3)) ? onpen : offpen);
18291829
1830    // bottom-right bar
1831    draw_segment_horizontal_caps(tempbitmap,
1832        0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight - segwidth/2,
1833        segwidth, LINE_CAP_END, (pattern & (1 << 4)) ? onpen : offpen);
1830   // bottom-right bar
1831   draw_segment_horizontal_caps(tempbitmap,
1832      0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight - segwidth/2,
1833      segwidth, LINE_CAP_END, (pattern & (1 << 4)) ? onpen : offpen);
18341834
1835    // bottom-left bar
1836    draw_segment_horizontal_caps(tempbitmap,
1837        0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight - segwidth/2,
1838        segwidth, LINE_CAP_START, (pattern & (1 << 5)) ? onpen : offpen);
1835   // bottom-left bar
1836   draw_segment_horizontal_caps(tempbitmap,
1837      0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight - segwidth/2,
1838      segwidth, LINE_CAP_START, (pattern & (1 << 5)) ? onpen : offpen);
18391839
1840    // left-bottom bar
1841    draw_segment_vertical(tempbitmap,
1842        bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, 0 + segwidth/2,
1843        segwidth, (pattern & (1 << 6)) ? onpen : offpen);
1840   // left-bottom bar
1841   draw_segment_vertical(tempbitmap,
1842      bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, 0 + segwidth/2,
1843      segwidth, (pattern & (1 << 6)) ? onpen : offpen);
18441844
1845    // left-top bar
1846    draw_segment_vertical(tempbitmap,
1847        0 + 2*segwidth/3, bmheight/2 - segwidth/3, 0 + segwidth/2,
1848        segwidth, (pattern & (1 << 7)) ? onpen : offpen);
1845   // left-top bar
1846   draw_segment_vertical(tempbitmap,
1847      0 + 2*segwidth/3, bmheight/2 - segwidth/3, 0 + segwidth/2,
1848      segwidth, (pattern & (1 << 7)) ? onpen : offpen);
18491849
1850    // horizontal-middle-left bar
1851    draw_segment_horizontal_caps(tempbitmap,
1852        0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight/2,
1853        segwidth, LINE_CAP_START, (pattern & (1 << 8)) ? onpen : offpen);
1850   // horizontal-middle-left bar
1851   draw_segment_horizontal_caps(tempbitmap,
1852      0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight/2,
1853      segwidth, LINE_CAP_START, (pattern & (1 << 8)) ? onpen : offpen);
18541854
1855    // horizontal-middle-right bar
1856    draw_segment_horizontal_caps(tempbitmap,
1857        0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight/2,
1858        segwidth, LINE_CAP_END, (pattern & (1 << 9)) ? onpen : offpen);
1855   // horizontal-middle-right bar
1856   draw_segment_horizontal_caps(tempbitmap,
1857      0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight/2,
1858      segwidth, LINE_CAP_END, (pattern & (1 << 9)) ? onpen : offpen);
18591859
1860    // vertical-middle-top bar
1861    draw_segment_vertical_caps(tempbitmap,
1862        0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, bmwidth/2,
1863        segwidth, LINE_CAP_NONE, (pattern & (1 << 10)) ? onpen : offpen);
1860   // vertical-middle-top bar
1861   draw_segment_vertical_caps(tempbitmap,
1862      0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, bmwidth/2,
1863      segwidth, LINE_CAP_NONE, (pattern & (1 << 10)) ? onpen : offpen);
18641864
1865    // vertical-middle-bottom bar
1866    draw_segment_vertical_caps(tempbitmap,
1867        bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, bmwidth/2,
1868        segwidth, LINE_CAP_NONE, (pattern & (1 << 11)) ? onpen : offpen);
1865   // vertical-middle-bottom bar
1866   draw_segment_vertical_caps(tempbitmap,
1867      bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, bmwidth/2,
1868      segwidth, LINE_CAP_NONE, (pattern & (1 << 11)) ? onpen : offpen);
18691869
1870    // diagonal-left-bottom bar
1871    draw_segment_diagonal_1(tempbitmap,
1872        0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
1873        bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
1874        segwidth, (pattern & (1 << 12)) ? onpen : offpen);
1870   // diagonal-left-bottom bar
1871   draw_segment_diagonal_1(tempbitmap,
1872      0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
1873      bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
1874      segwidth, (pattern & (1 << 12)) ? onpen : offpen);
18751875
1876    // diagonal-left-top bar
1877    draw_segment_diagonal_2(tempbitmap,
1878        0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
1879        0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
1880        segwidth, (pattern & (1 << 13)) ? onpen : offpen);
1876   // diagonal-left-top bar
1877   draw_segment_diagonal_2(tempbitmap,
1878      0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
1879      0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
1880      segwidth, (pattern & (1 << 13)) ? onpen : offpen);
18811881
1882    // diagonal-right-top bar
1883    draw_segment_diagonal_1(tempbitmap,
1884        bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
1885        0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
1886        segwidth, (pattern & (1 << 14)) ? onpen : offpen);
1882   // diagonal-right-top bar
1883   draw_segment_diagonal_1(tempbitmap,
1884      bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
1885      0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
1886      segwidth, (pattern & (1 << 14)) ? onpen : offpen);
18871887
1888    // diagonal-right-bottom bar
1889    draw_segment_diagonal_2(tempbitmap,
1890        bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
1891        bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
1892        segwidth, (pattern & (1 << 15)) ? onpen : offpen);
1888   // diagonal-right-bottom bar
1889   draw_segment_diagonal_2(tempbitmap,
1890      bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
1891      bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
1892      segwidth, (pattern & (1 << 15)) ? onpen : offpen);
18931893
1894    // comma tail
1895    draw_segment_diagonal_1(tempbitmap,
1896        bmwidth - (segwidth/2), bmwidth + segwidth,
1897        bmheight - (segwidth), bmheight + segwidth*1.5,
1898        segwidth/2, (pattern & (1 << 17)) ? onpen : offpen);
1894   // comma tail
1895   draw_segment_diagonal_1(tempbitmap,
1896      bmwidth - (segwidth/2), bmwidth + segwidth,
1897      bmheight - (segwidth), bmheight + segwidth*1.5,
1898      segwidth/2, (pattern & (1 << 17)) ? onpen : offpen);
18991899
1900    // decimal point (draw last for priority)
1901    draw_segment_decimal(tempbitmap, bmwidth + segwidth/2, bmheight - segwidth/2, segwidth, (pattern & (1 << 16)) ? onpen : offpen);
1900   // decimal point (draw last for priority)
1901   draw_segment_decimal(tempbitmap, bmwidth + segwidth/2, bmheight - segwidth/2, segwidth, (pattern & (1 << 16)) ? onpen : offpen);
19021902
1903    // apply skew
1904    apply_skew(tempbitmap, 40);
1903   // apply skew
1904   apply_skew(tempbitmap, 40);
19051905
1906    // resample to the target size
1907    render_resample_argb_bitmap_hq(dest, tempbitmap, m_color);
1906   // resample to the target size
1907   render_resample_argb_bitmap_hq(dest, tempbitmap, m_color);
19081908}
19091909
19101910
r242631r242632
19151915
19161916void layout_element::component::draw_dotmatrix(int dots, bitmap_argb32 &dest, const rectangle &bounds, int pattern)
19171917{
1918    const rgb_t onpen = rgb_t(0xff, 0xff, 0xff, 0xff);
1919    const rgb_t offpen = rgb_t(0xff, 0x20, 0x20, 0x20);
1918   const rgb_t onpen = rgb_t(0xff, 0xff, 0xff, 0xff);
1919   const rgb_t offpen = rgb_t(0xff, 0x20, 0x20, 0x20);
19201920
1921    // sizes for computation
1922    int bmheight = 300;
1923    int dotwidth = 250;
1921   // sizes for computation
1922   int bmheight = 300;
1923   int dotwidth = 250;
19241924
1925    // allocate a temporary bitmap for drawing
1926    bitmap_argb32 tempbitmap(dotwidth*dots, bmheight);
1927    tempbitmap.fill(rgb_t(0xff, 0x00, 0x00, 0x00));
1925   // allocate a temporary bitmap for drawing
1926   bitmap_argb32 tempbitmap(dotwidth*dots, bmheight);
1927   tempbitmap.fill(rgb_t(0xff, 0x00, 0x00, 0x00));
19281928
1929    for (int i = 0; i < dots; i++)
1930        draw_segment_decimal(tempbitmap, ((dotwidth/2 )+ (i * dotwidth)), bmheight/2, dotwidth, (pattern & (1 << i))?onpen:offpen);
1929   for (int i = 0; i < dots; i++)
1930      draw_segment_decimal(tempbitmap, ((dotwidth/2 )+ (i * dotwidth)), bmheight/2, dotwidth, (pattern & (1 << i))?onpen:offpen);
19311931
1932    // resample to the target size
1933    render_resample_argb_bitmap_hq(dest, tempbitmap, m_color);
1932   // resample to the target size
1933   render_resample_argb_bitmap_hq(dest, tempbitmap, m_color);
19341934}
19351935
19361936
r242631r242632
19421942
19431943void layout_element::component::draw_segment_horizontal_caps(bitmap_argb32 &dest, int minx, int maxx, int midy, int width, int caps, rgb_t color)
19441944{
1945    // loop over the width of the segment
1946    for (int y = 0; y < width / 2; y++)
1947    {
1948        UINT32 *d0 = &dest.pix32(midy - y);
1949        UINT32 *d1 = &dest.pix32(midy + y);
1950        int ty = (y < width / 8) ? width / 8 : y;
1945   // loop over the width of the segment
1946   for (int y = 0; y < width / 2; y++)
1947   {
1948      UINT32 *d0 = &dest.pix32(midy - y);
1949      UINT32 *d1 = &dest.pix32(midy + y);
1950      int ty = (y < width / 8) ? width / 8 : y;
19511951
1952        // loop over the length of the segment
1953        for (int x = minx + ((caps & LINE_CAP_START) ? ty : 0); x < maxx - ((caps & LINE_CAP_END) ? ty : 0); x++)
1954            d0[x] = d1[x] = color;
1955    }
1952      // loop over the length of the segment
1953      for (int x = minx + ((caps & LINE_CAP_START) ? ty : 0); x < maxx - ((caps & LINE_CAP_END) ? ty : 0); x++)
1954         d0[x] = d1[x] = color;
1955   }
19561956}
19571957
19581958
r242631r242632
19631963
19641964void layout_element::component::draw_segment_horizontal(bitmap_argb32 &dest, int minx, int maxx, int midy, int width, rgb_t color)
19651965{
1966    draw_segment_horizontal_caps(dest, minx, maxx, midy, width, LINE_CAP_START | LINE_CAP_END, color);
1966   draw_segment_horizontal_caps(dest, minx, maxx, midy, width, LINE_CAP_START | LINE_CAP_END, color);
19671967}
19681968
19691969
r242631r242632
19751975
19761976void layout_element::component::draw_segment_vertical_caps(bitmap_argb32 &dest, int miny, int maxy, int midx, int width, int caps, rgb_t color)
19771977{
1978    // loop over the width of the segment
1979    for (int x = 0; x < width / 2; x++)
1980    {
1981        UINT32 *d0 = &dest.pix32(0, midx - x);
1982        UINT32 *d1 = &dest.pix32(0, midx + x);
1983        int tx = (x < width / 8) ? width / 8 : x;
1978   // loop over the width of the segment
1979   for (int x = 0; x < width / 2; x++)
1980   {
1981      UINT32 *d0 = &dest.pix32(0, midx - x);
1982      UINT32 *d1 = &dest.pix32(0, midx + x);
1983      int tx = (x < width / 8) ? width / 8 : x;
19841984
1985        // loop over the length of the segment
1986        for (int y = miny + ((caps & LINE_CAP_START) ? tx : 0); y < maxy - ((caps & LINE_CAP_END) ? tx : 0); y++)
1987            d0[y * dest.rowpixels()] = d1[y * dest.rowpixels()] = color;
1988    }
1985      // loop over the length of the segment
1986      for (int y = miny + ((caps & LINE_CAP_START) ? tx : 0); y < maxy - ((caps & LINE_CAP_END) ? tx : 0); y++)
1987         d0[y * dest.rowpixels()] = d1[y * dest.rowpixels()] = color;
1988   }
19891989}
19901990
19911991
r242631r242632
19961996
19971997void layout_element::component::draw_segment_vertical(bitmap_argb32 &dest, int miny, int maxy, int midx, int width, rgb_t color)
19981998{
1999    draw_segment_vertical_caps(dest, miny, maxy, midx, width, LINE_CAP_START | LINE_CAP_END, color);
1999   draw_segment_vertical_caps(dest, miny, maxy, midx, width, LINE_CAP_START | LINE_CAP_END, color);
20002000}
20012001
20022002
r242631r242632
20072007
20082008void layout_element::component::draw_segment_diagonal_1(bitmap_argb32 &dest, int minx, int maxx, int miny, int maxy, int width, rgb_t color)
20092009{
2010    // compute parameters
2011    width *= 1.5;
2012    float ratio = (maxy - miny - width) / (float)(maxx - minx);
2010   // compute parameters
2011   width *= 1.5;
2012   float ratio = (maxy - miny - width) / (float)(maxx - minx);
20132013
2014    // draw line
2015    for (int x = minx; x < maxx; x++)
2016        if (x >= 0 && x < dest.width())
2017        {
2018            UINT32 *d = &dest.pix32(0, x);
2019            int step = (x - minx) * ratio;
2014   // draw line
2015   for (int x = minx; x < maxx; x++)
2016      if (x >= 0 && x < dest.width())
2017      {
2018         UINT32 *d = &dest.pix32(0, x);
2019         int step = (x - minx) * ratio;
20202020
2021            for (int y = maxy - width - step; y < maxy - step; y++)
2022                if (y >= 0 && y < dest.height())
2023                    d[y * dest.rowpixels()] = color;
2024        }
2021         for (int y = maxy - width - step; y < maxy - step; y++)
2022            if (y >= 0 && y < dest.height())
2023               d[y * dest.rowpixels()] = color;
2024      }
20252025}
20262026
20272027
r242631r242632
20322032
20332033void layout_element::component::draw_segment_diagonal_2(bitmap_argb32 &dest, int minx, int maxx, int miny, int maxy, int width, rgb_t color)
20342034{
2035    // compute parameters
2036    width *= 1.5;
2037    float ratio = (maxy - miny - width) / (float)(maxx - minx);
2035   // compute parameters
2036   width *= 1.5;
2037   float ratio = (maxy - miny - width) / (float)(maxx - minx);
20382038
2039    // draw line
2040    for (int x = minx; x < maxx; x++)
2041        if (x >= 0 && x < dest.width())
2042        {
2043            UINT32 *d = &dest.pix32(0, x);
2044            int step = (x - minx) * ratio;
2039   // draw line
2040   for (int x = minx; x < maxx; x++)
2041      if (x >= 0 && x < dest.width())
2042      {
2043         UINT32 *d = &dest.pix32(0, x);
2044         int step = (x - minx) * ratio;
20452045
2046            for (int y = miny + step; y < miny + step + width; y++)
2047                if (y >= 0 && y < dest.height())
2048                    d[y * dest.rowpixels()] = color;
2049        }
2046         for (int y = miny + step; y < miny + step + width; y++)
2047            if (y >= 0 && y < dest.height())
2048               d[y * dest.rowpixels()] = color;
2049      }
20502050}
20512051
20522052
r242631r242632
20562056
20572057void layout_element::component::draw_segment_decimal(bitmap_argb32 &dest, int midx, int midy, int width, rgb_t color)
20582058{
2059    // compute parameters
2060    width /= 2;
2061    float ooradius2 = 1.0f / (float)(width * width);
2059   // compute parameters
2060   width /= 2;
2061   float ooradius2 = 1.0f / (float)(width * width);
20622062
2063    // iterate over y
2064    for (UINT32 y = 0; y <= width; y++)
2065    {
2066        UINT32 *d0 = &dest.pix32(midy - y);
2067        UINT32 *d1 = &dest.pix32(midy + y);
2068        float xval = width * sqrt(1.0f - (float)(y * y) * ooradius2);
2069        INT32 left, right;
2063   // iterate over y
2064   for (UINT32 y = 0; y <= width; y++)
2065   {
2066      UINT32 *d0 = &dest.pix32(midy - y);
2067      UINT32 *d1 = &dest.pix32(midy + y);
2068      float xval = width * sqrt(1.0f - (float)(y * y) * ooradius2);
2069      INT32 left, right;
20702070
2071        // compute left/right coordinates
2072        left = midx - (INT32)(xval + 0.5f);
2073        right = midx + (INT32)(xval + 0.5f);
2071      // compute left/right coordinates
2072      left = midx - (INT32)(xval + 0.5f);
2073      right = midx + (INT32)(xval + 0.5f);
20742074
2075        // draw this scanline
2076        for (UINT32 x = left; x < right; x++)
2077            d0[x] = d1[x] = color;
2078    }
2075      // draw this scanline
2076      for (UINT32 x = left; x < right; x++)
2077         d0[x] = d1[x] = color;
2078   }
20792079}
20802080
20812081
r242631r242632
20852085
20862086void layout_element::component::draw_segment_comma(bitmap_argb32 &dest, int minx, int maxx, int miny, int maxy, int width, rgb_t color)
20872087{
2088    // compute parameters
2089    width *= 1.5;
2090    float ratio = (maxy - miny - width) / (float)(maxx - minx);
2088   // compute parameters
2089   width *= 1.5;
2090   float ratio = (maxy - miny - width) / (float)(maxx - minx);
20912091
2092    // draw line
2093    for (int x = minx; x < maxx; x++)
2094    {
2095        UINT32 *d = &dest.pix32(0, x);
2096        int step = (x - minx) * ratio;
2092   // draw line
2093   for (int x = minx; x < maxx; x++)
2094   {
2095      UINT32 *d = &dest.pix32(0, x);
2096      int step = (x - minx) * ratio;
20972097
2098        for (int y = maxy; y < maxy  - width - step; y--)
2099            d[y * dest.rowpixels()] = color;
2100    }
2098      for (int y = maxy; y < maxy  - width - step; y--)
2099         d[y * dest.rowpixels()] = color;
2100   }
21012101}
21022102
21032103
r242631r242632
21072107
21082108void layout_element::component::apply_skew(bitmap_argb32 &dest, int skewwidth)
21092109{
2110    for (int y = 0; y < dest.height(); y++)
2111    {
2112        UINT32 *destrow = &dest.pix32(y);
2113        int offs = skewwidth * (dest.height() - y) / dest.height();
2114        for (int x = dest.width() - skewwidth - 1; x >= 0; x--)
2115            destrow[x + offs] = destrow[x];
2116        for (int x = 0; x < offs; x++)
2117            destrow[x] = 0;
2118    }
2110   for (int y = 0; y < dest.height(); y++)
2111   {
2112      UINT32 *destrow = &dest.pix32(y);
2113      int offs = skewwidth * (dest.height() - y) / dest.height();
2114      for (int x = dest.width() - skewwidth - 1; x >= 0; x--)
2115         destrow[x + offs] = destrow[x];
2116      for (int x = 0; x < offs; x++)
2117         destrow[x] = 0;
2118   }
21192119}
21202120
21212121
r242631r242632
21292129//-------------------------------------------------
21302130
21312131layout_view::layout_view(running_machine &machine, xml_data_node &viewnode, simple_list<layout_element> &elemlist)
2132    : m_next(NULL),
2133        m_aspect(1.0f),
2134        m_scraspect(1.0f)
2132   : m_next(NULL),
2133      m_aspect(1.0f),
2134      m_scraspect(1.0f)
21352135{
2136    // allocate a copy of the name
2137    m_name = xml_get_attribute_string_with_subst(machine, viewnode, "name", "");
2136   // allocate a copy of the name
2137   m_name = xml_get_attribute_string_with_subst(machine, viewnode, "name", "");
21382138
2139    // if we have a bounds item, load it
2140    xml_data_node *boundsnode = xml_get_sibling(viewnode.child, "bounds");
2141    m_expbounds.x0 = m_expbounds.y0 = m_expbounds.x1 = m_expbounds.y1 = 0;
2142    if (boundsnode != NULL)
2143        parse_bounds(machine, xml_get_sibling(boundsnode, "bounds"), m_expbounds);
2139   // if we have a bounds item, load it
2140   xml_data_node *boundsnode = xml_get_sibling(viewnode.child, "bounds");
2141   m_expbounds.x0 = m_expbounds.y0 = m_expbounds.x1 = m_expbounds.y1 = 0;
2142   if (boundsnode != NULL)
2143      parse_bounds(machine, xml_get_sibling(boundsnode, "bounds"), m_expbounds);
21442144
2145    // load backdrop items
2146    for (xml_data_node *itemnode = xml_get_sibling(viewnode.child, "backdrop"); itemnode != NULL; itemnode = xml_get_sibling(itemnode->next, "backdrop"))
2147        m_backdrop_list.append(*global_alloc(item(machine, *itemnode, elemlist)));
2145   // load backdrop items
2146   for (xml_data_node *itemnode = xml_get_sibling(viewnode.child, "backdrop"); itemnode != NULL; itemnode = xml_get_sibling(itemnode->next, "backdrop"))
2147      m_backdrop_list.append(*global_alloc(item(machine, *itemnode, elemlist)));
21482148
2149    // load screen items
2150    for (xml_data_node *itemnode = xml_get_sibling(viewnode.child, "screen"); itemnode != NULL; itemnode = xml_get_sibling(itemnode->next, "screen"))
2151        m_screen_list.append(*global_alloc(item(machine, *itemnode, elemlist)));
2149   // load screen items
2150   for (xml_data_node *itemnode = xml_get_sibling(viewnode.child, "screen"); itemnode != NULL; itemnode = xml_get_sibling(itemnode->next, "screen"))
2151      m_screen_list.append(*global_alloc(item(machine, *itemnode, elemlist)));
21522152
2153    // load overlay items
2154    for (xml_data_node *itemnode = xml_get_sibling(viewnode.child, "overlay"); itemnode != NULL; itemnode = xml_get_sibling(itemnode->next, "overlay"))
2155        m_overlay_list.append(*global_alloc(item(machine, *itemnode, elemlist)));
2153   // load overlay items
2154   for (xml_data_node *itemnode = xml_get_sibling(viewnode.child, "overlay"); itemnode != NULL; itemnode = xml_get_sibling(itemnode->next, "overlay"))
2155      m_overlay_list.append(*global_alloc(item(machine, *itemnode, elemlist)));
21562156
2157    // load bezel items
2158    for (xml_data_node *itemnode = xml_get_sibling(viewnode.child, "bezel"); itemnode != NULL; itemnode = xml_get_sibling(itemnode->next, "bezel"))
2159        m_bezel_list.append(*global_alloc(item(machine, *itemnode, elemlist)));
2157   // load bezel items
2158   for (xml_data_node *itemnode = xml_get_sibling(viewnode.child, "bezel"); itemnode != NULL; itemnode = xml_get_sibling(itemnode->next, "bezel"))
2159      m_bezel_list.append(*global_alloc(item(machine, *itemnode, elemlist)));
21602160
2161    // load cpanel items
2162    for (xml_data_node *itemnode = xml_get_sibling(viewnode.child, "cpanel"); itemnode != NULL; itemnode = xml_get_sibling(itemnode->next, "cpanel"))
2163        m_cpanel_list.append(*global_alloc(item(machine, *itemnode, elemlist)));
2161   // load cpanel items
2162   for (xml_data_node *itemnode = xml_get_sibling(viewnode.child, "cpanel"); itemnode != NULL; itemnode = xml_get_sibling(itemnode->next, "cpanel"))
2163      m_cpanel_list.append(*global_alloc(item(machine, *itemnode, elemlist)));
21642164
2165    // load marquee items
2166    for (xml_data_node *itemnode = xml_get_sibling(viewnode.child, "marquee"); itemnode != NULL; itemnode = xml_get_sibling(itemnode->next, "marquee"))
2167        m_marquee_list.append(*global_alloc(item(machine, *itemnode, elemlist)));
2165   // load marquee items
2166   for (xml_data_node *itemnode = xml_get_sibling(viewnode.child, "marquee"); itemnode != NULL; itemnode = xml_get_sibling(itemnode->next, "marquee"))
2167      m_marquee_list.append(*global_alloc(item(machine, *itemnode, elemlist)));
21682168
2169    // recompute the data for the view based on a default layer config
2170    recompute(render_layer_config());
2169   // recompute the data for the view based on a default layer config
2170   recompute(render_layer_config());
21712171}
21722172
21732173
r242631r242632
21872187
21882188layout_view::item *layout_view::first_item(item_layer layer) const
21892189{
2190    switch (layer)
2191    {
2192        case ITEM_LAYER_BACKDROP:   return m_backdrop_list.first();
2193        case ITEM_LAYER_SCREEN:     return m_screen_list.first();
2194        case ITEM_LAYER_OVERLAY:    return m_overlay_list.first();
2195        case ITEM_LAYER_BEZEL:      return m_bezel_list.first();
2196        case ITEM_LAYER_CPANEL:     return m_cpanel_list.first();
2197        case ITEM_LAYER_MARQUEE:    return m_marquee_list.first();
2198        default:                    return NULL;
2199    }
2190   switch (layer)
2191   {
2192      case ITEM_LAYER_BACKDROP:   return m_backdrop_list.first();
2193      case ITEM_LAYER_SCREEN:     return m_screen_list.first();
2194      case ITEM_LAYER_OVERLAY:    return m_overlay_list.first();
2195      case ITEM_LAYER_BEZEL:      return m_bezel_list.first();
2196      case ITEM_LAYER_CPANEL:     return m_cpanel_list.first();
2197      case ITEM_LAYER_MARQUEE:    return m_marquee_list.first();
2198      default:                    return NULL;
2199   }
22002200}
22012201
22022202
r242631r242632
22072207
22082208void layout_view::recompute(render_layer_config layerconfig)
22092209{
2210    // reset the bounds
2211    m_bounds.x0 = m_bounds.y0 = m_bounds.x1 = m_bounds.y1 = 0.0f;
2212    m_scrbounds.x0 = m_scrbounds.y0 = m_scrbounds.x1 = m_scrbounds.y1 = 0.0f;
2213    m_screens.reset();
2210   // reset the bounds
2211   m_bounds.x0 = m_bounds.y0 = m_bounds.x1 = m_bounds.y1 = 0.0f;
2212   m_scrbounds.x0 = m_scrbounds.y0 = m_scrbounds.x1 = m_scrbounds.y1 = 0.0f;
2213   m_screens.reset();
22142214
2215    // loop over all layers
2216    bool first = true;
2217    bool scrfirst = true;
2218    for (item_layer layer = ITEM_LAYER_FIRST; layer < ITEM_LAYER_MAX; layer++)
2219    {
2220        // determine if this layer should be visible
2221        switch (layer)
2222        {
2223            case ITEM_LAYER_BACKDROP:   m_layenabled[layer] = layerconfig.backdrops_enabled();  break;
2224            case ITEM_LAYER_OVERLAY:    m_layenabled[layer] = layerconfig.overlays_enabled();   break;
2225            case ITEM_LAYER_BEZEL:      m_layenabled[layer] = layerconfig.bezels_enabled();     break;
2226            case ITEM_LAYER_CPANEL:     m_layenabled[layer] = layerconfig.cpanels_enabled();    break;
2227            case ITEM_LAYER_MARQUEE:    m_layenabled[layer] = layerconfig.marquees_enabled();   break;
2228            default:                    m_layenabled[layer] = true;                             break;
2229        }
2215   // loop over all layers
2216   bool first = true;
2217   bool scrfirst = true;
2218   for (item_layer layer = ITEM_LAYER_FIRST; layer < ITEM_LAYER_MAX; layer++)
2219   {
2220      // determine if this layer should be visible
2221      switch (layer)
2222      {
2223         case ITEM_LAYER_BACKDROP:   m_layenabled[layer] = layerconfig.backdrops_enabled();  break;
2224         case ITEM_LAYER_OVERLAY:    m_layenabled[layer] = layerconfig.overlays_enabled();   break;
2225         case ITEM_LAYER_BEZEL:      m_layenabled[layer] = layerconfig.bezels_enabled();     break;
2226         case ITEM_LAYER_CPANEL:     m_layenabled[layer] = layerconfig.cpanels_enabled();    break;
2227         case ITEM_LAYER_MARQUEE:    m_layenabled[layer] = layerconfig.marquees_enabled();   break;
2228         default:                    m_layenabled[layer] = true;                             break;
2229      }
22302230
2231        // only do it if requested
2232        if (m_layenabled[layer])
2233            for (item *curitem = first_item(layer); curitem != NULL; curitem = curitem->next())
2234            {
2235                // accumulate bounds
2236                if (first)
2237                    m_bounds = curitem->m_rawbounds;
2238                else
2239                    union_render_bounds(&m_bounds, &curitem->m_rawbounds);
2240                first = false;
2231      // only do it if requested
2232      if (m_layenabled[layer])
2233         for (item *curitem = first_item(layer); curitem != NULL; curitem = curitem->next())
2234         {
2235            // accumulate bounds
2236            if (first)
2237               m_bounds = curitem->m_rawbounds;
2238            else
2239               union_render_bounds(&m_bounds, &curitem->m_rawbounds);
2240            first = false;
22412241
2242                // accumulate screen bounds
2243                if (curitem->m_screen != NULL)
2244                {
2245                    if (scrfirst)
2246                        m_scrbounds = curitem->m_rawbounds;
2247                    else
2248                        union_render_bounds(&m_scrbounds, &curitem->m_rawbounds);
2249                    scrfirst = false;
2242            // accumulate screen bounds
2243            if (curitem->m_screen != NULL)
2244            {
2245               if (scrfirst)
2246                  m_scrbounds = curitem->m_rawbounds;
2247               else
2248                  union_render_bounds(&m_scrbounds, &curitem->m_rawbounds);
2249               scrfirst = false;
22502250
2251                    // accumulate the screens in use while we're scanning
2252                    m_screens.add(*curitem->m_screen);
2253                }
2254            }
2255    }
2251               // accumulate the screens in use while we're scanning
2252               m_screens.add(*curitem->m_screen);
2253            }
2254         }
2255   }
22562256
2257    // if we have an explicit bounds, override it
2258    if (m_expbounds.x1 > m_expbounds.x0)
2259        m_bounds = m_expbounds;
2257   // if we have an explicit bounds, override it
2258   if (m_expbounds.x1 > m_expbounds.x0)
2259      m_bounds = m_expbounds;
22602260
2261    // if we're handling things normally, the target bounds are (0,0)-(1,1)
2262    render_bounds target_bounds;
2263    if (!layerconfig.zoom_to_screen() || m_screens.count() == 0)
2264    {
2265        // compute the aspect ratio of the view
2266        m_aspect = (m_bounds.x1 - m_bounds.x0) / (m_bounds.y1 - m_bounds.y0);
2261   // if we're handling things normally, the target bounds are (0,0)-(1,1)
2262   render_bounds target_bounds;
2263   if (!layerconfig.zoom_to_screen() || m_screens.count() == 0)
2264   {
2265      // compute the aspect ratio of the view
2266      m_aspect = (m_bounds.x1 - m_bounds.x0) / (m_bounds.y1 - m_bounds.y0);
22672267
2268        target_bounds.x0 = target_bounds.y0 = 0.0f;
2269        target_bounds.x1 = target_bounds.y1 = 1.0f;
2270    }
2268      target_bounds.x0 = target_bounds.y0 = 0.0f;
2269      target_bounds.x1 = target_bounds.y1 = 1.0f;
2270   }
22712271
2272    // if we're cropping, we want the screen area to fill (0,0)-(1,1)
2273    else
2274    {
2275        // compute the aspect ratio of the screen
2276        m_scraspect = (m_scrbounds.x1 - m_scrbounds.x0) / (m_scrbounds.y1 - m_scrbounds.y0);
2272   // if we're cropping, we want the screen area to fill (0,0)-(1,1)
2273   else
2274   {
2275      // compute the aspect ratio of the screen
2276      m_scraspect = (m_scrbounds.x1 - m_scrbounds.x0) / (m_scrbounds.y1 - m_scrbounds.y0);
22772277
2278        float targwidth = (m_bounds.x1 - m_bounds.x0) / (m_scrbounds.x1 - m_scrbounds.x0);
2279        float targheight = (m_bounds.y1 - m_bounds.y0) / (m_scrbounds.y1 - m_scrbounds.y0);
2280        target_bounds.x0 = (m_bounds.x0 - m_scrbounds.x0) / (m_bounds.x1 - m_bounds.x0) * targwidth;
2281        target_bounds.y0 = (m_bounds.y0 - m_scrbounds.y0) / (m_bounds.y1 - m_bounds.y0) * targheight;
2282        target_bounds.x1 = target_bounds.x0 + targwidth;
2283        target_bounds.y1 = target_bounds.y0 + targheight;
2284    }
2278      float targwidth = (m_bounds.x1 - m_bounds.x0) / (m_scrbounds.x1 - m_scrbounds.x0);
2279      float targheight = (m_bounds.y1 - m_bounds.y0) / (m_scrbounds.y1 - m_scrbounds.y0);
2280      target_bounds.x0 = (m_bounds.x0 - m_scrbounds.x0) / (m_bounds.x1 - m_bounds.x0) * targwidth;
2281      target_bounds.y0 = (m_bounds.y0 - m_scrbounds.y0) / (m_bounds.y1 - m_bounds.y0) * targheight;
2282      target_bounds.x1 = target_bounds.x0 + targwidth;
2283      target_bounds.y1 = target_bounds.y0 + targheight;
2284   }
22852285
2286    // determine the scale/offset for normalization
2287    float xoffs = m_bounds.x0;
2288    float yoffs = m_bounds.y0;
2289    float xscale = (target_bounds.x1 - target_bounds.x0) / (m_bounds.x1 - m_bounds.x0);
2290    float yscale = (target_bounds.y1 - target_bounds.y0) / (m_bounds.y1 - m_bounds.y0);
2286   // determine the scale/offset for normalization
2287   float xoffs = m_bounds.x0;
2288   float yoffs = m_bounds.y0;
2289   float xscale = (target_bounds.x1 - target_bounds.x0) / (m_bounds.x1 - m_bounds.x0);
2290   float yscale = (target_bounds.y1 - target_bounds.y0) / (m_bounds.y1 - m_bounds.y0);
22912291
2292    // normalize all the item bounds
2293    for (item_layer layer = ITEM_LAYER_FIRST; layer < ITEM_LAYER_MAX; layer++)
2294        for (item *curitem = first_item(layer); curitem != NULL; curitem = curitem->next())
2295        {
2296            curitem->m_bounds.x0 = target_bounds.x0 + (curitem->m_rawbounds.x0 - xoffs) * xscale;
2297            curitem->m_bounds.x1 = target_bounds.x0 + (curitem->m_rawbounds.x1 - xoffs) * xscale;
2298            curitem->m_bounds.y0 = target_bounds.y0 + (curitem->m_rawbounds.y0 - yoffs) * yscale;
2299            curitem->m_bounds.y1 = target_bounds.y0 + (curitem->m_rawbounds.y1 - yoffs) * yscale;
2300        }
2292   // normalize all the item bounds
2293   for (item_layer layer = ITEM_LAYER_FIRST; layer < ITEM_LAYER_MAX; layer++)
2294      for (item *curitem = first_item(layer); curitem != NULL; curitem = curitem->next())
2295      {
2296         curitem->m_bounds.x0 = target_bounds.x0 + (curitem->m_rawbounds.x0 - xoffs) * xscale;
2297         curitem->m_bounds.x1 = target_bounds.x0 + (curitem->m_rawbounds.x1 - xoffs) * xscale;
2298         curitem->m_bounds.y0 = target_bounds.y0 + (curitem->m_rawbounds.y0 - yoffs) * yscale;
2299         curitem->m_bounds.y1 = target_bounds.y0 + (curitem->m_rawbounds.y1 - yoffs) * yscale;
2300      }
23012301}
23022302
23032303
r242631r242632
23112311//-------------------------------------------------
23122312
23132313layout_view::item::item(running_machine &machine, xml_data_node &itemnode, simple_list<layout_element> &elemlist)
2314    : m_next(NULL),
2315        m_element(NULL),
2316        m_input_mask(0),
2317        m_screen(NULL),
2318        m_orientation(ROT0)
2314   : m_next(NULL),
2315      m_element(NULL),
2316      m_input_mask(0),
2317      m_screen(NULL),
2318      m_orientation(ROT0)
23192319{
2320    // allocate a copy of the output name
2321    m_output_name = xml_get_attribute_string_with_subst(machine, itemnode, "name", "");
2320   // allocate a copy of the output name
2321   m_output_name = xml_get_attribute_string_with_subst(machine, itemnode, "name", "");
23222322
2323    // allocate a copy of the input tag
2324    m_input_tag = xml_get_attribute_string_with_subst(machine, itemnode, "inputtag", "");
2323   // allocate a copy of the input tag
2324   m_input_tag = xml_get_attribute_string_with_subst(machine, itemnode, "inputtag", "");
23252325
2326    // find the associated element
2327    const char *name = xml_get_attribute_string_with_subst(machine, itemnode, "element", NULL);
2328    if (name != NULL)
2329    {
2330        // search the list of elements for a match
2331        for (m_element = elemlist.first(); m_element != NULL; m_element = m_element->next())
2332            if (strcmp(name, m_element->name()) == 0)
2333                break;
2326   // find the associated element
2327   const char *name = xml_get_attribute_string_with_subst(machine, itemnode, "element", NULL);
2328   if (name != NULL)
2329   {
2330      // search the list of elements for a match
2331      for (m_element = elemlist.first(); m_element != NULL; m_element = m_element->next())
2332         if (strcmp(name, m_element->name()) == 0)
2333            break;
23342334
2335        // error if not found
2336        if (m_element == NULL)
2337            throw emu_fatalerror("Unable to find layout element %s", name);
2338    }
2335      // error if not found
2336      if (m_element == NULL)
2337         throw emu_fatalerror("Unable to find layout element %s", name);
2338   }
23392339
2340    // fetch common data
2341    int index = xml_get_attribute_int_with_subst(machine, itemnode, "index", -1);
2342    if (index != -1)
2343    {
2344        screen_device_iterator iter(machine.root_device());
2345        m_screen = iter.byindex(index);
2346    }
2347    m_input_mask = xml_get_attribute_int_with_subst(machine, itemnode, "inputmask", 0);
2348    if (m_output_name[0] != 0 && m_element != NULL)
2349        output_set_value(m_output_name, m_element->default_state());
2350    parse_bounds(machine, xml_get_sibling(itemnode.child, "bounds"), m_rawbounds);
2351    parse_color(machine, xml_get_sibling(itemnode.child, "color"), m_color);
2352    parse_orientation(machine, xml_get_sibling(itemnode.child, "orientation"), m_orientation);
2340   // fetch common data
2341   int index = xml_get_attribute_int_with_subst(machine, itemnode, "index", -1);
2342   if (index != -1)
2343   {
2344      screen_device_iterator iter(machine.root_device());
2345      m_screen = iter.byindex(index);
2346   }
2347   m_input_mask = xml_get_attribute_int_with_subst(machine, itemnode, "inputmask", 0);
2348   if (m_output_name[0] != 0 && m_element != NULL)
2349      output_set_value(m_output_name, m_element->default_state());
2350   parse_bounds(machine, xml_get_sibling(itemnode.child, "bounds"), m_rawbounds);
2351   parse_color(machine, xml_get_sibling(itemnode.child, "color"), m_color);
2352   parse_orientation(machine, xml_get_sibling(itemnode.child, "orientation"), m_orientation);
23532353
2354    // sanity checks
2355    if (strcmp(itemnode.name, "screen") == 0)
2356    {
2357        if (m_screen == NULL)
2358            throw emu_fatalerror("Layout references invalid screen index %d", index);
2359    }
2360    else
2361    {
2362        if (m_element == NULL)
2363            throw emu_fatalerror("Layout item of type %s require an element tag", itemnode.name);
2364    }
2354   // sanity checks
2355   if (strcmp(itemnode.name, "screen") == 0)
2356   {
2357      if (m_screen == NULL)
2358         throw emu_fatalerror("Layout references invalid screen index %d", index);
2359   }
2360   else
2361   {
2362      if (m_element == NULL)
2363         throw emu_fatalerror("Layout item of type %s require an element tag", itemnode.name);
2364   }
23652365}
23662366
23672367
r242631r242632
23812381
23822382render_container *layout_view::item::screen_container(running_machine &machine) const
23832383{
2384    return (m_screen != NULL) ? &m_screen->container() : NULL;
2384   return (m_screen != NULL) ? &m_screen->container() : NULL;
23852385}
23862386
23872387//-------------------------------------------------
r242631r242632
23902390
23912391int layout_view::item::state() const
23922392{
2393    int state = 0;
2393   int state = 0;
23942394
2395    assert(m_element != NULL);
2395   assert(m_element != NULL);
23962396
2397    // if configured to an output, fetch the output value
2398    if (m_output_name[0] != 0)
2399        state = output_get_value(m_output_name);
2397   // if configured to an output, fetch the output value
2398   if (m_output_name[0] != 0)
2399      state = output_get_value(m_output_name);
24002400
2401    // if configured to an input, fetch the input value
2402    else if (m_input_tag[0] != 0)
2403    {
2404        ioport_port *port = m_element->machine().root_device().ioport(m_input_tag);
2405        if (port != NULL)
2406        {
2407            ioport_field *field = port->field(m_input_mask);
2408            if (field != NULL)
2409                state = ((port->read() ^ field->defvalue()) & m_input_mask) ? 1 : 0;
2410        }
2411    }
2412    return state;
2401   // if configured to an input, fetch the input value
2402   else if (m_input_tag[0] != 0)
2403   {
2404      ioport_port *port = m_element->machine().root_device().ioport(m_input_tag);
2405      if (port != NULL)
2406      {
2407         ioport_field *field = port->field(m_input_mask);
2408         if (field != NULL)
2409            state = ((port->read() ^ field->defvalue()) & m_input_mask) ? 1 : 0;
2410      }
2411   }
2412   return state;
24132413}
24142414
24152415
r242631r242632
24232423//-------------------------------------------------
24242424
24252425layout_file::layout_file(running_machine &machine, xml_data_node &rootnode, const char *dirname)
2426    : m_next(NULL)
2426   : m_next(NULL)
24272427{
2428    // find the layout node
2429    xml_data_node *mamelayoutnode = xml_get_sibling(rootnode.child, "mamelayout");
2430    if (mamelayoutnode == NULL)
2431        throw emu_fatalerror("Invalid XML file: missing mamelayout node");
2428   // find the layout node
2429   xml_data_node *mamelayoutnode = xml_get_sibling(rootnode.child, "mamelayout");
2430   if (mamelayoutnode == NULL)
2431      throw emu_fatalerror("Invalid XML file: missing mamelayout node");
24322432
2433    // validate the config data version
2434    int version = xml_get_attribute_int(mamelayoutnode, "version", 0);
2435    if (version != LAYOUT_VERSION)
2436        throw emu_fatalerror("Invalid XML file: unsupported version");
2433   // validate the config data version
2434   int version = xml_get_attribute_int(mamelayoutnode, "version", 0);
2435   if (version != LAYOUT_VERSION)
2436      throw emu_fatalerror("Invalid XML file: unsupported version");
24372437
2438    // parse all the elements
2439    for (xml_data_node *elemnode = xml_get_sibling(mamelayoutnode->child, "element"); elemnode != NULL; elemnode = xml_get_sibling(elemnode->next, "element"))
2440        m_elemlist.append(*global_alloc(layout_element(machine, *elemnode, dirname)));
2438   // parse all the elements
2439   for (xml_data_node *elemnode = xml_get_sibling(mamelayoutnode->child, "element"); elemnode != NULL; elemnode = xml_get_sibling(elemnode->next, "element"))
2440      m_elemlist.append(*global_alloc(layout_element(machine, *elemnode, dirname)));
24412441
2442    // parse all the views
2443    for (xml_data_node *viewnode = xml_get_sibling(mamelayoutnode->child, "view"); viewnode != NULL; viewnode = xml_get_sibling(viewnode->next, "view"))
2444        m_viewlist.append(*global_alloc(layout_view(machine, *viewnode, m_elemlist)));
2442   // parse all the views
2443   for (xml_data_node *viewnode = xml_get_sibling(mamelayoutnode->child, "view"); viewnode != NULL; viewnode = xml_get_sibling(viewnode->next, "view"))
2444      m_viewlist.append(*global_alloc(layout_view(machine, *viewnode, m_elemlist)));
24452445}
24462446
24472447
trunk/src/emu/rendlay.h
r242631r242632
2020
2121enum item_layer
2222{
23    ITEM_LAYER_FIRST = 0,
24    ITEM_LAYER_BACKDROP = ITEM_LAYER_FIRST,
25    ITEM_LAYER_SCREEN,
26    ITEM_LAYER_OVERLAY,
27    ITEM_LAYER_BEZEL,
28    ITEM_LAYER_CPANEL,
29    ITEM_LAYER_MARQUEE,
30    ITEM_LAYER_MAX
23   ITEM_LAYER_FIRST = 0,
24   ITEM_LAYER_BACKDROP = ITEM_LAYER_FIRST,
25   ITEM_LAYER_SCREEN,
26   ITEM_LAYER_OVERLAY,
27   ITEM_LAYER_BEZEL,
28   ITEM_LAYER_CPANEL,
29   ITEM_LAYER_MARQUEE,
30   ITEM_LAYER_MAX
3131};
3232DECLARE_ENUM_OPERATORS(item_layer);
3333
r242631r242632
4343// a layout_element is a single named element, which may have multiple components
4444class layout_element
4545{
46    friend class simple_list<layout_element>;
46   friend class simple_list<layout_element>;
4747
4848public:
49    // construction/destruction
50    layout_element(running_machine &machine, xml_data_node &elemnode, const char *dirname);
51    virtual ~layout_element();
49   // construction/destruction
50   layout_element(running_machine &machine, xml_data_node &elemnode, const char *dirname);
51   virtual ~layout_element();
5252
53    // getters
54    layout_element *next() const { return m_next; }
55    const char *name() const { return m_name; }
56    running_machine &machine() const { return m_machine; }
57    int default_state() const { return m_defstate; }
58    int maxstate() const { return m_maxstate; }
59    render_texture *state_texture(int state);
53   // getters
54   layout_element *next() const { return m_next; }
55   const char *name() const { return m_name; }
56   running_machine &machine() const { return m_machine; }
57   int default_state() const { return m_defstate; }
58   int maxstate() const { return m_maxstate; }
59   render_texture *state_texture(int state);
6060
6161private:
62    // a component represents an image, rectangle, or disk in an element
63    class component
64    {
65        friend class layout_element;
66        friend class simple_list<component>;
62   // a component represents an image, rectangle, or disk in an element
63   class component
64   {
65      friend class layout_element;
66      friend class simple_list<component>;
6767
68    public:
69        // construction/destruction
70        component(running_machine &machine, xml_data_node &compnode, const char *dirname);
71        ~component();
68   public:
69      // construction/destruction
70      component(running_machine &machine, xml_data_node &compnode, const char *dirname);
71      ~component();
7272
73        // getters
74        component *next() const { return m_next; }
75        const render_bounds &bounds() const { return m_bounds; }
73      // getters
74      component *next() const { return m_next; }
75      const render_bounds &bounds() const { return m_bounds; }
7676
77        // operations
78        void draw(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state);
77      // operations
78      void draw(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state);
7979
80    private:
81        // component types
82        enum component_type
83        {
84            CTYPE_INVALID = 0,
85            CTYPE_IMAGE,
86            CTYPE_RECT,
87            CTYPE_DISK,
88            CTYPE_TEXT,
89            CTYPE_LED7SEG,
90            CTYPE_LED8SEG_GTS1,
91            CTYPE_LED14SEG,
92            CTYPE_LED16SEG,
93            CTYPE_LED14SEGSC,
94            CTYPE_LED16SEGSC,
95            CTYPE_DOTMATRIX,
96            CTYPE_DOTMATRIX5DOT,
97            CTYPE_DOTMATRIXDOT,
98            CTYPE_SIMPLECOUNTER,
99            CTYPE_REEL,
100            CTYPE_MAX
101        };
80   private:
81      // component types
82      enum component_type
83      {
84         CTYPE_INVALID = 0,
85         CTYPE_IMAGE,
86         CTYPE_RECT,
87         CTYPE_DISK,
88         CTYPE_TEXT,
89         CTYPE_LED7SEG,
90         CTYPE_LED8SEG_GTS1,
91         CTYPE_LED14SEG,
92         CTYPE_LED16SEG,
93         CTYPE_LED14SEGSC,
94         CTYPE_LED16SEGSC,
95         CTYPE_DOTMATRIX,
96         CTYPE_DOTMATRIX5DOT,
97         CTYPE_DOTMATRIXDOT,
98         CTYPE_SIMPLECOUNTER,
99         CTYPE_REEL,
100         CTYPE_MAX
101      };
102102
103        // helpers
104        void draw_rect(bitmap_argb32 &dest, const rectangle &bounds);
105        void draw_disk(bitmap_argb32 &dest, const rectangle &bounds);
106        void draw_text(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds);
107        void draw_simplecounter(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state);
108        void draw_reel(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state);
109        void draw_beltreel(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state);
110        void load_bitmap();
111        void load_reel_bitmap(int number);
112        void draw_led7seg(bitmap_argb32 &dest, const rectangle &bounds, int pattern);
113        void draw_led8seg_gts1(bitmap_argb32 &dest, const rectangle &bounds, int pattern);
114        void draw_led14seg(bitmap_argb32 &dest, const rectangle &bounds, int pattern);
115        void draw_led14segsc(bitmap_argb32 &dest, const rectangle &bounds, int pattern);
116        void draw_led16seg(bitmap_argb32 &dest, const rectangle &bounds, int pattern);
117        void draw_led16segsc(bitmap_argb32 &dest, const rectangle &bounds, int pattern);
118        void draw_dotmatrix(int dots,bitmap_argb32 &dest, const rectangle &bounds, int pattern);
119        void draw_segment_horizontal_caps(bitmap_argb32 &dest, int minx, int maxx, int midy, int width, int caps, rgb_t color);
120        void draw_segment_horizontal(bitmap_argb32 &dest, int minx, int maxx, int midy, int width, rgb_t color);
121        void draw_segment_vertical_caps(bitmap_argb32 &dest, int miny, int maxy, int midx, int width, int caps, rgb_t color);
122        void draw_segment_vertical(bitmap_argb32 &dest, int miny, int maxy, int midx, int width, rgb_t color);
123        void draw_segment_diagonal_1(bitmap_argb32 &dest, int minx, int maxx, int miny, int maxy, int width, rgb_t color);
124        void draw_segment_diagonal_2(bitmap_argb32 &dest, int minx, int maxx, int miny, int maxy, int width, rgb_t color);
125        void draw_segment_decimal(bitmap_argb32 &dest, int midx, int midy, int width, rgb_t color);
126        void draw_segment_comma(bitmap_argb32 &dest, int minx, int maxx, int miny, int maxy, int width, rgb_t color);
127        void apply_skew(bitmap_argb32 &dest, int skewwidth);
103      // helpers
104      void draw_rect(bitmap_argb32 &dest, const rectangle &bounds);
105      void draw_disk(bitmap_argb32 &dest, const rectangle &bounds);
106      void draw_text(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds);
107      void draw_simplecounter(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state);
108      void draw_reel(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state);
109      void draw_beltreel(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state);
110      void load_bitmap();
111      void load_reel_bitmap(int number);
112      void draw_led7seg(bitmap_argb32 &dest, const rectangle &bounds, int pattern);
113      void draw_led8seg_gts1(bitmap_argb32 &dest, const rectangle &bounds, int pattern);
114      void draw_led14seg(bitmap_argb32 &dest, const rectangle &bounds, int pattern);
115      void draw_led14segsc(bitmap_argb32 &dest, const rectangle &bounds, int pattern);
116      void draw_led16seg(bitmap_argb32 &dest, const rectangle &bounds, int pattern);
117      void draw_led16segsc(bitmap_argb32 &dest, const rectangle &bounds, int pattern);
118      void draw_dotmatrix(int dots,bitmap_argb32 &dest, const rectangle &bounds, int pattern);
119      void draw_segment_horizontal_caps(bitmap_argb32 &dest, int minx, int maxx, int midy, int width, int caps, rgb_t color);
120      void draw_segment_horizontal(bitmap_argb32 &dest, int minx, int maxx, int midy, int width, rgb_t color);
121      void draw_segment_vertical_caps(bitmap_argb32 &dest, int miny, int maxy, int midx, int width, int caps, rgb_t color);
122      void draw_segment_vertical(bitmap_argb32 &dest, int miny, int maxy, int midx, int width, rgb_t color);
123      void draw_segment_diagonal_1(bitmap_argb32 &dest, int minx, int maxx, int miny, int maxy, int width, rgb_t color);
124      void draw_segment_diagonal_2(bitmap_argb32 &dest, int minx, int maxx, int miny, int maxy, int width, rgb_t color);
125      void draw_segment_decimal(bitmap_argb32 &dest, int midx, int midy, int width, rgb_t color);
126      void draw_segment_comma(bitmap_argb32 &dest, int minx, int maxx, int miny, int maxy, int width, rgb_t color);
127      void apply_skew(bitmap_argb32 &dest, int skewwidth);
128128
129        #define MAX_BITMAPS 32
129      #define MAX_BITMAPS 32
130130
131        // internal state
132        component *         m_next;                     // link to next component
133        component_type      m_type;                     // type of component
134        int                 m_state;                    // state where this component is visible (-1 means all states)
135        render_bounds       m_bounds;                   // bounds of the element
136        render_color        m_color;                    // color of the element
137        astring             m_string;                   // string for text components
138        int                 m_digits;                   // number of digits for simple counters
139        int                 m_textalign;                // text alignment to box
140        bitmap_argb32       m_bitmap[MAX_BITMAPS];      // source bitmap for images
141        astring             m_dirname;                  // directory name of image file (for lazy loading)
142        auto_pointer<emu_file> m_file[MAX_BITMAPS];        // file object for reading image/alpha files
143        astring             m_imagefile[MAX_BITMAPS];   // name of the image file (for lazy loading)
144        astring             m_alphafile[MAX_BITMAPS];   // name of the alpha file (for lazy loading)
145        bool                m_hasalpha[MAX_BITMAPS];    // is there any alpha component present?
131      // internal state
132      component *         m_next;                     // link to next component
133      component_type      m_type;                     // type of component
134      int                 m_state;                    // state where this component is visible (-1 means all states)
135      render_bounds       m_bounds;                   // bounds of the element
136      render_color        m_color;                    // color of the element
137      astring             m_string;                   // string for text components
138      int                 m_digits;                   // number of digits for simple counters
139      int                 m_textalign;                // text alignment to box
140      bitmap_argb32       m_bitmap[MAX_BITMAPS];      // source bitmap for images
141      astring             m_dirname;                  // directory name of image file (for lazy loading)
142      auto_pointer<emu_file> m_file[MAX_BITMAPS];        // file object for reading image/alpha files
143      astring             m_imagefile[MAX_BITMAPS];   // name of the image file (for lazy loading)
144      astring             m_alphafile[MAX_BITMAPS];   // name of the alpha file (for lazy loading)
145      bool                m_hasalpha[MAX_BITMAPS];    // is there any alpha component present?
146146
147        // stuff for fruit machine reels
148        // basically made up of multiple text strings / gfx
149        int                 m_numstops;
150        astring             m_stopnames[MAX_BITMAPS];
151        int                 m_stateoffset;
152        int                 m_reelreversed;
153        int                 m_numsymbolsvisible;
154        int                 m_beltreel;
155    };
147      // stuff for fruit machine reels
148      // basically made up of multiple text strings / gfx
149      int                 m_numstops;
150      astring             m_stopnames[MAX_BITMAPS];
151      int                 m_stateoffset;
152      int                 m_reelreversed;
153      int                 m_numsymbolsvisible;
154      int                 m_beltreel;
155   };
156156
157    // a texture encapsulates a texture for a given element in a given state
158    class texture
159    {
160    public:
161        texture();
162        ~texture();
157   // a texture encapsulates a texture for a given element in a given state
158   class texture
159   {
160   public:
161      texture();
162      ~texture();
163163
164        layout_element *    m_element;      // pointer back to the element
165        render_texture *    m_texture;      // texture for this state
166        int                 m_state;        // associated state number
167    };
164      layout_element *    m_element;      // pointer back to the element
165      render_texture *    m_texture;      // texture for this state
166      int                 m_state;        // associated state number
167   };
168168
169    // internal helpers
170    static void element_scale(bitmap_argb32 &dest, bitmap_argb32 &source, const rectangle &sbounds, void *param);
169   // internal helpers
170   static void element_scale(bitmap_argb32 &dest, bitmap_argb32 &source, const rectangle &sbounds, void *param);
171171
172    // internal state
173    layout_element *    m_next;             // link to next element
174    running_machine &   m_machine;          // reference to the owning machine
175    astring             m_name;             // name of this element
176    simple_list<component> m_complist;      // list of components
177    int                 m_defstate;         // default state of this element
178    int                 m_maxstate;         // maximum state value for all components
179    dynamic_array<texture> m_elemtex;       // array of element textures used for managing the scaled bitmaps
172   // internal state
173   layout_element *    m_next;             // link to next element
174   running_machine &   m_machine;          // reference to the owning machine
175   astring             m_name;             // name of this element
176   simple_list<component> m_complist;      // list of components
177   int                 m_defstate;         // default state of this element
178   int                 m_maxstate;         // maximum state value for all components
179   dynamic_array<texture> m_elemtex;       // array of element textures used for managing the scaled bitmaps
180180};
181181
182182
r242631r242632
185185// a layout_view encapsulates a named list of items
186186class layout_view
187187{
188    friend class simple_list<layout_view>;
188   friend class simple_list<layout_view>;
189189
190190public:
191    // an item is a single backdrop, screen, overlay, bezel, cpanel, or marquee item
192    class item
193    {
194        friend class layout_view;
195        friend class simple_list<item>;
191   // an item is a single backdrop, screen, overlay, bezel, cpanel, or marquee item
192   class item
193   {
194      friend class layout_view;
195      friend class simple_list<item>;
196196
197    public:
198        // construction/destruction
199        item(running_machine &machine, xml_data_node &itemnode, simple_list<layout_element> &elemlist);
200        virtual ~item();
197   public:
198      // construction/destruction
199      item(running_machine &machine, xml_data_node &itemnode, simple_list<layout_element> &elemlist);
200      virtual ~item();
201201
202        // getters
203        item *next() const { return m_next; }
204        layout_element *element() const { return m_element; }
205        screen_device *screen() { return m_screen; }
206        const render_bounds &bounds() const { return m_bounds; }
207        const render_color &color() const { return m_color; }
208        int orientation() const { return m_orientation; }
209        render_container *screen_container(running_machine &machine) const;
210        bool has_input() const { return bool(m_input_tag); }
211        const char *input_tag_and_mask(ioport_value &mask) const { mask = m_input_mask; return m_input_tag; }
202      // getters
203      item *next() const { return m_next; }
204      layout_element *element() const { return m_element; }
205      screen_device *screen() { return m_screen; }
206      const render_bounds &bounds() const { return m_bounds; }
207      const render_color &color() const { return m_color; }
208      int orientation() const { return m_orientation; }
209      render_container *screen_container(running_machine &machine) const;
210      bool has_input() const { return bool(m_input_tag); }
211      const char *input_tag_and_mask(ioport_value &mask) const { mask = m_input_mask; return m_input_tag; }
212212
213        // fetch state based on configured source
214        int state() const;
213      // fetch state based on configured source
214      int state() const;
215215
216    private:
217        // internal state
218        item *              m_next;             // link to next item
219        layout_element *    m_element;          // pointer to the associated element (non-screens only)
220        astring             m_output_name;      // name of this item
221        astring             m_input_tag;        // input tag of this item
222        ioport_value        m_input_mask;       // input mask of this item
223        screen_device *     m_screen;           // pointer to screen
224        int                 m_orientation;      // orientation of this item
225        render_bounds       m_bounds;           // bounds of the item
226        render_bounds       m_rawbounds;        // raw (original) bounds of the item
227        render_color        m_color;            // color of the item
228    };
216   private:
217      // internal state
218      item *              m_next;             // link to next item
219      layout_element *    m_element;          // pointer to the associated element (non-screens only)
220      astring             m_output_name;      // name of this item
221      astring             m_input_tag;        // input tag of this item
222      ioport_value        m_input_mask;       // input mask of this item
223      screen_device *     m_screen;           // pointer to screen
224      int                 m_orientation;      // orientation of this item
225      render_bounds       m_bounds;           // bounds of the item
226      render_bounds       m_rawbounds;        // raw (original) bounds of the item
227      render_color        m_color;            // color of the item
228   };
229229
230    // construction/destruction
231    layout_view(running_machine &machine, xml_data_node &viewnode, simple_list<layout_element> &elemlist);
232    virtual ~layout_view();
230   // construction/destruction
231   layout_view(running_machine &machine, xml_data_node &viewnode, simple_list<layout_element> &elemlist);
232   virtual ~layout_view();
233233
234    // getters
235    layout_view *next() const { return m_next; }
236    item *first_item(item_layer layer) const;
237    const char *name() const { return m_name; }
238    const render_screen_list &screens() const { return m_screens; }
239    bool layer_enabled(item_layer layer) const { return m_layenabled[layer]; }
234   // getters
235   layout_view *next() const { return m_next; }
236   item *first_item(item_layer layer) const;
237   const char *name() const { return m_name; }
238   const render_screen_list &screens() const { return m_screens; }
239   bool layer_enabled(item_layer layer) const { return m_layenabled[layer]; }
240240
241    //
242    bool has_art() const { return (m_backdrop_list.count() + m_overlay_list.count() + m_bezel_list.count() + m_cpanel_list.count() + m_marquee_list.count() != 0); }
243    float effective_aspect(render_layer_config config) const { return (config.zoom_to_screen() && m_screens.count() != 0) ? m_scraspect : m_aspect; }
241   //
242   bool has_art() const { return (m_backdrop_list.count() + m_overlay_list.count() + m_bezel_list.count() + m_cpanel_list.count() + m_marquee_list.count() != 0); }
243   float effective_aspect(render_layer_config config) const { return (config.zoom_to_screen() && m_screens.count() != 0) ? m_scraspect : m_aspect; }
244244
245    // operations
246    void recompute(render_layer_config layerconfig);
245   // operations
246   void recompute(render_layer_config layerconfig);
247247
248248private:
249    // internal state
250    layout_view *       m_next;             // pointer to next layout in the list
251    astring             m_name;             // name of the layout
252    float               m_aspect;           // X/Y of the layout
253    float               m_scraspect;        // X/Y of the screen areas
254    render_screen_list  m_screens;          // list of active screens
255    render_bounds       m_bounds;           // computed bounds of the view
256    render_bounds       m_scrbounds;        // computed bounds of the screens within the view
257    render_bounds       m_expbounds;        // explicit bounds of the view
258    bool                m_layenabled[ITEM_LAYER_MAX]; // is this layer enabled?
259    simple_list<item>   m_backdrop_list;    // list of backdrop items
260    simple_list<item>   m_screen_list;      // list of screen items
261    simple_list<item>   m_overlay_list;     // list of overlay items
262    simple_list<item>   m_bezel_list;       // list of bezel items
263    simple_list<item>   m_cpanel_list;      // list of marquee items
264    simple_list<item>   m_marquee_list;     // list of marquee items
249   // internal state
250   layout_view *       m_next;             // pointer to next layout in the list
251   astring             m_name;             // name of the layout
252   float               m_aspect;           // X/Y of the layout
253   float               m_scraspect;        // X/Y of the screen areas
254   render_screen_list  m_screens;          // list of active screens
255   render_bounds       m_bounds;           // computed bounds of the view
256   render_bounds       m_scrbounds;        // computed bounds of the screens within the view
257   render_bounds       m_expbounds;        // explicit bounds of the view
258   bool                m_layenabled[ITEM_LAYER_MAX]; // is this layer enabled?
259   simple_list<item>   m_backdrop_list;    // list of backdrop items
260   simple_list<item>   m_screen_list;      // list of screen items
261   simple_list<item>   m_overlay_list;     // list of overlay items
262   simple_list<item>   m_bezel_list;       // list of bezel items
263   simple_list<item>   m_cpanel_list;      // list of marquee items
264   simple_list<item>   m_marquee_list;     // list of marquee items
265265};
266266
267267
r242631r242632
270270// a layout_file consists of a list of elements and a list of views
271271class layout_file
272272{
273    friend class simple_list<layout_file>;
273   friend class simple_list<layout_file>;
274274
275275public:
276    // construction/destruction
277    layout_file(running_machine &machine, xml_data_node &rootnode, const char *dirname);
278    virtual ~layout_file();
276   // construction/destruction
277   layout_file(running_machine &machine, xml_data_node &rootnode, const char *dirname);
278   virtual ~layout_file();
279279
280    // getters
281    layout_file *next() const { return m_next; }
282    layout_element *first_element() const { return m_elemlist.first(); }
283    layout_view *first_view() const { return m_viewlist.first(); }
280   // getters
281   layout_file *next() const { return m_next; }
282   layout_element *first_element() const { return m_elemlist.first(); }
283   layout_view *first_view() const { return m_viewlist.first(); }
284284
285285private:
286    // internal state
287    layout_file *       m_next;             // pointer to the next file in the list
288    simple_list<layout_element> m_elemlist; // list of shared layout elements
289    simple_list<layout_view> m_viewlist;    // list of views
286   // internal state
287   layout_file *       m_next;             // pointer to the next file in the list
288   simple_list<layout_element> m_elemlist; // list of shared layout elements
289   simple_list<layout_view> m_viewlist;    // list of views
290290};
291291
292292
trunk/src/emu/sound/tms5110.c
r242631r242632
10561056   else if (m_state == CTL_STATE_OUTPUT)
10571057   {
10581058      if (DEBUG_5110) logerror("Status read while outputting buffer (buffer=%2d)\n", m_CTL_buffer);
1059      return (m_CTL_buffer);
1059      return (m_CTL_buffer);
10601060   }
10611061   else // we're reading with the bus in input mode! just return the last thing written to the bus
10621062   {
r242631r242632
11501150/******************************************************************************
11511151
11521152     tms5110_set_frequency -- adjusts the playback frequency
1153    TODO: kill this function; we should be adjusting the tms51xx device clock itself,
1154    not setting it here!
1153     TODO: kill this function; we should be adjusting the tms51xx device clock itself,
1154     not setting it here!
11551155
11561156******************************************************************************/
11571157
trunk/src/emu/video/315_5124.c
r242631r242632
14201420         }
14211421         while (++x < 208);
14221422      }
1423     
1423
14241424      /* border on right side of the GG active screen */
14251425      do
14261426      {
trunk/src/emu/video/stvvdp2.c
r242631r242632
57255725         m_vdp2_regs[offset] = (STV_VDP2_VRAMSZ << 15) |
57265726                                 ((0 << 0) & 0xf); // VDP2 version
57275727
5728         /* Games basically r/w the entire VDP2 register area when this is tripped. (example: Silhouette Mirage)
5728         /* Games basically r/w the entire VDP2 register area when this is tripped. (example: Silhouette Mirage)
57295729            Disable log for the time being. */
57305730         //if(!space.debugger_access())
5731         //   printf("Warning: VDP2 version read\n");
5731         //  printf("Warning: VDP2 version read\n");
57325732         break;
57335733      }
57345734
trunk/src/emu/video/tea1002.c
r242631r242632
1818
1919const float tea1002_device::m_luminance[] =
2020{
21    0, 22.5, 44, 66.5,  8.5, 31, 52.5, 100, // INV = 0
21      0, 22.5, 44, 66.5,  8.5, 31, 52.5, 100, // INV = 0
2222   75, 52.5, 31,  8.5, 66.5, 44, 22.5, 0    // INV = 1
2323};
2424
trunk/src/lib/formats/dcp_dsk.c
r242631r242632
77    PC98 DCP & DCU disk images
88
99    0xA2 header, followed by track data
10   header[0] - disk format
10    header[0] - disk format
1111    header[1-0xA1] - track map (1=track used, 0=track unused/unformatted)
12    header[0xA2] - all tracks used?
12    header[0xA2] - all tracks used?
1313                   (there seems to be a diff in its usage between DCP and DCU)
1414
15    TODO:
15    TODO:
1616     - add support for track map. images available for tests were all
1717       of type 0x01, with all 154 tracks present. combined with pete_j
1818       reporting some images have faulty track map, we need some more
1919       test cases to properly handle these disks!
20
20
2121*********************************************************************/
2222
2323#include "emu.h"
r242631r242632
5252   io_generic_read(io, h, 0, 0xa2);
5353
5454   // First byte is the disk format (see below in load() for details)
55   switch (h[0])
55   switch (h[0])
5656   {
5757      case 0x01:
5858      default:
r242631r242632
9999      if (h[i])
100100         count_tracks++;
101101
102   // in theory track map should be enough (former check), but some images have it wrong!
102   // in theory track map should be enough (former check), but some images have it wrong!
103103   // hence, if this check fails, we also allow for images with all tracks and wrong track map
104104   if (size - 0xa2 == (heads * count_tracks * spt * bps) || size - 0xa2 == (heads * tracks * spt * bps))
105105      return 100;
r242631r242632
107107   // for disk type 0x11 the head 0 track 0 has 26 sectors of half width, so we need to compensate calculation
108108   if (is_hdb && (size - 0xa2 + (0x80 * 26) == (heads * count_tracks * spt * bps) || size - 0xa2 + (0x80 * 26) == (heads * tracks * spt * bps)))
109109      return 100;
110   
110
111111   return 0;
112112}
113113
r242631r242632
116116   UINT8 h[0xa2];
117117   int heads, tracks, spt, bps;
118118   bool is_hdb = false;
119   
119
120120   io_generic_read(io, h, 0, 0xa2);
121   
121
122122   // First byte is the disk format:
123   switch (h[0])
123   switch (h[0])
124124   {
125125      case 0x01:
126126      default:
r242631r242632
212212   if (!is_hdb)
213213   {
214214      for (int track = 0; track < tracks; track++)
215         for (int head = 0; head < heads; head++)
215         for (int head = 0; head < heads; head++)
216216         {
217217            io_generic_read(io, sect_data, 0xa2 + bps * spt * (track * heads + head), bps * spt);
218           
219            for (int i = 0; i < spt; i++)
218
219            for (int i = 0; i < spt; i++)
220220            {
221221               sects[i].track       = track;
222222               sects[i].head        = head;
r242631r242632
227227               sects[i].bad_crc     = false;
228228               sects[i].data        = sect_data + i * bps;
229229            }
230           
230
231231            build_pc_track_mfm(track, head, image, cell_count, spt, sects, calc_default_pc_gap3_size(form_factor, bps));
232232         }
233233   }
234   else   // FIXME: the code below is untested, because no image was found... there might be some silly mistake in the disk geometry!
234   else    // FIXME: the code below is untested, because no image was found... there might be some silly mistake in the disk geometry!
235235   {
236236      // Read Head 0 Track 0 is FM with 26 sectors of 128bytes instead of 256
237237      io_generic_read(io, sect_data, 0xa2, 128 * spt);
238     
239      for (int i = 0; i < spt; i++)
238
239      for (int i = 0; i < spt; i++)
240240      {
241241         sects[i].track       = 0;
242242         sects[i].head        = 0;
r242631r242632
247247         sects[i].bad_crc     = false;
248248         sects[i].data        = sect_data + i * 128;
249249      }
250     
250
251251      build_pc_track_fm(0, 0, image, cell_count, spt, sects, calc_default_pc_gap3_size(form_factor, 128));
252     
252
253253      // Read Head 1 Track 0 is MFM with 26 sectors of 256bytes
254254      io_generic_read(io, sect_data, 0xa2 + 128 * spt, bps * spt);
255     
256      for (int i = 0; i < spt; i++)
255
256      for (int i = 0; i < spt; i++)
257257      {
258258         sects[i].track       = 0;
259259         sects[i].head        = 1;
r242631r242632
264264         sects[i].bad_crc     = false;
265265         sects[i].data        = sect_data + i * bps;
266266      }
267     
267
268268      build_pc_track_mfm(0, 1, image, cell_count, spt, sects, calc_default_pc_gap3_size(form_factor, bps));
269     
269
270270      // Read other tracks as usual
271271      UINT32 data_offs = 0xa2 + (26 * 0x80) + (26 * 0x100);
272272      for (int track = 1; track < tracks; track++)
273         for (int head = 0; head < heads; head++)
273         for (int head = 0; head < heads; head++)
274274         {
275275            io_generic_read(io, sect_data, data_offs + bps * spt * ((track - 1) * heads + head), bps * spt);
276           
277            for (int i = 0; i < spt; i++)
276
277            for (int i = 0; i < spt; i++)
278278            {
279279               sects[i].track       = track;
280280               sects[i].head        = head;
r242631r242632
285285               sects[i].bad_crc     = false;
286286               sects[i].data        = sect_data + i * bps;
287287            }
288           
288
289289            build_pc_track_mfm(track, head, image, cell_count, spt, sects, calc_default_pc_gap3_size(form_factor, bps));
290290         }
291291   }
292   
292
293293   return true;
294294}
295295
trunk/src/lib/formats/dip_dsk.c
r242631r242632
55    formats/dip_dsk.h
66
77    PC98 DIP disk images
8
8
99    0x100 header, followed by track data
1010
1111    TODO:
12    - Investigate header structure
12    - Investigate header structure
1313    - can this format be used to support different disc types?
1414
1515*********************************************************************/
r242631r242632
5656   tracks = 77;
5757   spt = 8;
5858   bps = 1024;
59   
59
6060   int cell_count = form_factor == floppy_image::FF_35 ? 200000 : 166666;
61   
61
6262   int ssize;
6363   for (ssize = 0; (128 << ssize) < bps; ssize++);
64   
64
6565   desc_pc_sector sects[256];
6666   UINT8 sect_data[65536];
67   
67
6868   for (int track = 0; track < tracks; track++)
69      for (int head = 0; head < heads; head++)
69      for (int head = 0; head < heads; head++)
7070      {
7171         io_generic_read(io, sect_data, 0x100 + bps * spt * (track * heads + head), bps * spt);
72         
73         for (int i = 0; i < spt; i++)
72
73         for (int i = 0; i < spt; i++)
7474         {
7575            sects[i].track       = track;
7676            sects[i].head        = head;
r242631r242632
8181            sects[i].bad_crc     = false;
8282            sects[i].data        = sect_data + i * bps;
8383         }
84         
84
8585         build_pc_track_mfm(track, head, image, cell_count, spt, sects, calc_default_pc_gap3_size(form_factor, bps));
8686      }
8787
trunk/src/lib/formats/fdd_dsk.c
r242631r242632
55    formats/fdd_dsk.h
66
77    PC98 FDD disk images
8
8
99    0xC3FC header, followed by track data
1010    Sector map starts at offset 0xDC, with 12bytes for each sector
1111
r242631r242632
1515    - 0x2 = sector number
1616    - 0x3 = sector size (128 << this byte)
1717    - 0x4 = fill byte. if it's not 0xff, then this sector in the original
18            disk consisted of this single value repeated for the whole
19            sector size, and the sector is skipped in the .fdd file.
20            if it's 0xff, then this sector is wholly contained in the .fdd
18            disk consisted of this single value repeated for the whole
19            sector size, and the sector is skipped in the .fdd file.
20            if it's 0xff, then this sector is wholly contained in the .fdd
2121            file
2222    - 0x5 = ??
2323    - 0x6 = ??
2424    - 0x7 = ??
2525    - 0x8-0x0b = absolute offset of the data for this sector, or 0xfffffff
26                 if the sector was skipped in the .fdd (and it has to be
26                 if the sector was skipped in the .fdd (and it has to be
2727                 filled with the value at 0x4)
2828
2929 TODO:
r242631r242632
5555
5656int fdd_format::identify(io_generic *io, UINT32 form_factor)
5757{
58   UINT8 h[7];   
58   UINT8 h[7];
5959   io_generic_read(io, h, 0, 7);
60   
60
6161   if (strncmp((const char *)h, "VFD1.0", 6) == 0)
6262      return 100;
63   
63
6464   return 0;
6565}
6666
6767bool fdd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
6868{
69   UINT8 hsec[0x0c];   
70   
69   UINT8 hsec[0x0c];
70
7171   // sector map
7272   UINT8 num_secs[160];
7373   UINT8 tracks[160 * 26];
r242631r242632
7676   UINT8 fill_vals[160 * 26];
7777   UINT32 sec_offs[160 * 26];
7878   UINT8 sec_sizes[160 * 26];
79   
79
8080   int pos = 0xdc;
81   
81
8282   for (int track = 0; track < 160; track++)
8383   {
8484      int curr_num_sec = 0, curr_track_size = 0;
r242631r242632
8787         // read sector map for this sector
8888         io_generic_read(io, hsec, pos, 0x0c);
8989         pos += 0x0c;
90         
91         if (hsec[0] == 0xff)   // unformatted/unused sector
90
91         if (hsec[0] == 0xff)    // unformatted/unused sector
9292            continue;
93         
93
9494         tracks[(track * 26) + sect] = hsec[0];
9595         heads[(track * 26) + sect] = hsec[1];
9696         secs[(track * 26) + sect] = hsec[2];
r242631r242632
110110   int cur_sec_map = 0, sector_size;
111111
112112   for (int track = 0; track < 160; track++)
113   {     
113   {
114114      int cur_pos = 0;
115      for (int i = 0; i < num_secs[track]; i++)
115      for (int i = 0; i < num_secs[track]; i++)
116116      {
117117         cur_sec_map = track * 26 + i;
118118         sector_size = 128 << sec_sizes[cur_sec_map];
r242631r242632
121121            memset(sect_data + cur_pos, fill_vals[cur_sec_map], sector_size);
122122         else
123123            io_generic_read(io, sect_data + cur_pos, sec_offs[cur_sec_map], sector_size);
124         
124
125125         sects[i].track       = tracks[cur_sec_map];
126126         sects[i].head        = heads[cur_sec_map];
127127         sects[i].sector      = secs[cur_sec_map];
r242631r242632
135135
136136      build_pc_track_mfm(track / 2, track % 2, image, cell_count, num_secs[track], sects, calc_default_pc_gap3_size(form_factor, (128 << sec_sizes[track * 26])));
137137   }
138   
138
139139   return true;
140140}
141141
trunk/src/lib/formats/nfd_dsk.c
r242631r242632
3030    0xA     = PDA (disk type)
3131    0xB-0xF = reserved and equal to 0x00 (possibly available for future format extensions?)
3232
33 
34   Revision 1
33
34    Revision 1
3535    ==========
36
36
3737    header structure (variable length > 0x120, header length = DWORD at 0x110)
3838    0x000-0x11F = same as Rev. 0 format
39   0x120-0x3AF = 164 DWORDs containing, for each track, the absolute position of the sector maps
39    0x120-0x3AF = 164 DWORDs containing, for each track, the absolute position of the sector maps
4040                  for sectors of the track. for unformatted/unused tracks 0 is used
4141    0x3B0-0x3B3 = absolute position of addintional info in the header, if any
4242    0x3B4-0x3BF = reserved
43    0x120-EOHeader = sector map + special data for each track:
43    0x120-EOHeader = sector map + special data for each track:
4444                     first 0x10 of each track = #sectors (WORD), #extra data (WORD), reserved 0xc bytes zeroed
4545                     then 0x10 for each sector of this track and 0x10 for each extra data chunk
4646
4747    sector map structure
48   0x0     = track number
48    0x0     = track number
4949    0x1     = head
5050    0x2     = sector number
5151    0x3     = sector size (in 128byte chunks)
r242631r242632
7474    - add support for DDAM in Rev. 0 (need an image which set it in some sector)
7575    - investigate the READ DATA bytes of sector headers
7676    - investigate RETRY DATA chunks
77
77
7878 *********************************************************************/
7979
8080#include "emu.h"
r242631r242632
101101
102102int nfd_format::identify(io_generic *io, UINT32 form_factor)
103103{
104   UINT8 h[16];   
104   UINT8 h[16];
105105   io_generic_read(io, h, 0, 16);
106   
106
107107   if (strncmp((const char *)h, "T98FDDIMAGE.R0", 14) == 0 || strncmp((const char *)h, "T98FDDIMAGE.R1", 14) == 0)
108108      return 100;
109109
r242631r242632
113113bool nfd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
114114{
115115   UINT64 size = io_generic_size(io);
116   UINT8 h[0x120], hsec[0x10];   
116   UINT8 h[0x120], hsec[0x10];
117117   io_generic_read(io, h, 0, 0x120);
118118   int format_version = !strncmp((const char *)h, "T98FDDIMAGE.R0", 14) ? 0 : 1;
119119
r242631r242632
156156            for (int sect = 0; sect < num_secs[track]; sect++)
157157            {
158158               io_generic_read(io, hsec, secmap_addr, 0x10);
159               
159
160160               if (track == 0 && sect == 0)
161                  disk_type = hsec[0xb];   // can this change across the disk? I don't think so...
161                  disk_type = hsec[0xb];  // can this change across the disk? I don't think so...
162162               secmap_addr += 0x10;
163               
163
164164               tracks[(track * 26) + sect] = hsec[0];
165165               heads[(track * 26) + sect] = hsec[1];
166166               secs[(track * 26) + sect] = hsec[2];
167167               sec_sizes[(track * 26) + sect] = hsec[3];
168168               mfm[(track * 26) + sect] = hsec[4];
169               
169
170170               curr_track_size += (128 << hsec[3]);
171171            }
172172
r242631r242632
174174            {
175175               for (int sect = 0; sect < num_specials[track]; sect++)
176176               {
177                  io_generic_read(io, hsec, secmap_addr, 0x10);   
177                  io_generic_read(io, hsec, secmap_addr, 0x10);
178178                  secmap_addr += 0x10;
179179                  curr_track_size += (hsec[9] + 1) * LITTLE_ENDIANIZE_INT32(*(UINT32 *)(hsec + 0x0a));
180180               }
r242631r242632
200200            io_generic_read(io, hsec, pos, 0x10);
201201
202202            if (track == 0 && sect == 0)
203               disk_type = hsec[0xa];   // can this change across the disk? I don't think so...
203               disk_type = hsec[0xa];  // can this change across the disk? I don't think so...
204204            pos += 0x10;
205           
206            if (hsec[0] == 0xff)   // unformatted/unused sector
205
206            if (hsec[0] == 0xff)    // unformatted/unused sector
207207               continue;
208           
208
209209            tracks[(track * 26) + sect] = hsec[0];
210210            heads[(track * 26) + sect] = hsec[1];
211211            secs[(track * 26) + sect] = hsec[2];
212212            sec_sizes[(track * 26) + sect] = hsec[3];
213213            mfm[(track * 26) + sect] = hsec[4];
214           
214
215215            curr_track_size += (128 << hsec[3]);
216216            curr_num_sec++;
217217         }
r242631r242632
226226
227227   switch (disk_type)
228228   {
229      case 0x10:   // 640K disk, 2DD
229      case 0x10:  // 640K disk, 2DD
230230         image->set_variant(floppy_image::DSDD);
231231         break;
232      //case 0x30:   // 1.44M disk, ?? (no images found)
233      //   break;
234      case 0x90:   // 1.2M disk, 2HD
232      //case 0x30:    // 1.44M disk, ?? (no images found)
233      //  break;
234      case 0x90:  // 1.2M disk, 2HD
235235      default:
236236         image->set_variant(floppy_image::DSHD);
237237         break;
r242631r242632
246246   {
247247      io_generic_read(io, sect_data, pos, track_sizes[track]);
248248
249      for (int i = 0; i < num_secs[track]; i++)
249      for (int i = 0; i < num_secs[track]; i++)
250250      {
251251         cur_sec_map = track * 26 + i;
252252         sector_size = 128 << sec_sizes[cur_sec_map];
r242631r242632
261261      }
262262      pos += track_sizes[track];
263263
264      // notice that the operation below might fail if sectors of the same track have variable sec_sizes,
264      // notice that the operation below might fail if sectors of the same track have variable sec_sizes,
265265      // because the gap3 calculation would account correctly only for the first sector...
266266      // examined images had constant sec_sizes in the each track, so probably this is not an issue
267267      if (mfm[track * 26])
r242631r242632
269269      else
270270         build_pc_track_fm(track / 2, track % 2, image, cell_count, num_secs[track], sects, calc_default_pc_gap3_size(form_factor, (128 << sec_sizes[track * 26])));
271271   }
272   
272
273273   return true;
274274}
275275
trunk/src/lib/formats/victor9k_dsk.c
r242631r242632
4040    cell 2.13 usec
4141
4242
43   Boot Disc Label Format
44   Track 0 Sector 0
43    Boot Disc Label Format
44    Track 0 Sector 0
4545
46   Byte
47   Offset         Name                Description
46    Byte
47    Offset         Name                Description
4848
49   0              System disc ID      literally, ff,00h for a system
50                                      disc
49    0              System disc ID      literally, ff,00h for a system
50                                       disc
5151
52   2              Load address        paragraph   to   load   booted
53                                      program at. If zero then  boot
54                                      loads in high memory.
52    2              Load address        paragraph   to   load   booted
53                                       program at. If zero then  boot
54                                       loads in high memory.
5555
56   4              Length              paragraph count to load.
56    4              Length              paragraph count to load.
5757
58   6              Entry offset        I.P.  value  for  transfer  of
59                                      control.
58    6              Entry offset        I.P.  value  for  transfer  of
59                                       control.
6060
61   8              Entry segment       C.S.  value  for  transfer  of
62                                      control.
61    8              Entry segment       C.S.  value  for  transfer  of
62                                       control.
6363
64   10             I.D.                disc identifier.
64    10             I.D.                disc identifier.
6565
66   18             Part number         system identifier  - displayed
67                                      by early versions of boot.
66    18             Part number         system identifier  - displayed
67                                       by early versions of boot.
6868
69   26             Sector size         byte count for sectors.
69    26             Sector size         byte count for sectors.
7070
71   28             Data start          first   data  sector  on  disc
72                                      (absolute sectors).
71    28             Data start          first   data  sector  on  disc
72                                       (absolute sectors).
7373
74   30             Boot start          first   absolute   sector   of
75                                      program  for boot to  load  at
76                                      'load  address'  for  'length'
77                                      paragraphs.
74    30             Boot start          first   absolute   sector   of
75                                       program  for boot to  load  at
76                                       'load  address'  for  'length'
77                                       paragraphs.
7878
79   32             Flags               indicators:
80                                           bit  meaning
81                                          15-12 interleave    factor
82                                                (0-15)
83                                            0   0=single sided
84                                                1=double sided
79    32             Flags               indicators:
80                                            bit  meaning
81                                           15-12 interleave    factor
82                                                 (0-15)
83                                             0   0=single sided
84                                                 1=double sided
8585
86   34             Disc type           00 = CP/M
87                                      01 = MS-DOS
86    34             Disc type           00 = CP/M
87                                       01 = MS-DOS
8888
89   35             Reserved
89    35             Reserved
9090
91   38             Speed table         information  for speed control
92                                      proc.
91    38             Speed table         information  for speed control
92                                       proc.
9393
94   56             Zone table          high track for each zone.
94    56             Zone table          high track for each zone.
9595
96   71             Sector/track        sectors  per  track  for  each
97                                      zone.
96    71             Sector/track        sectors  per  track  for  each
97                                       zone.
9898*/
9999
100100#include "emu.h"
trunk/src/mame/drivers/5clown.c
r242631r242632
471471   required_device<ay8910_device> m_ay8910;
472472   required_device<gfxdecode_device> m_gfxdecode;
473473   required_device<palette_device> m_palette;
474   
474
475475   required_shared_ptr<UINT8> m_videoram;
476476   required_shared_ptr<UINT8> m_colorram;
477   
477
478478   UINT8 m_main_latch_d800;
479479   UINT8 m_snd_latch_0800;
480480   UINT8 m_snd_latch_0a02;
481481   UINT8 m_ay8910_addr;
482482   tilemap_t *m_bg_tilemap;
483483   int m_mux_data;
484   
484
485485   DECLARE_WRITE8_MEMBER(fclown_videoram_w);
486486   DECLARE_WRITE8_MEMBER(fclown_colorram_w);
487487   DECLARE_WRITE8_MEMBER(cpu_c048_w);
r242631r242632
505505};
506506
507507void _5clown_state::machine_start()
508{   
508{
509509   m_main_latch_d800 = m_snd_latch_0800 = m_snd_latch_0a02 = m_ay8910_addr = m_mux_data = 0;
510   
510
511511   save_item(NAME(m_main_latch_d800));
512512   save_item(NAME(m_snd_latch_0800));
513513   save_item(NAME(m_snd_latch_0a02));
trunk/src/mame/drivers/atvtrack.c
r242631r242632
409409
410410void smashdrv_state::machine_start()
411411{
412
413412}
414413
415414void smashdrv_state::machine_reset()
r242631r242632
423422static ADDRESS_MAP_START( atvtrack_main_map, AS_PROGRAM, 64, atvtrack_state )
424423   AM_RANGE(0x00000000, 0x000003ff) AM_RAM AM_SHARE("sharedmem")
425424   AM_RANGE(0x00020000, 0x00020007) AM_READWRITE(control_r, control_w) // control registers
426//   AM_RANGE(0x00020040, 0x0002007f) // audio DAC buffer
425//  AM_RANGE(0x00020040, 0x0002007f) // audio DAC buffer
427426   AM_RANGE(0x14000000, 0x14000007) AM_READWRITE(area2_r, area2_w) // data
428427   AM_RANGE(0x14100000, 0x14100007) AM_READWRITE(area3_r, area3_w) // command
429428   AM_RANGE(0x14200000, 0x14200007) AM_READWRITE(area4_r, area4_w) // address
r242631r242632
585584   ROM_LOAD("prg.ic23", 0x0000000, 0x0400000, CRC(5cc6d3ac) SHA1(0c8426774212d891796b59c95b8c70f64db5b67a) )
586585
587586   ROM_REGION( 0x4000000, "maincpu", ROMREGION_ERASEFF)
588   ROM_LOAD32_WORD("sdra.ic15",   0x00000000,   0x01000000, CRC(cf702287) SHA1(84cd83c339831deff15fe5fcc353e0b596667500) )
589   ROM_LOAD32_WORD("sdrb.ic14",   0x00000002,   0x01000000, CRC(39b76f0e) SHA1(529943b6075925e5f72c6e966796e04b2c33686c) )
590   ROM_LOAD32_WORD("sdrc.ic20",   0x02000000,   0x01000000, CRC(c9021dd7) SHA1(1d08aab433614810af858a0fc5d7f03c7b782237) )
587   ROM_LOAD32_WORD("sdra.ic15",    0x00000000, 0x01000000, CRC(cf702287) SHA1(84cd83c339831deff15fe5fcc353e0b596667500) )
588   ROM_LOAD32_WORD("sdrb.ic14",    0x00000002, 0x01000000, CRC(39b76f0e) SHA1(529943b6075925e5f72c6e966796e04b2c33686c) )
589   ROM_LOAD32_WORD("sdrc.ic20",    0x02000000, 0x01000000, CRC(c9021dd7) SHA1(1d08aab433614810af858a0fc5d7f03c7b782237) )
591590   // ic21 unpopulated
592591ROM_END
593592
trunk/src/mame/drivers/barata.c
r242631r242632
22// copyright-holders:FelipeSanches
33/*************************************************************************
44
5   barata.c
5    barata.c
66
7   "Dona Barata"
7    "Dona Barata"
88
9   Brazilian "whack-a-mole"-style game themed after stepping on cockroaches.
10   The name "Dona Barata" means "Lady Cockroach" in brazilian portuguese.
9    Brazilian "whack-a-mole"-style game themed after stepping on cockroaches.
10    The name "Dona Barata" means "Lady Cockroach" in brazilian portuguese.
1111
12   Manufactured by Matic: http://maticplay.com.br/
13   This driver still only emulates an early prototype of the game.
14   Propper dumps of the actual released game is still lacking.
15   Photos on the web make us believe that there are at least 2 official
12    Manufactured by Matic: http://maticplay.com.br/
13    This driver still only emulates an early prototype of the game.
14    Propper dumps of the actual released game is still lacking.
15    Photos on the web make us believe that there are at least 2 official
1616    releases of this game.
1717
18   http://www.maticplay.com.br/equipamentos.php?equipamento=dona-barata
19   http://www.valedosduendes.com.br/site/wp-content/uploads/2012/02/barata_1.jpg
18    http://www.maticplay.com.br/equipamentos.php?equipamento=dona-barata
19    http://www.valedosduendes.com.br/site/wp-content/uploads/2012/02/barata_1.jpg
2020
2121    Driver by Felipe Sanches <juca@members.fsf.org>
2222
2323**************************************************************************
2424
25   TO-DO:
25    TO-DO:
2626
27   * at the moment, the portbits for the rows are still a guess
28   * as we don't have access to actual PCBs, the CPU clock frequency is a guess
29      (but maybe it can be infered by analysing the 1ms delay routine used)
30   * we don't have sound samples or background music dumps
31      (i.e. we lack dumps of all of the sound memory)
32   * we don't have ROM dumps of the official releases of the game
33   * it would be nice to add photographic artwork to improve the layout
27    * at the moment, the portbits for the rows are still a guess
28    * as we don't have access to actual PCBs, the CPU clock frequency is a guess
29        (but maybe it can be infered by analysing the 1ms delay routine used)
30    * we don't have sound samples or background music dumps
31        (i.e. we lack dumps of all of the sound memory)
32    * we don't have ROM dumps of the official releases of the game
33    * it would be nice to add photographic artwork to improve the layout
3434
3535**************************************************************************/
3636
r242631r242632
138138   return segment;
139139}
140140
141#define FPGA_PLAY_BGM            0
142#define FPGA_STOP_BGM            1
143#define FPGA_PLAY_SAMPLE         2
144#define FPGA_LAMP               3
145#define FPGA_COUNTER            4
146#define FPGA_WAITING_FOR_NEW_CMD   5
141#define FPGA_PLAY_BGM               0
142#define FPGA_STOP_BGM               1
143#define FPGA_PLAY_SAMPLE            2
144#define FPGA_LAMP                   3
145#define FPGA_COUNTER                4
146#define FPGA_WAITING_FOR_NEW_CMD    5
147147
148148const char* mode_strings[] = {
149149"Play background music",
r242631r242632
193193            lamp_index = lamp_data & 0x0F;
194194
195195            if (erase_all){
196//               logerror("LED: ERASE ALL\n");
196//                  logerror("LED: ERASE ALL\n");
197197               for (int i=0; i<16; i++){
198198                  output_set_led_value(i, 1);
199199               }
r242631r242632
329329/*************************
330330*      Game Drivers      *
331331*************************/
332GAME( 2002, barata,     0,        barata,   barata,    driver_device, 0,        ROT0,  "Eletro Matic Equipamentos Eletromecânicos", "Dona Barata (early prototype)", GAME_IMPERFECT_GRAPHICS )
332GAME( 2002, barata,     0,        barata,   barata,    driver_device, 0,        ROT0,  "Eletro Matic Equipamentos Eletromec??nicos", "Dona Barata (early prototype)", GAME_IMPERFECT_GRAPHICS )
trunk/src/mame/drivers/bfm_sc1.c
r242631r242632
178178   DECLARE_READ8_MEMBER(nec_r);
179179   DECLARE_WRITE8_MEMBER(nec_reset_w);
180180   DECLARE_WRITE8_MEMBER(nec_latch_w);
181   
181
182182   void save_state();
183183
184184   DECLARE_DRIVER_INIT(toppoker);
trunk/src/mame/drivers/bfm_sc2.c
r242631r242632
36133613
36143614   /* video hardware */
36153615   MCFG_DEFAULT_LAYOUT(layout_sc2_vfd)
3616   
3616
36173617   MCFG_DEVICE_ADD("reel0", STEPPER, 0)
36183618   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc2_state, reel0_optic_cb))
36193619   MCFG_DEVICE_ADD("reel1", STEPPER, 0)
r242631r242632
36213621   MCFG_DEVICE_ADD("reel2", STEPPER, 0)
36223622   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc2_state, reel2_optic_cb))
36233623   MCFG_DEVICE_ADD("reel3", STEPPER, 0)
3624   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc2_state, reel3_optic_cb))   
3624   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc2_state, reel3_optic_cb))
36253625   MCFG_DEVICE_ADD("reel4", STEPPER, 0)
36263626   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc2_state, reel4_optic_cb))
36273627   MCFG_DEVICE_ADD("reel5", STEPPER, 0)
r242631r242632
36633663   MCFG_CPU_ADD("matrix", M6809, 2000000 )             /* matrix board 6809 CPU at 2 Mhz ?? I don't know the exact freq.*/
36643664   MCFG_CPU_PROGRAM_MAP(bfm_dm01_memmap)
36653665   MCFG_CPU_PERIODIC_INT_DRIVER(bfm_sc2_state, nmi_line_assert, 1500 )          /* generate 1500 NMI's per second ?? what is the exact freq?? */
3666   
3666
36673667   MCFG_DEVICE_ADD("reel0", STEPPER, 0)
36683668   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc2_state, reel0_optic_cb))
36693669   MCFG_DEVICE_ADD("reel1", STEPPER, 0)
r242631r242632
36713671   MCFG_DEVICE_ADD("reel2", STEPPER, 0)
36723672   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc2_state, reel2_optic_cb))
36733673   MCFG_DEVICE_ADD("reel3", STEPPER, 0)
3674   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc2_state, reel3_optic_cb))   
3674   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc2_state, reel3_optic_cb))
36753675   MCFG_DEVICE_ADD("reel4", STEPPER, 0)
36763676   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc2_state, reel4_optic_cb))
36773677   MCFG_DEVICE_ADD("reel5", STEPPER, 0)
trunk/src/mame/drivers/bfm_sc4.c
r242631r242632
2831728317GAMEL( 200?, sc4pacclb   ,sc4paccl,  sc4_5reel, sc4paccl, sc4_state, sc4paccl, ROT0, "Mazooma","Pac Man Club (PR2018, CPAC) (Mazooma) (Scorpion 4) (set 3)", GAME_NOT_WORKING | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 )
2831828318GAMEL( 200?, sc4pacclc   ,sc4paccl,  sc4_5reel, sc4paccl, sc4_state, sc4paccl, ROT0, "Mazooma","Pac Man Club (PR2018, CPAC) (Mazooma) (Scorpion 4) (set 4)", GAME_NOT_WORKING | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 )
2831928319
28320 
28320
2832128321// REEL 4 ERR 24 (what type should be here??)
2832228322
2832328323DRIVER_INIT_MEMBER(sc4_state,sc4pmani)
trunk/src/mame/drivers/bfm_sc4h.c
r242631r242632
522522      m_reel1->update( data    &0x0f);
523523      awp_draw_reel("reel1", m_reel1);
524524   }
525   
526   if (m_reel2)   
525
526   if (m_reel2)
527527   {
528528      m_reel2->update((data>>4)&0x0f);
529529      awp_draw_reel("reel2", m_reel2);
r242631r242632
651651      m_reel5->update( data    &0x0f);
652652      awp_draw_reel("reel5", m_reel5);
653653   }
654   
655   if (m_reel6)   
654
655   if (m_reel6)
656656   {
657657      m_reel6->update((data>>4)&0x0f);
658658      awp_draw_reel("reel6", m_reel6);
r242631r242632
712712   MCFG_YMZ280B_IRQ_HANDLER(WRITELINE(sc4_state, bfm_sc4_irqhandler))
713713   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
714714MACHINE_CONFIG_END
715   
715
716716//Standard 6 reels all connected
717717MACHINE_CONFIG_START( sc4, sc4_state )
718718   MCFG_FRAGMENT_ADD(sc4_common)
719     
719
720720   MCFG_STARPOINT_RM20_48STEP_ADD("reel1")
721721   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel1_optic_cb))
722722   MCFG_STARPOINT_RM20_48STEP_ADD("reel2")
r242631r242632
734734//Standard 3 reels
735735MACHINE_CONFIG_START( sc4_3reel, sc4_state )
736736   MCFG_FRAGMENT_ADD(sc4_common)
737     
737
738738   MCFG_STARPOINT_RM20_48STEP_ADD("reel1")
739739   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel1_optic_cb))
740740   MCFG_STARPOINT_RM20_48STEP_ADD("reel2")
741741   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel2_optic_cb))
742742   MCFG_STARPOINT_RM20_48STEP_ADD("reel3")
743743   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel3_optic_cb))
744   
744
745745MACHINE_CONFIG_END
746746
747747//Standard 4 reels
748748MACHINE_CONFIG_START( sc4_4reel, sc4_state )
749749   MCFG_FRAGMENT_ADD(sc4_common)
750     
750
751751   MCFG_STARPOINT_RM20_48STEP_ADD("reel1")
752752   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel1_optic_cb))
753753   MCFG_STARPOINT_RM20_48STEP_ADD("reel2")
r242631r242632
762762MACHINE_CONFIG_START( sc4_4reel_alt, sc4_state )
763763
764764   MCFG_FRAGMENT_ADD(sc4_common)
765     
765
766766   MCFG_STARPOINT_RM20_48STEP_ADD("reel1")
767767   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel1_optic_cb))
768768   MCFG_STARPOINT_RM20_48STEP_ADD("reel2")
769769   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel2_optic_cb))
770770   MCFG_STARPOINT_RM20_48STEP_ADD("reel3")
771771   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel3_optic_cb))
772   
772
773773   MCFG_STARPOINT_RM20_48STEP_ADD("reel5")
774774   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel5_optic_cb))
775775MACHINE_CONFIG_END
r242631r242632
778778//Standard 5 reels
779779MACHINE_CONFIG_START( sc4_5reel, sc4_state )
780780   MCFG_FRAGMENT_ADD(sc4_common)
781     
781
782782   MCFG_STARPOINT_RM20_48STEP_ADD("reel1")
783783   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel1_optic_cb))
784784   MCFG_STARPOINT_RM20_48STEP_ADD("reel2")
r242631r242632
794794//5 reels, with RL4 skipped
795795MACHINE_CONFIG_START( sc4_5reel_alt, sc4_state )
796796   MCFG_FRAGMENT_ADD(sc4_common)
797     
797
798798   MCFG_STARPOINT_RM20_48STEP_ADD("reel1")
799799   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel1_optic_cb))
800800   MCFG_STARPOINT_RM20_48STEP_ADD("reel2")
801801   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel2_optic_cb))
802802   MCFG_STARPOINT_RM20_48STEP_ADD("reel3")
803803   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel3_optic_cb))
804   
804
805805   MCFG_STARPOINT_RM20_48STEP_ADD("reel5")
806806   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel5_optic_cb))
807807   MCFG_STARPOINT_RM20_48STEP_ADD("reel6")
808808   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel6_optic_cb))
809   
809
810810MACHINE_CONFIG_END
811811
812812//6 reels, last 200 steps
813813MACHINE_CONFIG_START( sc4_200_std, sc4_state )
814814
815815   MCFG_FRAGMENT_ADD(sc4_common)
816     
816
817817   MCFG_STARPOINT_RM20_48STEP_ADD("reel1")
818818   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel1_optic_cb))
819819   MCFG_STARPOINT_RM20_48STEP_ADD("reel2")
r242631r242632
823823   MCFG_STARPOINT_RM20_48STEP_ADD("reel4")
824824   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel4_optic_cb))
825825   MCFG_STARPOINT_RM20_48STEP_ADD("reel5")
826   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel5_optic_cb))   
826   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel5_optic_cb))
827827   MCFG_STARPOINT_200STEP_ADD("reel6")
828828   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel6_optic_cb))
829829MACHINE_CONFIG_END
r242631r242632
831831//6 reels, last 200 steps
832832MACHINE_CONFIG_START( sc4_200_alt, sc4_state )
833833   MCFG_FRAGMENT_ADD(sc4_common)
834     
834
835835   MCFG_STARPOINT_RM20_48STEP_ADD("reel1")
836836   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel1_optic_cb))
837837   MCFG_STARPOINT_RM20_48STEP_ADD("reel2")
r242631r242632
841841   MCFG_STARPOINT_200STEP_ADD("reel4")
842842   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel4_optic_cb))
843843   MCFG_STARPOINT_200STEP_ADD("reel5")
844   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel5_optic_cb))   
844   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel5_optic_cb))
845845   MCFG_STARPOINT_RM20_48STEP_ADD("reel6")
846846   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel6_optic_cb))
847847MACHINE_CONFIG_END
r242631r242632
849849//6 reels, RL4 200 steps
850850MACHINE_CONFIG_START( sc4_200_alta, sc4_state )
851851   MCFG_FRAGMENT_ADD(sc4_common)
852     
852
853853   MCFG_STARPOINT_RM20_48STEP_ADD("reel1")
854854   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel1_optic_cb))
855855   MCFG_STARPOINT_RM20_48STEP_ADD("reel2")
r242631r242632
859859   MCFG_STARPOINT_RM20_48STEP_ADD("reel4")
860860   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel4_optic_cb))
861861   MCFG_STARPOINT_200STEP_ADD("reel5")
862   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel5_optic_cb))   
862   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel5_optic_cb))
863863   MCFG_STARPOINT_RM20_48STEP_ADD("reel6")
864864   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel6_optic_cb))
865865MACHINE_CONFIG_END
r242631r242632
867867//6 reels, 3 48 step, 3 200 step
868868MACHINE_CONFIG_START( sc4_200_altb, sc4_state )
869869   MCFG_FRAGMENT_ADD(sc4_common)
870     
870
871871   MCFG_STARPOINT_200STEP_ADD("reel1")
872872   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel1_optic_cb))
873873   MCFG_STARPOINT_200STEP_ADD("reel2")
r242631r242632
877877   MCFG_STARPOINT_RM20_48STEP_ADD("reel4")
878878   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel4_optic_cb))
879879   MCFG_STARPOINT_RM20_48STEP_ADD("reel5")
880   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel5_optic_cb))   
880   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel5_optic_cb))
881881   MCFG_STARPOINT_RM20_48STEP_ADD("reel6")
882882   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel6_optic_cb))
883883MACHINE_CONFIG_END
r242631r242632
885885//5 reels, last one 200 steps
886886MACHINE_CONFIG_START( sc4_200_5r, sc4_state )
887887   MCFG_FRAGMENT_ADD(sc4_common)
888     
888
889889   MCFG_STARPOINT_RM20_48STEP_ADD("reel1")
890890   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel1_optic_cb))
891891   MCFG_STARPOINT_RM20_48STEP_ADD("reel2")
r242631r242632
893893   MCFG_STARPOINT_RM20_48STEP_ADD("reel3")
894894   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel3_optic_cb))
895895   MCFG_STARPOINT_RM20_48STEP_ADD("reel4")
896   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel4_optic_cb))   
896   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel4_optic_cb))
897897   MCFG_STARPOINT_200STEP_ADD("reel5")
898   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel5_optic_cb))   
898   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel5_optic_cb))
899899MACHINE_CONFIG_END
900900
901901
r242631r242632
903903//5 reels, last one 200 steps, RL4 skipped
904904MACHINE_CONFIG_START( sc4_200_5ra, sc4_state )
905905   MCFG_FRAGMENT_ADD(sc4_common)
906     
906
907907   MCFG_STARPOINT_RM20_48STEP_ADD("reel1")
908908   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel1_optic_cb))
909909   MCFG_STARPOINT_RM20_48STEP_ADD("reel2")
910910   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel2_optic_cb))
911911   MCFG_STARPOINT_RM20_48STEP_ADD("reel3")
912912   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel3_optic_cb))
913   
913
914914   MCFG_STARPOINT_RM20_48STEP_ADD("reel5")
915   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel5_optic_cb))   
915   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel5_optic_cb))
916916   MCFG_STARPOINT_200STEP_ADD("reel6")
917917   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel6_optic_cb))
918918MACHINE_CONFIG_END
r242631r242632
920920//5 reels, last one 200 steps, RL5 skipped
921921MACHINE_CONFIG_START( sc4_200_5rb, sc4_state )
922922   MCFG_FRAGMENT_ADD(sc4_common)
923     
923
924924   MCFG_STARPOINT_RM20_48STEP_ADD("reel1")
925925   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel1_optic_cb))
926926   MCFG_STARPOINT_RM20_48STEP_ADD("reel2")
r242631r242632
937937//5 reels, RL5 200 steps, RL4 skipped
938938MACHINE_CONFIG_START( sc4_200_5rc, sc4_state )
939939   MCFG_FRAGMENT_ADD(sc4_common)
940     
940
941941   MCFG_STARPOINT_RM20_48STEP_ADD("reel1")
942942   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel1_optic_cb))
943943   MCFG_STARPOINT_RM20_48STEP_ADD("reel2")
944944   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel2_optic_cb))
945945   MCFG_STARPOINT_RM20_48STEP_ADD("reel3")
946946   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel3_optic_cb))
947   
947
948948   MCFG_STARPOINT_200STEP_ADD("reel5")
949949   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel5_optic_cb))
950950   MCFG_STARPOINT_RM20_48STEP_ADD("reel6")
951   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel6_optic_cb))   
951   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel6_optic_cb))
952952MACHINE_CONFIG_END
953953
954954//4 reels, last one 200 steps
955955MACHINE_CONFIG_START( sc4_200_4r, sc4_state )
956956   MCFG_FRAGMENT_ADD(sc4_common)
957     
957
958958   MCFG_STARPOINT_RM20_48STEP_ADD("reel1")
959959   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel1_optic_cb))
960960   MCFG_STARPOINT_RM20_48STEP_ADD("reel2")
r242631r242632
962962   MCFG_STARPOINT_RM20_48STEP_ADD("reel3")
963963   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel3_optic_cb))
964964   MCFG_STARPOINT_200STEP_ADD("reel4")
965   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel4_optic_cb))   
965   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel4_optic_cb))
966966MACHINE_CONFIG_END
967967
968968//4 reels, last one 200 steps, RL4 skipped
969969MACHINE_CONFIG_START( sc4_200_4ra, sc4_state )
970970   MCFG_FRAGMENT_ADD(sc4_common)
971     
971
972972   MCFG_STARPOINT_RM20_48STEP_ADD("reel1")
973973   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel1_optic_cb))
974974   MCFG_STARPOINT_RM20_48STEP_ADD("reel2")
r242631r242632
984984//4 reels, last one 200 steps, RL4,5 skipped
985985MACHINE_CONFIG_START( sc4_200_4rb, sc4_state )
986986   MCFG_FRAGMENT_ADD(sc4_common)
987     
987
988988   MCFG_STARPOINT_RM20_48STEP_ADD("reel1")
989989   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel1_optic_cb))
990990   MCFG_STARPOINT_RM20_48STEP_ADD("reel2")
991991   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel2_optic_cb))
992992   MCFG_STARPOINT_RM20_48STEP_ADD("reel3")
993993   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel3_optic_cb))
994   
994
995995   MCFG_STARPOINT_200STEP_ADD("reel6")
996996   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel6_optic_cb))
997997MACHINE_CONFIG_END
998998
999999MACHINE_CONFIG_START( sc4_4reel_200, sc4_state )
10001000   MCFG_FRAGMENT_ADD(sc4_common)
1001     
1001
10021002   MCFG_STARPOINT_200STEP_ADD("reel1")
10031003   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel1_optic_cb))
10041004   MCFG_STARPOINT_200STEP_ADD("reel2")
r242631r242632
10061006   MCFG_STARPOINT_200STEP_ADD("reel3")
10071007   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel3_optic_cb))
10081008   MCFG_STARPOINT_200STEP_ADD("reel4")
1009   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel4_optic_cb))     
1009   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel4_optic_cb))
10101010MACHINE_CONFIG_END
10111011
10121012MACHINE_CONFIG_START( sc4_3reel_200, sc4_state )
10131013   MCFG_FRAGMENT_ADD(sc4_common)
1014     
1014
10151015   MCFG_STARPOINT_200STEP_ADD("reel1")
10161016   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel1_optic_cb))
10171017   MCFG_STARPOINT_200STEP_ADD("reel2")
r242631r242632
10231023MACHINE_CONFIG_START( sc4_3reel_200_48, sc4_state )
10241024
10251025   MCFG_FRAGMENT_ADD(sc4_common)
1026     
1026
10271027   MCFG_STARPOINT_200STEP_ADD("reel1")
10281028   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel1_optic_cb))
10291029   MCFG_STARPOINT_200STEP_ADD("reel2")
r242631r242632
10311031   MCFG_STARPOINT_200STEP_ADD("reel3")
10321032   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel3_optic_cb))
10331033   MCFG_STARPOINT_48STEP_ADD("reel4")
1034   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel4_optic_cb))   
1034   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel4_optic_cb))
10351035MACHINE_CONFIG_END
10361036
10371037MACHINE_CONFIG_START( sc4_no_reels, sc4_state )
r242631r242632
10471047
10481048MACHINE_CONFIG_START( sc4_adder4, sc4_adder4_state )
10491049   MCFG_FRAGMENT_ADD(sc4_common)
1050   
1050
10511051   MCFG_CPU_ADD("adder4", M68340, 25175000)     // 68340 (CPU32 core)
10521052   MCFG_CPU_PROGRAM_MAP(sc4_adder4_map)
10531053
r242631r242632
10661066   MCFG_CPU_PERIODIC_INT_DRIVER(sc4_state, nmi_line_assert, 1500 )          /* generate 1500 NMI's per second ?? what is the exact freq?? */
10671067
10681068   MCFG_MACHINE_START_OVERRIDE(sc4_state, sc4 )
1069   
1069
10701070   MCFG_STARPOINT_RM20_48STEP_ADD("reel1")
10711071   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel1_optic_cb))
10721072   MCFG_STARPOINT_RM20_48STEP_ADD("reel2")
trunk/src/mame/drivers/bwidow.c
r242631r242632
393393   AM_RANGE(0x0900, 0x0907) AM_READ(spacduel_IN3_r)    /* IN1 */
394394   AM_RANGE(0x0905, 0x0906) AM_WRITENOP /* ignore? */
395395   AM_RANGE(0x0a00, 0x0a00) AM_DEVREAD("earom", atari_vg_earom_device, read)
396    AM_RANGE(0x0c00, 0x0c00) AM_WRITE(spacduel_coin_counter_w) /* coin out */
396   AM_RANGE(0x0c00, 0x0c00) AM_WRITE(spacduel_coin_counter_w) /* coin out */
397397   AM_RANGE(0x0c80, 0x0c80) AM_DEVWRITE("avg", avg_device, go_w)
398398   AM_RANGE(0x0d00, 0x0d00) AM_WRITENOP /* watchdog clear */
399399   AM_RANGE(0x0d80, 0x0d80) AM_DEVWRITE("avg", avg_device, reset_w)
trunk/src/mame/drivers/cps1.c
r242631r242632
1153211532   m_maincpu->space(AS_PROGRAM).install_read_handler(0xf18000, 0xf19fff, read16_delegate(FUNC(cps_state::dinohunt_sound_r), this));
1153311533   m_maincpu->space(AS_PROGRAM).install_read_port(0xfc0000, 0xfc0001, "IN2"); ;
1153411534   // the ym2151 doesn't seem to be used. Is it actually on the PCB?
11535   
11535
1153611536   DRIVER_INIT_CALL(cps1);
1153711537}
1153811538
trunk/src/mame/drivers/cultures.c
r242631r242632
185185ADDRESS_MAP_END
186186
187187static ADDRESS_MAP_START( vrambank_map, AS_PROGRAM, 8, cultures_state )
188   AM_RANGE(0x0000, 0x3fff) AM_RAM_WRITE(bg0_videoram_w) AM_SHARE("bg0_videoram")   
188   AM_RANGE(0x0000, 0x3fff) AM_RAM_WRITE(bg0_videoram_w) AM_SHARE("bg0_videoram")
189189   AM_RANGE(0x4000, 0x6fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
190190ADDRESS_MAP_END
191191
trunk/src/mame/drivers/dreamwld.c
r242631r242632
383383
384384READ32_MEMBER(dreamwld_state::dreamwld_protdata_r)
385385{
386//   static int count = 0;
386//  static int count = 0;
387387
388388   UINT8 *protdata = memregion("user1")->base();
389389   size_t protsize = memregion("user1")->bytes();
390390   UINT8 dat = protdata[(m_protindex++) % protsize];
391391
392//   printf("protection read %04x %02x\n", count, dat);
393//   count++;
392//  printf("protection read %04x %02x\n", count, dat);
393//  count++;
394394
395395   // real hw returns 00 after end of data, I haven't checked if it's possible to overflow the read counter
396396   // and read out the internal rom.
r242631r242632
614614   PORT_START("DSW")
615615   PORT_DIPUNUSED_DIPLOC( 0x0001, IP_ACTIVE_LOW, "SW2:1" ) /* As listed in service mode, but tested */
616616   PORT_DIPUNUSED_DIPLOC( 0x0002, IP_ACTIVE_LOW, "SW2:2" ) /* These might have some use, requires investigation of code */
617    PORT_DIPUNUSED_DIPLOC( 0x0004, IP_ACTIVE_LOW, "SW2:3" )
618    PORT_DIPUNUSED_DIPLOC( 0x0008, IP_ACTIVE_LOW, "SW2:4" )
619    PORT_DIPUNUSED_DIPLOC( 0x0010, IP_ACTIVE_LOW, "SW2:5" )
620    PORT_DIPNAME( 0x0060, 0x0060, "Ticket Payout" )         PORT_DIPLOCATION("SW2:6,7")
621    PORT_DIPSETTING(      0x0000, DEF_STR( No ) )
622    PORT_DIPSETTING(      0x0020, "Little" )
623    PORT_DIPSETTING(      0x0060, DEF_STR( Normal ) )
624    PORT_DIPSETTING(      0x0040, "Much" )
625    PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Free_Play ) )    PORT_DIPLOCATION("SW2:8")
626    PORT_DIPSETTING(      0x0080, DEF_STR( Off ) )
627    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
628    PORT_DIPNAME( 0x0100, 0x0000, DEF_STR( Demo_Sounds ) )  PORT_DIPLOCATION("SW1:1") /* Has no effect?? */
629    PORT_DIPSETTING(      0x0100, DEF_STR( Off ) )
630    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
631    PORT_DIPNAME( 0x0e00, 0x0e00, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW1:2,3,4")
632    PORT_DIPSETTING(      0x0000, DEF_STR( 5C_1C ) )
633    PORT_DIPSETTING(      0x0200, DEF_STR( 4C_1C ) )
634    PORT_DIPSETTING(      0x0400, DEF_STR( 3C_1C ) )
635    PORT_DIPSETTING(      0x0600, DEF_STR( 2C_1C ) )
636    PORT_DIPSETTING(      0x0e00, DEF_STR( 1C_1C ) )
637    PORT_DIPSETTING(      0x0a00, DEF_STR( 2C_3C ) )
638    PORT_DIPSETTING(      0x0c00, DEF_STR( 1C_2C ) )
639    PORT_DIPSETTING(      0x0800, DEF_STR( 1C_3C ) )
640    PORT_DIPNAME( 0x7000, 0x7000, DEF_STR( Difficulty ) )   PORT_DIPLOCATION("SW1:5,6,7")
641    PORT_DIPSETTING(      0x2000, "Level 1" )
642    PORT_DIPSETTING(      0x1000, "Level 2" )
643    PORT_DIPSETTING(      0x0000, "Level 3" )
644    PORT_DIPSETTING(      0x7000, "Level 4" )
645    PORT_DIPSETTING(      0x6000, "Level 5" )
646    PORT_DIPSETTING(      0x5000, "Level 6" )
647    PORT_DIPSETTING(      0x4000, "Level 7" )
648    PORT_DIPSETTING(      0x3000, "Level 8" )
649    PORT_SERVICE_DIPLOC( 0x8000, IP_ACTIVE_LOW, "SW1:8" )
617   PORT_DIPUNUSED_DIPLOC( 0x0004, IP_ACTIVE_LOW, "SW2:3" )
618   PORT_DIPUNUSED_DIPLOC( 0x0008, IP_ACTIVE_LOW, "SW2:4" )
619   PORT_DIPUNUSED_DIPLOC( 0x0010, IP_ACTIVE_LOW, "SW2:5" )
620   PORT_DIPNAME( 0x0060, 0x0060, "Ticket Payout" )         PORT_DIPLOCATION("SW2:6,7")
621   PORT_DIPSETTING(      0x0000, DEF_STR( No ) )
622   PORT_DIPSETTING(      0x0020, "Little" )
623   PORT_DIPSETTING(      0x0060, DEF_STR( Normal ) )
624   PORT_DIPSETTING(      0x0040, "Much" )
625   PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Free_Play ) )    PORT_DIPLOCATION("SW2:8")
626   PORT_DIPSETTING(      0x0080, DEF_STR( Off ) )
627   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
628   PORT_DIPNAME( 0x0100, 0x0000, DEF_STR( Demo_Sounds ) )  PORT_DIPLOCATION("SW1:1") /* Has no effect?? */
629   PORT_DIPSETTING(      0x0100, DEF_STR( Off ) )
630   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
631   PORT_DIPNAME( 0x0e00, 0x0e00, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW1:2,3,4")
632   PORT_DIPSETTING(      0x0000, DEF_STR( 5C_1C ) )
633   PORT_DIPSETTING(      0x0200, DEF_STR( 4C_1C ) )
634   PORT_DIPSETTING(      0x0400, DEF_STR( 3C_1C ) )
635   PORT_DIPSETTING(      0x0600, DEF_STR( 2C_1C ) )
636   PORT_DIPSETTING(      0x0e00, DEF_STR( 1C_1C ) )
637   PORT_DIPSETTING(      0x0a00, DEF_STR( 2C_3C ) )
638   PORT_DIPSETTING(      0x0c00, DEF_STR( 1C_2C ) )
639   PORT_DIPSETTING(      0x0800, DEF_STR( 1C_3C ) )
640   PORT_DIPNAME( 0x7000, 0x7000, DEF_STR( Difficulty ) )   PORT_DIPLOCATION("SW1:5,6,7")
641   PORT_DIPSETTING(      0x2000, "Level 1" )
642   PORT_DIPSETTING(      0x1000, "Level 2" )
643   PORT_DIPSETTING(      0x0000, "Level 3" )
644   PORT_DIPSETTING(      0x7000, "Level 4" )
645   PORT_DIPSETTING(      0x6000, "Level 5" )
646   PORT_DIPSETTING(      0x5000, "Level 6" )
647   PORT_DIPSETTING(      0x4000, "Level 7" )
648   PORT_DIPSETTING(      0x3000, "Level 8" )
649   PORT_SERVICE_DIPLOC( 0x8000, IP_ACTIVE_LOW, "SW1:8" )
650650INPUT_PORTS_END
651651
652652
r242631r242632
10731073GAME( 1997, baryon,   0,      baryon,   baryon,   driver_device, 0, ROT270, "SemiCom",         "Baryon - Future Assault (set 1)", GAME_SUPPORTS_SAVE )
10741074GAME( 1997, baryona,  baryon, baryon,   baryon,   driver_device, 0, ROT270, "SemiCom",         "Baryon - Future Assault (set 2)", GAME_SUPPORTS_SAVE )
10751075GAME( 1998, cutefght, 0,      dreamwld, cutefght, driver_device, 0, ROT0,   "SemiCom",         "Cute Fighter", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_GRAPHICS ) // wrong linescroll?
1076GAME( 1999, rolcrush, 0,      baryon,   rolcrush, driver_device, 0, ROT0,   "Trust / SemiCom", "Rolling Crush (version 1.07.E - 1999/02/11)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_GRAPHICS ) // wrong
1076GAME( 1999, rolcrush, 0,      baryon,   rolcrush, driver_device, 0, ROT0,   "Trust / SemiCom", "Rolling Crush (version 1.07.E - 1999/02/11)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_GRAPHICS ) // wrong
10771077GAME( 2000, dreamwld, 0,      dreamwld, dreamwld, driver_device, 0, ROT0,   "SemiCom",         "Dream World", GAME_SUPPORTS_SAVE )
trunk/src/mame/drivers/ecoinfr.c
r242631r242632
786786   MCFG_ECOIN_200STEP_ADD("reel2")
787787   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinfr_state, reel2_optic_cb))
788788   MCFG_ECOIN_200STEP_ADD("reel3")
789   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinfr_state, reel3_optic_cb))   
789   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinfr_state, reel3_optic_cb))
790790MACHINE_CONFIG_END
791791
792792
trunk/src/mame/drivers/f-32.c
r242631r242632
2727
2828   /* devices */
2929   required_device<e132xn_device>  m_maincpu;
30   
30
3131   /* memory pointers */
3232   required_shared_ptr<UINT32> m_videoram;
33   
33
3434   DECLARE_READ32_MEMBER(f32_input_port_1_r);
3535   UINT32 screen_update_mosaicf2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
3636};
trunk/src/mame/drivers/galpani2.c
r242631r242632
7171     PISCES - NEC uPD78324 series MCU with 32k internal rom. Clock 13.500MHz [27/2] on pins 51 & 52
7272      VSync - 59.1856Hz
7373      HSync - 15.625kHz
74     
74
7575      (TODO: VTOTAL = 264, HTOTAL = 432, pixel clock 27 MHz / 4)
76     
76
7777***************************************************************************/
7878
7979#include "emu.h"
r242631r242632
346346   AM_RANGE(0x300000, 0x301fff) AM_RAM                                             // ?
347347   AM_RANGE(0x302000, 0x303fff) AM_RAM AM_SHARE("spriteram")   // Sprites
348348   AM_RANGE(0x304000, 0x30401f) AM_DEVREADWRITE("kan_spr", kaneko16_sprite_device, kaneko16_sprites_regs_r, kaneko16_sprites_regs_w)
349//   AM_RANGE(0x308000, 0x308001) AM_WRITENOP                                        // ? 0 at startup
350//   AM_RANGE(0x30c000, 0x30c001) AM_WRITENOP                                        // ? hblank effect ?
349//  AM_RANGE(0x308000, 0x308001) AM_WRITENOP                                        // ? 0 at startup
350//  AM_RANGE(0x30c000, 0x30c001) AM_WRITENOP                                        // ? hblank effect ?
351351   AM_RANGE(0x310000, 0x3101ff) AM_RAM_DEVWRITE("bg8palette", palette_device, write) AM_SHARE("bg8palette")    // ?
352352   AM_RANGE(0x314000, 0x314001) AM_WRITENOP                                        // ? flip backgrounds ?
353353   AM_RANGE(0x318000, 0x318001) AM_READWRITE(galpani2_eeprom_r, galpani2_eeprom_w) // EEPROM
354354   AM_RANGE(0x380000, 0x387fff) AM_RAM                                             // Palette?
355355   AM_RANGE(0x388000, 0x38ffff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")   // Palette
356//   AM_RANGE(0x390000, 0x3901ff) AM_WRITENOP                                        // ? at startup of service mode
356//  AM_RANGE(0x390000, 0x3901ff) AM_WRITENOP                                        // ? at startup of service mode
357357
358358   AM_RANGE(0x400000, 0x43ffff) AM_RAM AM_SHARE("bg8.0")    // Background 0
359359   AM_RANGE(0x440000, 0x440001) AM_RAM AM_SHARE("bg8_scrollx.0")           // Background 0 Scroll X
360360   AM_RANGE(0x480000, 0x480001) AM_RAM AM_SHARE("bg8_scrolly.0")           // Background 0 Scroll Y
361//   AM_RANGE(0x4c0000, 0x4c0001) AM_WRITENOP                                        // ? 0 at startup only
361//  AM_RANGE(0x4c0000, 0x4c0001) AM_WRITENOP                                        // ? 0 at startup only
362362   AM_RANGE(0x500000, 0x53ffff) AM_RAM AM_SHARE("bg8.1")    // Background 1
363363   AM_RANGE(0x540000, 0x540001) AM_RAM AM_SHARE("bg8_scrollx.1")           // Background 1 Scroll X
364364   AM_RANGE(0x580000, 0x580001) AM_RAM AM_SHARE("bg8_scrolly.1")           // Background 1 Scroll Y
365//   AM_RANGE(0x5c0000, 0x5c0001) AM_WRITENOP                                        // ? 0 at startup only
365//  AM_RANGE(0x5c0000, 0x5c0001) AM_WRITENOP                                        // ? 0 at startup only
366366
367367   AM_RANGE(0x540572, 0x540573) AM_READNOP                                         // ? galpani2 at F0A4
368368   AM_RANGE(0x54057a, 0x54057b) AM_READNOP                                         // ? galpani2 at F148
r242631r242632
411411   AM_RANGE(0x000000, 0x03ffff) AM_ROM                                                             // ROM
412412   AM_RANGE(0x100000, 0x13ffff) AM_RAM AM_SHARE("ram2")                                        // Work RAM
413413   AM_RANGE(0x400000, 0x5fffff) AM_RAM AM_SHARE("bg15")  // bg15
414//   AM_RANGE(0x600000, 0x600001) AM_NOP // ? 0 at startup only
415//   AM_RANGE(0x640000, 0x640001) AM_WRITENOP                                // ? 0 at startup only
416//   AM_RANGE(0x680000, 0x680001) AM_WRITENOP                                // ? 0 at startup only
417//   AM_RANGE(0x6c0000, 0x6c0001) AM_WRITENOP                                // ? 0 at startup only
414//  AM_RANGE(0x600000, 0x600001) AM_NOP // ? 0 at startup only
415//  AM_RANGE(0x640000, 0x640001) AM_WRITENOP                                // ? 0 at startup only
416//  AM_RANGE(0x680000, 0x680001) AM_WRITENOP                                // ? 0 at startup only
417//  AM_RANGE(0x6c0000, 0x6c0001) AM_WRITENOP                                // ? 0 at startup only
418418   AM_RANGE(0x700000, 0x700001) AM_NOP                                 // Watchdog
419419//  AM_RANGE(0x740000, 0x740001) AM_WRITENOP                                // ? Reset mcu
420420   AM_RANGE(0x780000, 0x780001) AM_WRITE8(galpani2_mcu_nmi2_w, 0x00ff)             // ? 0 -> 1 -> 0 (lev 5)
r242631r242632
520520   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
521521   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNKNOWN )
522522   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNKNOWN )
523    PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_SERVICE2  ) // this button is used in gp2se as an alt way to bring up the service menu, booting with it held down breaks the game tho!
523   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_SERVICE2  ) // this button is used in gp2se as an alt way to bring up the service menu, booting with it held down breaks the game tho!
524524   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_TILT     )
525525   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_SERVICE1 )
526526
trunk/src/mame/drivers/gts1.c
r242631r242632
8484class gts1_state : public genpin_class
8585{
8686public:
87    gts1_state(const machine_config &mconfig, device_type type, const char *tag)
88        : genpin_class(mconfig, type, tag)
89        , m_maincpu(*this, "maincpu")
90        , m_switches(*this, "X")
91    { }
87   gts1_state(const machine_config &mconfig, device_type type, const char *tag)
88      : genpin_class(mconfig, type, tag)
89      , m_maincpu(*this, "maincpu")
90      , m_switches(*this, "X")
91   { }
9292
93    DECLARE_DRIVER_INIT(gts1);
93   DECLARE_DRIVER_INIT(gts1);
9494
95    DECLARE_READ8_MEMBER (gts1_solenoid_r);
96    DECLARE_WRITE8_MEMBER(gts1_solenoid_w);
97    DECLARE_READ8_MEMBER (gts1_switches_r);
98    DECLARE_WRITE8_MEMBER(gts1_switches_w);
99    DECLARE_WRITE8_MEMBER(gts1_display_w);
100    DECLARE_READ8_MEMBER (gts1_lamp_apm_r);
101    DECLARE_WRITE8_MEMBER(gts1_lamp_apm_w);
102    DECLARE_READ8_MEMBER (gts1_nvram_r);
103    DECLARE_WRITE8_MEMBER(gts1_nvram_w);
104    DECLARE_READ8_MEMBER (gts1_io_r);
105    DECLARE_WRITE8_MEMBER(gts1_io_w);
106    DECLARE_READ8_MEMBER (gts1_pa_r);
107    DECLARE_WRITE8_MEMBER(gts1_pa_w);
108    DECLARE_WRITE8_MEMBER(gts1_pb_w);
95   DECLARE_READ8_MEMBER (gts1_solenoid_r);
96   DECLARE_WRITE8_MEMBER(gts1_solenoid_w);
97   DECLARE_READ8_MEMBER (gts1_switches_r);
98   DECLARE_WRITE8_MEMBER(gts1_switches_w);
99   DECLARE_WRITE8_MEMBER(gts1_display_w);
100   DECLARE_READ8_MEMBER (gts1_lamp_apm_r);
101   DECLARE_WRITE8_MEMBER(gts1_lamp_apm_w);
102   DECLARE_READ8_MEMBER (gts1_nvram_r);
103   DECLARE_WRITE8_MEMBER(gts1_nvram_w);
104   DECLARE_READ8_MEMBER (gts1_io_r);
105   DECLARE_WRITE8_MEMBER(gts1_io_w);
106   DECLARE_READ8_MEMBER (gts1_pa_r);
107   DECLARE_WRITE8_MEMBER(gts1_pa_w);
108   DECLARE_WRITE8_MEMBER(gts1_pb_w);
109109private:
110    virtual void machine_reset();
111    required_device<cpu_device> m_maincpu;
112    required_ioport_array<5> m_switches;
113    UINT8 m_strobe;             //!< switches strobe lines (5 lower bits used)
114    UINT8 m_nvram_addr;         //!< NVRAM address
115    bool m_nvram_e2;            //!< NVRWAM enable (E2 line)
116    bool m_nvram_wr;            //!< NVRWAM write (W/R line)
117    UINT16 m_6351_addr;         //!< ROM MM6351 address (12 bits)
118    UINT16 m_z30_out;           //!< 4-to-16 decoder outputs
110   virtual void machine_reset();
111   required_device<cpu_device> m_maincpu;
112   required_ioport_array<5> m_switches;
113   UINT8 m_strobe;             //!< switches strobe lines (5 lower bits used)
114   UINT8 m_nvram_addr;         //!< NVRAM address
115   bool m_nvram_e2;            //!< NVRWAM enable (E2 line)
116   bool m_nvram_wr;            //!< NVRWAM write (W/R line)
117   UINT16 m_6351_addr;         //!< ROM MM6351 address (12 bits)
118   UINT16 m_z30_out;           //!< 4-to-16 decoder outputs
119119};
120120
121121static ADDRESS_MAP_START( gts1_map, AS_PROGRAM, 8, gts1_state )
122    AM_RANGE(0x0000, 0x0fff) AM_ROM
122   AM_RANGE(0x0000, 0x0fff) AM_ROM
123123ADDRESS_MAP_END
124124
125125static ADDRESS_MAP_START( gts1_data, AS_DATA, 8, gts1_state )
126    AM_RANGE(0x0000, 0x00ff) AM_RAM
127    AM_RANGE(0x0100, 0x01ff) AM_RAM AM_SHARE("nvram")
126   AM_RANGE(0x0000, 0x00ff) AM_RAM
127   AM_RANGE(0x0100, 0x01ff) AM_RAM AM_SHARE("nvram")
128128ADDRESS_MAP_END
129129
130130static ADDRESS_MAP_START( gts1_io, AS_IO, 8, gts1_state )
131    AM_RANGE(0x0020, 0x002f) AM_DEVREADWRITE ( "u4", ra17xx_device, io_r, io_w ) // (U4) solenoid
132    AM_RANGE(0x0030, 0x003f) AM_DEVREADWRITE ( "u3", r10696_device, io_r, io_w ) // (U3) solenoid + dips
133    AM_RANGE(0x0040, 0x004f) AM_DEVREADWRITE ( "u5", ra17xx_device, io_r, io_w ) // (U5) switch matrix
134    AM_RANGE(0x0060, 0x006f) AM_DEVREADWRITE ( "u2", r10696_device, io_r, io_w ) // (U2) NVRAM io chip
135    AM_RANGE(0x00d0, 0x00df) AM_DEVREADWRITE ( "u6", r10788_device, io_r, io_w ) // (U6) display chip
136    AM_RANGE(0x0000, 0x00ff) AM_READ ( gts1_io_r ) AM_WRITE( gts1_io_w )         // catch undecoded I/O accesss
137    AM_RANGE(0x0100, 0x0100) AM_READ ( gts1_pa_r ) AM_WRITE( gts1_pa_w )         // CPU I/O port A (input/output)
138    AM_RANGE(0x0101, 0x0101) AM_WRITE( gts1_pb_w )                               // CPU I/O port B (output only)
131   AM_RANGE(0x0020, 0x002f) AM_DEVREADWRITE ( "u4", ra17xx_device, io_r, io_w ) // (U4) solenoid
132   AM_RANGE(0x0030, 0x003f) AM_DEVREADWRITE ( "u3", r10696_device, io_r, io_w ) // (U3) solenoid + dips
133   AM_RANGE(0x0040, 0x004f) AM_DEVREADWRITE ( "u5", ra17xx_device, io_r, io_w ) // (U5) switch matrix
134   AM_RANGE(0x0060, 0x006f) AM_DEVREADWRITE ( "u2", r10696_device, io_r, io_w ) // (U2) NVRAM io chip
135   AM_RANGE(0x00d0, 0x00df) AM_DEVREADWRITE ( "u6", r10788_device, io_r, io_w ) // (U6) display chip
136   AM_RANGE(0x0000, 0x00ff) AM_READ ( gts1_io_r ) AM_WRITE( gts1_io_w )         // catch undecoded I/O accesss
137   AM_RANGE(0x0100, 0x0100) AM_READ ( gts1_pa_r ) AM_WRITE( gts1_pa_w )         // CPU I/O port A (input/output)
138   AM_RANGE(0x0101, 0x0101) AM_WRITE( gts1_pb_w )                               // CPU I/O port B (output only)
139139ADDRESS_MAP_END
140140
141141static INPUT_PORTS_START( gts1_dips )
142    PORT_START("DSW0")
143    PORT_DIPNAME( 0x01, 0x00, "S01")
144    PORT_DIPSETTING(    0x00, DEF_STR( Off ))
145    PORT_DIPSETTING(    0x01, DEF_STR( On ))
146    PORT_DIPNAME( 0x02, 0x00, "S02")
147    PORT_DIPSETTING(    0x00, DEF_STR( Off ))
148    PORT_DIPSETTING(    0x02, DEF_STR( On ))
149    PORT_DIPNAME( 0x04, 0x00, "S03")
150    PORT_DIPSETTING(    0x00, DEF_STR( Off ))
151    PORT_DIPSETTING(    0x04, DEF_STR( On ))
152    PORT_DIPNAME( 0x08, 0x00, "S04")
153    PORT_DIPSETTING(    0x00, DEF_STR( Off ))
154    PORT_DIPSETTING(    0x08, DEF_STR( On ))
155    PORT_DIPNAME( 0x10, 0x00, "S05")
156    PORT_DIPSETTING(    0x00, DEF_STR( Off ))
157    PORT_DIPSETTING(    0x10, DEF_STR( On ))
158    PORT_DIPNAME( 0x20, 0x20, "S06")
159    PORT_DIPSETTING(    0x00, DEF_STR( No ))
160    PORT_DIPSETTING(    0x20, DEF_STR( Yes ))
161    PORT_DIPNAME( 0x40, 0x40, "S07")
162    PORT_DIPSETTING(    0x00, DEF_STR( No ))
163    PORT_DIPSETTING(    0x40, DEF_STR( Yes ))
164    PORT_DIPNAME( 0x80, 0x80, "S08")
165    PORT_DIPSETTING(    0x00, DEF_STR( No ))
166    PORT_DIPSETTING(    0x80, DEF_STR( Yes ))
142   PORT_START("DSW0")
143   PORT_DIPNAME( 0x01, 0x00, "S01")
144   PORT_DIPSETTING(    0x00, DEF_STR( Off ))
145   PORT_DIPSETTING(    0x01, DEF_STR( On ))
146   PORT_DIPNAME( 0x02, 0x00, "S02")
147   PORT_DIPSETTING(    0x00, DEF_STR( Off ))
148   PORT_DIPSETTING(    0x02, DEF_STR( On ))
149   PORT_DIPNAME( 0x04, 0x00, "S03")
150   PORT_DIPSETTING(    0x00, DEF_STR( Off ))
151   PORT_DIPSETTING(    0x04, DEF_STR( On ))
152   PORT_DIPNAME( 0x08, 0x00, "S04")
153   PORT_DIPSETTING(    0x00, DEF_STR( Off ))
154   PORT_DIPSETTING(    0x08, DEF_STR( On ))
155   PORT_DIPNAME( 0x10, 0x00, "S05")
156   PORT_DIPSETTING(    0x00, DEF_STR( Off ))
157   PORT_DIPSETTING(    0x10, DEF_STR( On ))
158   PORT_DIPNAME( 0x20, 0x20, "S06")
159   PORT_DIPSETTING(    0x00, DEF_STR( No ))
160   PORT_DIPSETTING(    0x20, DEF_STR( Yes ))
161   PORT_DIPNAME( 0x40, 0x40, "S07")
162   PORT_DIPSETTING(    0x00, DEF_STR( No ))
163   PORT_DIPSETTING(    0x40, DEF_STR( Yes ))
164   PORT_DIPNAME( 0x80, 0x80, "S08")
165   PORT_DIPSETTING(    0x00, DEF_STR( No ))
166   PORT_DIPSETTING(    0x80, DEF_STR( Yes ))
167167
168    PORT_START("DSW1")
169    PORT_DIPNAME( 0x01, 0x00, "S09")
170    PORT_DIPSETTING(    0x00, DEF_STR( Off ))
171    PORT_DIPSETTING(    0x01, DEF_STR( On ))
172    PORT_DIPNAME( 0x02, 0x00, "S10")
173    PORT_DIPSETTING(    0x00, DEF_STR( Off ))
174    PORT_DIPSETTING(    0x02, DEF_STR( On ))
175    PORT_DIPNAME( 0x04, 0x00, "S11")
176    PORT_DIPSETTING(    0x00, DEF_STR( Off ))
177    PORT_DIPSETTING(    0x04, DEF_STR( On ))
178    PORT_DIPNAME( 0x08, 0x00, "S12")
179    PORT_DIPSETTING(    0x00, DEF_STR( Off ))
180    PORT_DIPSETTING(    0x08, DEF_STR( On ))
181    PORT_DIPNAME( 0x10, 0x00, "S13")
182    PORT_DIPSETTING(    0x00, DEF_STR( Off ))
183    PORT_DIPSETTING(    0x10, DEF_STR( On ))
184    PORT_DIPNAME( 0x20, 0x00, "S14")
185    PORT_DIPSETTING(    0x00, DEF_STR( Yes ))
186    PORT_DIPSETTING(    0x20, DEF_STR( No ))
187    PORT_DIPNAME( 0x40, 0x40, "S15")
188    PORT_DIPSETTING(    0x00, DEF_STR( No ))
189    PORT_DIPSETTING(    0x40, DEF_STR( Yes ))
190    PORT_DIPNAME( 0x80, 0x00, "S16")
191    PORT_DIPSETTING(    0x00, DEF_STR( No ))
192    PORT_DIPSETTING(    0x80, DEF_STR( Yes ))
168   PORT_START("DSW1")
169   PORT_DIPNAME( 0x01, 0x00, "S09")
170   PORT_DIPSETTING(    0x00, DEF_STR( Off ))
171   PORT_DIPSETTING(    0x01, DEF_STR( On ))
172   PORT_DIPNAME( 0x02, 0x00, "S10")
173   PORT_DIPSETTING(    0x00, DEF_STR( Off ))
174   PORT_DIPSETTING(    0x02, DEF_STR( On ))
175   PORT_DIPNAME( 0x04, 0x00, "S11")
176   PORT_DIPSETTING(    0x00, DEF_STR( Off ))
177   PORT_DIPSETTING(    0x04, DEF_STR( On ))
178   PORT_DIPNAME( 0x08, 0x00, "S12")
179   PORT_DIPSETTING(    0x00, DEF_STR( Off ))
180   PORT_DIPSETTING(    0x08, DEF_STR( On ))
181   PORT_DIPNAME( 0x10, 0x00, "S13")
182   PORT_DIPSETTING(    0x00, DEF_STR( Off ))
183   PORT_DIPSETTING(    0x10, DEF_STR( On ))
184   PORT_DIPNAME( 0x20, 0x00, "S14")
185   PORT_DIPSETTING(    0x00, DEF_STR( Yes ))
186   PORT_DIPSETTING(    0x20, DEF_STR( No ))
187   PORT_DIPNAME( 0x40, 0x40, "S15")
188   PORT_DIPSETTING(    0x00, DEF_STR( No ))
189   PORT_DIPSETTING(    0x40, DEF_STR( Yes ))
190   PORT_DIPNAME( 0x80, 0x00, "S16")
191   PORT_DIPSETTING(    0x00, DEF_STR( No ))
192   PORT_DIPSETTING(    0x80, DEF_STR( Yes ))
193193
194    PORT_START("DSW2")
195    PORT_DIPNAME( 0x01, 0x00, "S17")
196    PORT_DIPSETTING(    0x00, DEF_STR( Off ))
197    PORT_DIPSETTING(    0x01, DEF_STR( On ))
198    PORT_DIPNAME( 0x02, 0x00, "S18")
199    PORT_DIPSETTING(    0x00, DEF_STR( Off ))
200    PORT_DIPSETTING(    0x02, DEF_STR( On ))
201    PORT_DIPNAME( 0x04, 0x00, "S19")
202    PORT_DIPSETTING(    0x00, DEF_STR( Off ))
203    PORT_DIPSETTING(    0x04, DEF_STR( On ))
204    PORT_DIPNAME( 0x08, 0x00, "S20")
205    PORT_DIPSETTING(    0x00, DEF_STR( Off ))
206    PORT_DIPSETTING(    0x08, DEF_STR( On ))
207    PORT_DIPNAME( 0x10, 0x00, "S21")
208    PORT_DIPSETTING(    0x00, DEF_STR( Off ))
209    PORT_DIPSETTING(    0x10, DEF_STR( On ))
210    PORT_DIPNAME( 0x20, 0x00, "S22")
211    PORT_DIPSETTING(    0x00, DEF_STR( Off ))
212    PORT_DIPSETTING(    0x20, DEF_STR( On ))
213    PORT_DIPNAME( 0x40, 0x00, "S23")
214    PORT_DIPSETTING(    0x00, DEF_STR( Off ))
215    PORT_DIPSETTING(    0x40, DEF_STR( On ))
216    PORT_DIPNAME( 0x80, 0x00, "S24")
217    PORT_DIPSETTING(    0x00, DEF_STR( Off ))
218    PORT_DIPSETTING(    0x80, DEF_STR( On ))
194   PORT_START("DSW2")
195   PORT_DIPNAME( 0x01, 0x00, "S17")
196   PORT_DIPSETTING(    0x00, DEF_STR( Off ))
197   PORT_DIPSETTING(    0x01, DEF_STR( On ))
198   PORT_DIPNAME( 0x02, 0x00, "S18")
199   PORT_DIPSETTING(    0x00, DEF_STR( Off ))
200   PORT_DIPSETTING(    0x02, DEF_STR( On ))
201   PORT_DIPNAME( 0x04, 0x00, "S19")
202   PORT_DIPSETTING(    0x00, DEF_STR( Off ))
203   PORT_DIPSETTING(    0x04, DEF_STR( On ))
204   PORT_DIPNAME( 0x08, 0x00, "S20")
205   PORT_DIPSETTING(    0x00, DEF_STR( Off ))
206   PORT_DIPSETTING(    0x08, DEF_STR( On ))
207   PORT_DIPNAME( 0x10, 0x00, "S21")
208   PORT_DIPSETTING(    0x00, DEF_STR( Off ))
209   PORT_DIPSETTING(    0x10, DEF_STR( On ))
210   PORT_DIPNAME( 0x20, 0x00, "S22")
211   PORT_DIPSETTING(    0x00, DEF_STR( Off ))
212   PORT_DIPSETTING(    0x20, DEF_STR( On ))
213   PORT_DIPNAME( 0x40, 0x00, "S23")
214   PORT_DIPSETTING(    0x00, DEF_STR( Off ))
215   PORT_DIPSETTING(    0x40, DEF_STR( On ))
216   PORT_DIPNAME( 0x80, 0x00, "S24")
217   PORT_DIPSETTING(    0x00, DEF_STR( Off ))
218   PORT_DIPSETTING(    0x80, DEF_STR( On ))
219219INPUT_PORTS_END
220220
221221static INPUT_PORTS_START( gts1_switches )
222    PORT_START("X.0")
223    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER)
224    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER)
225    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER)
226    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER)
227    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER)
228    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER)
229    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER)
230    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER)
231    PORT_START("X.1")
232    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER)
233    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER)
234    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER)
235    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER)
236    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER)
237    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER)
238    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER)
239    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER)
240    PORT_START("X.2")
241    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER)
242    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER)
243    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER)
244    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER)
245    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER)
246    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER)
247    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER)
248    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER)
249    PORT_START("X.3")
250    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER)
251    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER)
252    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER)
253    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER)
254    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER)
255    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER)
256    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER)
257    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER)
258    PORT_START("X.4")
259    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER)
260    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER)
261    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER)
262    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER)
263    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER)
264    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER)
265    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER)
266    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER)
222   PORT_START("X.0")
223   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER)
224   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER)
225   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER)
226   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER)
227   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER)
228   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER)
229   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER)
230   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER)
231   PORT_START("X.1")
232   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER)
233   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER)
234   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER)
235   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER)
236   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER)
237   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER)
238   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER)
239   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER)
240   PORT_START("X.2")
241   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER)
242   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER)
243   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER)
244   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER)
245   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER)
246   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER)
247   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER)
248   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER)
249   PORT_START("X.3")
250   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER)
251   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER)
252   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER)
253   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER)
254   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER)
255   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER)
256   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER)
257   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER)
258   PORT_START("X.4")
259   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER)
260   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER)
261   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER)
262   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER)
263   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER)
264   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER)
265   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER)
266   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER)
267267INPUT_PORTS_END
268268
269269static INPUT_PORTS_START( gts1 )
270    PORT_INCLUDE( gts1_dips )
270   PORT_INCLUDE( gts1_dips )
271271
272    PORT_INCLUDE( gts1_switches )
272   PORT_INCLUDE( gts1_switches )
273273INPUT_PORTS_END
274274
275275static INPUT_PORTS_START( jokrpokr )
276    PORT_INCLUDE( gts1_dips )
276   PORT_INCLUDE( gts1_dips )
277277
278    PORT_START("X.0")
279    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PLAY/TEST")
280    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("POP/BUMBER")
281    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("EXTRA BALL TARGET")
282    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("SPECIAL ROLLOVER")
283    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("10 POINT CONTACTS")
284    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("\"A\" DROP TARGET (red)")
285    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER)
286    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER)
278   PORT_START("X.0")
279   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PLAY/TEST")
280   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("POP/BUMBER")
281   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("EXTRA BALL TARGET")
282   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("SPECIAL ROLLOVER")
283   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("10 POINT CONTACTS")
284   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("\"A\" DROP TARGET (red)")
285   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER)
286   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER)
287287
288    PORT_START("X.1")
289    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("#1 COIN CHUTE")
290    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("\"A\" ROLLOVER")
291    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("\"10\" DROP TARGET")
292    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("\"Q\" DROP TARGET (red)")
293    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("\"K\" DROP TARGET (black)")
294    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("\"A\" DROP TARGET (black)")
295    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER)
296    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER)
288   PORT_START("X.1")
289   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("#1 COIN CHUTE")
290   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("\"A\" ROLLOVER")
291   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("\"10\" DROP TARGET")
292   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("\"Q\" DROP TARGET (red)")
293   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("\"K\" DROP TARGET (black)")
294   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("\"A\" DROP TARGET (black)")
295   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER)
296   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER)
297297
298    PORT_START("X.2")
299    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("#2 COIN CHUTE")
300    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("\"B\" ROLLOVER")
301    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("\"J\" DROP TARGET (black)")
302    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("\"O\" DROP TARGET (black)")
303    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("\"K\" DROP TARGET")
304    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("JOKER DROP TARGET")
305    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER)
306    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER)
298   PORT_START("X.2")
299   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("#2 COIN CHUTE")
300   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("\"B\" ROLLOVER")
301   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("\"J\" DROP TARGET (black)")
302   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("\"O\" DROP TARGET (black)")
303   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("\"K\" DROP TARGET")
304   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("JOKER DROP TARGET")
305   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER)
306   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER)
307307
308    PORT_START("X.3")
309    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("REPLAY BUTTON")
310    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("\"C\" ROLLOVER")
311    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("\"J\" DROP TARGET (red)")
312    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("\"O\" DROP TARGET (red)")
313    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("\"K\" DROP TARGET")
314    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("\"A\" DROP TARGET (red)")
315    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER)
316    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER)
308   PORT_START("X.3")
309   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("REPLAY BUTTON")
310   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("\"C\" ROLLOVER")
311   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("\"J\" DROP TARGET (red)")
312   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("\"O\" DROP TARGET (red)")
313   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("\"K\" DROP TARGET")
314   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("\"A\" DROP TARGET (red)")
315   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER)
316   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER)
317317
318    PORT_START("X.4")
319    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("TILT PANEL")
320    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER)
321    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER)
322    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER)
323    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("\"K\" DROP TARGET")
324    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("\"A\" DROP TARGET (red)")
325    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER)
326    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER)
318   PORT_START("X.4")
319   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("TILT PANEL")
320   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER)
321   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER)
322   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER)
323   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("\"K\" DROP TARGET")
324   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("\"A\" DROP TARGET (red)")
325   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER)
326   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER)
327327INPUT_PORTS_END
328328
329329void gts1_state::machine_reset()
330330{
331    m_strobe = 0;
332    m_nvram_addr = 0;
333    m_nvram_e2 = false;
334    m_nvram_wr = false;
335    m_6351_addr = 0;
336    m_z30_out = 0;
331   m_strobe = 0;
332   m_nvram_addr = 0;
333   m_nvram_e2 = false;
334   m_nvram_wr = false;
335   m_6351_addr = 0;
336   m_z30_out = 0;
337337}
338338
339339DRIVER_INIT_MEMBER(gts1_state,gts1)
r242631r242632
342342
343343READ8_MEMBER (gts1_state::gts1_solenoid_r)
344344{
345    UINT8 data = 0;
346    LOG(("%s: solenoid[%02x] -> %x\n", __FUNCTION__, offset, data));
347    return data;
345   UINT8 data = 0;
346   LOG(("%s: solenoid[%02x] -> %x\n", __FUNCTION__, offset, data));
347   return data;
348348}
349349
350350WRITE8_MEMBER(gts1_state::gts1_solenoid_w)
351351{
352    switch (offset)
353    {
354    case  0:
355        LOG(("%s: outhole <- %x\n", __FUNCTION__, data));
356        break;
357    case  1:
358        LOG(("%s: knocker <- %x\n", __FUNCTION__, data));
359        break;
360    case  2:
361        LOG(("%s: tens chime <- %x\n", __FUNCTION__, data));
362        break;
363    case  3:
364        LOG(("%s: hundreds chime <- %x\n", __FUNCTION__, data));
365        break;
366    case  4:
367        LOG(("%s: thousands chime <- %x\n", __FUNCTION__, data));
368        break;
369    case  5:
370        LOG(("%s: no. 6 <- %x\n", __FUNCTION__, data));
371        break;
372    case  6:
373        LOG(("%s: no. 7 <- %x\n", __FUNCTION__, data));
374        break;
375    case  7:
376        LOG(("%s: no. 8 <- %x\n", __FUNCTION__, data));
377        break;
378    case  8: case  9: case 10: case 11:
379        LOG(("%s: not used [%x] <- %x\n", __FUNCTION__, offset, data));
380        break;
381    case 12:    // spare
382        LOG(("%s: spare [%x] <- %x\n", __FUNCTION__, offset, data));
383        break;
384    case 13:    // RAM control E2
385        LOG(("%s: RAM control E2 <- %x\n", __FUNCTION__, data));
386        m_nvram_e2 = (data & 1) ? true : false;
387        break;
388    case 14:    // RAM control W/R
389        LOG(("%s: RAM control W/R <- %x\n", __FUNCTION__, data));
390        break;
391        m_nvram_wr = (data & 1) ? true : false;
392    case 15:    // spare
393        LOG(("%s: spare [%x] <- %x\n", __FUNCTION__, offset, data));
394        break;
395    }
352   switch (offset)
353   {
354   case  0:
355      LOG(("%s: outhole <- %x\n", __FUNCTION__, data));
356      break;
357   case  1:
358      LOG(("%s: knocker <- %x\n", __FUNCTION__, data));
359      break;
360   case  2:
361      LOG(("%s: tens chime <- %x\n", __FUNCTION__, data));
362      break;
363   case  3:
364      LOG(("%s: hundreds chime <- %x\n", __FUNCTION__, data));
365      break;
366   case  4:
367      LOG(("%s: thousands chime <- %x\n", __FUNCTION__, data));
368      break;
369   case  5:
370      LOG(("%s: no. 6 <- %x\n", __FUNCTION__, data));
371      break;
372   case  6:
373      LOG(("%s: no. 7 <- %x\n", __FUNCTION__, data));
374      break;
375   case  7:
376      LOG(("%s: no. 8 <- %x\n", __FUNCTION__, data));
377      break;
378   case  8: case  9: case 10: case 11:
379      LOG(("%s: not used [%x] <- %x\n", __FUNCTION__, offset, data));
380      break;
381   case 12:    // spare
382      LOG(("%s: spare [%x] <- %x\n", __FUNCTION__, offset, data));
383      break;
384   case 13:    // RAM control E2
385      LOG(("%s: RAM control E2 <- %x\n", __FUNCTION__, data));
386      m_nvram_e2 = (data & 1) ? true : false;
387      break;
388   case 14:    // RAM control W/R
389      LOG(("%s: RAM control W/R <- %x\n", __FUNCTION__, data));
390      break;
391      m_nvram_wr = (data & 1) ? true : false;
392   case 15:    // spare
393      LOG(("%s: spare [%x] <- %x\n", __FUNCTION__, offset, data));
394      break;
395   }
396396}
397397
398398READ8_MEMBER (gts1_state::gts1_switches_r)
399399{
400    UINT8 data = 1;
401    if (offset >= 8 && offset < 16) {
402        const int bit = offset - 8;
403        for (int i = 0; i < 5; i++) {
404            if (m_strobe & (1 << i)) {
405                data &= BIT(m_switches[i]->read(), bit);
406            }
407        }
408    }
409    LOG(("%s: switches[%x,%x] -> %x\n", __FUNCTION__, m_strobe, offset, data));
410    return data;
400   UINT8 data = 1;
401   if (offset >= 8 && offset < 16) {
402      const int bit = offset - 8;
403      for (int i = 0; i < 5; i++) {
404         if (m_strobe & (1 << i)) {
405            data &= BIT(m_switches[i]->read(), bit);
406         }
407      }
408   }
409   LOG(("%s: switches[%x,%x] -> %x\n", __FUNCTION__, m_strobe, offset, data));
410   return data;
411411}
412412
413413WRITE8_MEMBER(gts1_state::gts1_switches_w)
414414{
415    LOG(("%s: switches[%x] <- %x\n", __FUNCTION__, offset, data));
416    if (offset < 5) {
417        // outputs O-0 to O-4 are the 5 strobe lines
418        m_strobe = (m_strobe & ~(1 << offset)) | ((data & 1) << offset);
419    }
415   LOG(("%s: switches[%x] <- %x\n", __FUNCTION__, offset, data));
416   if (offset < 5) {
417      // outputs O-0 to O-4 are the 5 strobe lines
418      m_strobe = (m_strobe & ~(1 << offset)) | ((data & 1) << offset);
419   }
420420}
421421
422422/**
r242631r242632
426426 */
427427WRITE8_MEMBER(gts1_state::gts1_display_w)
428428{
429    /*
430     * The 7448 is modified to be disabled through RI/RBO
431     * when the input is 0001, and in this case the extra
432     * output H is generated instead.
433     */
429   /*
430    * The 7448 is modified to be disabled through RI/RBO
431    * when the input is 0001, and in this case the extra
432    * output H is generated instead.
433    */
434434#define _a (1 << 0)
435435#define _b (1 << 1)
436436#define _c (1 << 2)
r242631r242632
439439#define _f (1 << 5)
440440#define _g (1 << 6)
441441#define _h (1 << 7)
442    static const UINT8 ttl7448_mod[16] = {
443    /* 0 */  _a | _b | _c | _d | _e | _f,
444    /* 1 */  _h,
445    /* 2 */  _a | _b | _d | _e | _g,
446    /* 3 */  _a | _b | _c | _d | _g,
447    /* 4 */  _b | _c | _f | _g,
448    /* 5 */  _a | _c | _d | _f | _g,
449    /* 6 */  _a | _c | _d | _e | _f | _g,
450    /* 7 */  _a | _b | _c,
451    /* 8 */  _a | _b | _c | _d | _e | _f | _g,
452    /* 9 */  _a | _b | _c | _d | _f | _g,
453    /* a */  _d | _e | _g,
454    /* b */  _c | _d | _g,
455    /* c */  _b | _f | _g,
456    /* d */  _a | _d | _f | _g,
457    /* e */  _d | _e | _f | _g,
458    /* f */  0
459    };
460    UINT8 a = ttl7448_mod[(data >> 0) & 15];
461    UINT8 b = ttl7448_mod[(data >> 4) & 15];
462    // LOG(("%s: offset:%d data:%02x a:%02x b:%02x\n", __FUNCTION__, offset, data, a, b));
463    if ((offset % 8) < 7) {
464        output_set_indexed_value("digit8_", offset, a);
465        output_set_indexed_value("digit8_", offset + 16, b);
466    } else {
467        /*
468         * For the 4 7-seg displays the segment h is turned back into
469         * segments b and c to display the 7-seg "1".
470         */
471        if (a & _h)
472            a = _b | _c;
473        if (b & _h)
474            b = _b | _c;
475        output_set_indexed_value("digit7_", offset, a);
476        // FIXME: there is nothing on outputs 22, 23, 30 and 31?
477        output_set_indexed_value("digit7_", offset + 16, b);
478    }
442   static const UINT8 ttl7448_mod[16] = {
443   /* 0 */  _a | _b | _c | _d | _e | _f,
444   /* 1 */  _h,
445   /* 2 */  _a | _b | _d | _e | _g,
446   /* 3 */  _a | _b | _c | _d | _g,
447   /* 4 */  _b | _c | _f | _g,
448   /* 5 */  _a | _c | _d | _f | _g,
449   /* 6 */  _a | _c | _d | _e | _f | _g,
450   /* 7 */  _a | _b | _c,
451   /* 8 */  _a | _b | _c | _d | _e | _f | _g,
452   /* 9 */  _a | _b | _c | _d | _f | _g,
453   /* a */  _d | _e | _g,
454   /* b */  _c | _d | _g,
455   /* c */  _b | _f | _g,
456   /* d */  _a | _d | _f | _g,
457   /* e */  _d | _e | _f | _g,
458   /* f */  0
459   };
460   UINT8 a = ttl7448_mod[(data >> 0) & 15];
461   UINT8 b = ttl7448_mod[(data >> 4) & 15];
462   // LOG(("%s: offset:%d data:%02x a:%02x b:%02x\n", __FUNCTION__, offset, data, a, b));
463   if ((offset % 8) < 7) {
464      output_set_indexed_value("digit8_", offset, a);
465      output_set_indexed_value("digit8_", offset + 16, b);
466   } else {
467      /*
468       * For the 4 7-seg displays the segment h is turned back into
469       * segments b and c to display the 7-seg "1".
470       */
471      if (a & _h)
472         a = _b | _c;
473      if (b & _h)
474         b = _b | _c;
475      output_set_indexed_value("digit7_", offset, a);
476      // FIXME: there is nothing on outputs 22, 23, 30 and 31?
477      output_set_indexed_value("digit7_", offset + 16, b);
478   }
479479#undef _a
480480#undef _b
481481#undef _c
r242631r242632
493493 */
494494READ8_MEMBER (gts1_state::gts1_nvram_r)
495495{
496    UINT8 data = 0x0f;
497    switch (offset)
498    {
499        case 0: // group A
500            // FIXME: Schematics says TO Z5
501            if (!m_nvram_wr && m_nvram_e2) {
502                UINT8* nvram = memregion("nvram")->base();
503                assert(nvram != NULL);
504                data = nvram[m_nvram_addr];
505                LOG(("%s: nvram[%02x] -> %x\n", __FUNCTION__, m_nvram_addr, data));
506            }
507            break;
508        case 1: // group B
509        case 2: // group C
510            // Schematics says: SPARES
511            break;
512    }
513    return data;
496   UINT8 data = 0x0f;
497   switch (offset)
498   {
499      case 0: // group A
500         // FIXME: Schematics says TO Z5
501         if (!m_nvram_wr && m_nvram_e2) {
502            UINT8* nvram = memregion("nvram")->base();
503            assert(nvram != NULL);
504            data = nvram[m_nvram_addr];
505            LOG(("%s: nvram[%02x] -> %x\n", __FUNCTION__, m_nvram_addr, data));
506         }
507         break;
508      case 1: // group B
509      case 2: // group C
510         // Schematics says: SPARES
511         break;
512   }
513   return data;
514514}
515515
516516/**
r242631r242632
520520 */
521521WRITE8_MEMBER(gts1_state::gts1_nvram_w)
522522{
523    switch (offset)
524    {
525        case 0: // group A - address lines 3:0
526            m_nvram_addr = (m_nvram_addr & ~15) | (data & 15);
527            break;
528        case 1: // group B - address lines 7:4
529            m_nvram_addr = (m_nvram_addr & ~(15 << 4)) | ((data & 15) << 4);
530            break;
531        case 2: // group C - data bits 3:0 of NVRAM
532            if (m_nvram_wr && m_nvram_e2) {
533                LOG(("%s: nvram[%02x] <- %x\n", __FUNCTION__, m_nvram_addr, data & 15));
534                UINT8* nvram = memregion("nvram")->base();
535                assert(nvram != NULL);
536                nvram[m_nvram_addr] = data & 15;
537            }
538            break;
539    }
523   switch (offset)
524   {
525      case 0: // group A - address lines 3:0
526         m_nvram_addr = (m_nvram_addr & ~15) | (data & 15);
527         break;
528      case 1: // group B - address lines 7:4
529         m_nvram_addr = (m_nvram_addr & ~(15 << 4)) | ((data & 15) << 4);
530         break;
531      case 2: // group C - data bits 3:0 of NVRAM
532         if (m_nvram_wr && m_nvram_e2) {
533            LOG(("%s: nvram[%02x] <- %x\n", __FUNCTION__, m_nvram_addr, data & 15));
534            UINT8* nvram = memregion("nvram")->base();
535            assert(nvram != NULL);
536            nvram[m_nvram_addr] = data & 15;
537         }
538         break;
539   }
540540}
541541
542542/**
r242631r242632
546546 */
547547READ8_MEMBER (gts1_state::gts1_lamp_apm_r)
548548{
549    UINT8 data = 0x0f;
550    switch (offset) {
551        case 0: // group A switches S01-S04, S09-S12, S17-S20
552            if (m_z30_out & 1) {
553                UINT8 dsw0 = ioport("DSW0")->read();
554                if (0 == BIT(dsw0,0)) // S01
555                    data &= ~(1 << 3);
556                if (0 == BIT(dsw0,1)) // S02
557                    data &= ~(1 << 2);
558                if (0 == BIT(dsw0,2)) // S03
559                    data &= ~(1 << 1);
560                if (0 == BIT(dsw0,3)) // S04
561                    data &= ~(1 << 0);
562            }
563            if (m_z30_out & 2) {
564                UINT8 dsw1 = ioport("DSW1")->read();
565                if (0 == BIT(dsw1,0)) // S09
566                    data &= ~(1 << 0);
567                if (0 == BIT(dsw1,1)) // S10
568                    data &= ~(1 << 1);
569                if (0 == BIT(dsw1,2)) // S11
570                    data &= ~(1 << 2);
571                if (0 == BIT(dsw1,3)) // S12
572                    data &= ~(1 << 3);
573            }
574            if (m_z30_out & 4) {
575                UINT8 dsw2 = ioport("DSW2")->read();
576                if (0 == BIT(dsw2,0)) // S17
577                    data &= ~(1 << 0);
578                if (0 == BIT(dsw2,1)) // S18
579                    data &= ~(1 << 1);
580                if (0 == BIT(dsw2,2)) // S19
581                    data &= ~(1 << 2);
582                if (0 == BIT(dsw2,3)) // S20
583                    data &= ~(1 << 3);
584            }
585            break;
586        case 1: // group B switches S05-S08, S09-S12, S17-S20
587            if (m_z30_out & 1) {
588                UINT8 dsw0 = ioport("DSW0")->read();
589                if (0 == BIT(dsw0,4)) // S05
590                    data &= ~(1 << 3);
591                if (0 == BIT(dsw0,5)) // S06
592                    data &= ~(1 << 2);
593                if (0 == BIT(dsw0,6)) // S07
594                    data &= ~(1 << 1);
595                if (0 == BIT(dsw0,7)) // S08
596                    data &= ~(1 << 0);
597            }
598            if (m_z30_out & 2) {
599                UINT8 dsw1 = ioport("DSW1")->read();
600                if (0 == BIT(dsw1,4)) // S13
601                    data &= ~(1 << 0);
602                if (0 == BIT(dsw1,5)) // S14
603                    data &= ~(1 << 1);
604                if (0 == BIT(dsw1,6)) // S15
605                    data &= ~(1 << 2);
606                if (0 == BIT(dsw1,7)) // S16
607                    data &= ~(1 << 3);
608            }
609            if (m_z30_out & 4) {
610                UINT8 dsw2 = ioport("DSW2")->read();
611                if (0 == BIT(dsw2,4)) // S21
612                    data &= ~(1 << 0);
613                if (0 == BIT(dsw2,5)) // S22
614                    data &= ~(1 << 1);
615                if (0 == BIT(dsw2,6)) // S23
616                    data &= ~(1 << 2);
617                if (0 == BIT(dsw2,7)) // S24
618                    data &= ~(1 << 3);
619            }
620            break;
621        case 2: // TODO: connect
622            // IN-9 (unused?)
623            // IN-10 (reset sw25)
624            // IN-11 (outhole sw)
625            // IN-12 (slam sw)
626            break;
627    }
628    return data;
549   UINT8 data = 0x0f;
550   switch (offset) {
551      case 0: // group A switches S01-S04, S09-S12, S17-S20
552         if (m_z30_out & 1) {
553            UINT8 dsw0 = ioport("DSW0")->read();
554            if (0 == BIT(dsw0,0)) // S01
555               data &= ~(1 << 3);
556            if (0 == BIT(dsw0,1)) // S02
557               data &= ~(1 << 2);
558            if (0 == BIT(dsw0,2)) // S03
559               data &= ~(1 << 1);
560            if (0 == BIT(dsw0,3)) // S04
561               data &= ~(1 << 0);
562         }
563         if (m_z30_out & 2) {
564            UINT8 dsw1 = ioport("DSW1")->read();
565            if (0 == BIT(dsw1,0)) // S09
566               data &= ~(1 << 0);
567            if (0 == BIT(dsw1,1)) // S10
568               data &= ~(1 << 1);
569            if (0 == BIT(dsw1,2)) // S11
570               data &= ~(1 << 2);
571            if (0 == BIT(dsw1,3)) // S12
572               data &= ~(1 << 3);
573         }
574         if (m_z30_out & 4) {
575            UINT8 dsw2 = ioport("DSW2")->read();
576            if (0 == BIT(dsw2,0)) // S17
577               data &= ~(1 << 0);
578            if (0 == BIT(dsw2,1)) // S18
579               data &= ~(1 << 1);
580            if (0 == BIT(dsw2,2)) // S19
581               data &= ~(1 << 2);
582            if (0 == BIT(dsw2,3)) // S20
583               data &= ~(1 << 3);
584         }
585         break;
586      case 1: // group B switches S05-S08, S09-S12, S17-S20
587         if (m_z30_out & 1) {
588            UINT8 dsw0 = ioport("DSW0")->read();
589            if (0 == BIT(dsw0,4)) // S05
590               data &= ~(1 << 3);
591            if (0 == BIT(dsw0,5)) // S06
592               data &= ~(1 << 2);
593            if (0 == BIT(dsw0,6)) // S07
594               data &= ~(1 << 1);
595            if (0 == BIT(dsw0,7)) // S08
596               data &= ~(1 << 0);
597         }
598         if (m_z30_out & 2) {
599            UINT8 dsw1 = ioport("DSW1")->read();
600            if (0 == BIT(dsw1,4)) // S13
601               data &= ~(1 << 0);
602            if (0 == BIT(dsw1,5)) // S14
603               data &= ~(1 << 1);
604            if (0 == BIT(dsw1,6)) // S15
605               data &= ~(1 << 2);
606            if (0 == BIT(dsw1,7)) // S16
607               data &= ~(1 << 3);
608         }
609         if (m_z30_out & 4) {
610            UINT8 dsw2 = ioport("DSW2")->read();
611            if (0 == BIT(dsw2,4)) // S21
612               data &= ~(1 << 0);
613            if (0 == BIT(dsw2,5)) // S22
614               data &= ~(1 << 1);
615            if (0 == BIT(dsw2,6)) // S23
616               data &= ~(1 << 2);
617            if (0 == BIT(dsw2,7)) // S24
618               data &= ~(1 << 3);
619         }
620         break;
621      case 2: // TODO: connect
622         // IN-9 (unused?)
623         // IN-10 (reset sw25)
624         // IN-11 (outhole sw)
625         // IN-12 (slam sw)
626         break;
627   }
628   return data;
629629}
630630
631631/**
r242631r242632
635635 */
636636WRITE8_MEMBER(gts1_state::gts1_lamp_apm_w)
637637{
638    switch (offset) {
639        case 0: // LD1-LD4 on jumper J5
640            break;
641        case 1: // Z30 1-of-16 decoder
642            m_z30_out = 1 << (data & 15);
643            break;
644        case 2: // O9: PGOL PROM A8, O10: PGOL PROM A9
645            m_6351_addr = (m_6351_addr & ~(3 << 8)) | ((data & 3) << 8);
646            // O11 and O12 are unused(?)
647            break;
648    }
638   switch (offset) {
639      case 0: // LD1-LD4 on jumper J5
640         break;
641      case 1: // Z30 1-of-16 decoder
642         m_z30_out = 1 << (data & 15);
643         break;
644      case 2: // O9: PGOL PROM A8, O10: PGOL PROM A9
645         m_6351_addr = (m_6351_addr & ~(3 << 8)) | ((data & 3) << 8);
646         // O11 and O12 are unused(?)
647         break;
648   }
649649}
650650
651651READ8_MEMBER (gts1_state::gts1_io_r)
652652{
653    const UINT8 data = 0x0f;
654    LOG(("%s: unmapped io[%02x] -> %x\n", __FUNCTION__, offset, data));
655    return data;
653   const UINT8 data = 0x0f;
654   LOG(("%s: unmapped io[%02x] -> %x\n", __FUNCTION__, offset, data));
655   return data;
656656}
657657
658658WRITE8_MEMBER(gts1_state::gts1_io_w)
659659{
660    LOG(("%s: unmapped io[%02x] <- %x\n", __FUNCTION__, offset, data));
660   LOG(("%s: unmapped io[%02x] <- %x\n", __FUNCTION__, offset, data));
661661}
662662
663663READ8_MEMBER (gts1_state::gts1_pa_r)
664664{
665    // return ROM nibble
666    UINT8 *ROM = memregion("maincpu")->base();
667    UINT8 data = ROM[0x2000 + m_6351_addr] & 0x0f;
668    LOG(("%s: ROM[%03x]:%02x\n", __FUNCTION__, m_6351_addr, data));
669    return data;
665   // return ROM nibble
666   UINT8 *ROM = memregion("maincpu")->base();
667   UINT8 data = ROM[0x2000 + m_6351_addr] & 0x0f;
668   LOG(("%s: ROM[%03x]:%02x\n", __FUNCTION__, m_6351_addr, data));
669   return data;
670670}
671671
672672WRITE8_MEMBER(gts1_state::gts1_pa_w)
673673{
674    // write address lines 7-4
675    m_6351_addr = (m_6351_addr & 0x0f) | ((data & 0x0f) << 4);
676    LOG(("%s: ROM hi:%x addr:%02x\n", __FUNCTION__, data & 0x0f, m_6351_addr));
674   // write address lines 7-4
675   m_6351_addr = (m_6351_addr & 0x0f) | ((data & 0x0f) << 4);
676   LOG(("%s: ROM hi:%x addr:%02x\n", __FUNCTION__, data & 0x0f, m_6351_addr));
677677}
678678
679679WRITE8_MEMBER(gts1_state::gts1_pb_w)
680680{
681    // write address lines 3-0
682    m_6351_addr = (m_6351_addr & 0xf0) | (data & 0x0f);
683    LOG(("%s: ROM lo:%x addr:%02x\n", __FUNCTION__, data & 0x0f, m_6351_addr));
681   // write address lines 3-0
682   m_6351_addr = (m_6351_addr & 0xf0) | (data & 0x0f);
683   LOG(("%s: ROM lo:%x addr:%02x\n", __FUNCTION__, data & 0x0f, m_6351_addr));
684684}
685685
686686
687687static MACHINE_CONFIG_START( gts1, gts1_state )
688    /* basic machine hardware */
689    MCFG_CPU_ADD("maincpu", PPS4, XTAL_3_579545MHz / 18)  // divided in the CPU
690    MCFG_CPU_PROGRAM_MAP(gts1_map)
691    MCFG_CPU_DATA_MAP(gts1_data)
692    MCFG_CPU_IO_MAP(gts1_io)
688   /* basic machine hardware */
689   MCFG_CPU_ADD("maincpu", PPS4, XTAL_3_579545MHz / 18)  // divided in the CPU
690   MCFG_CPU_PROGRAM_MAP(gts1_map)
691   MCFG_CPU_DATA_MAP(gts1_data)
692   MCFG_CPU_IO_MAP(gts1_io)
693693
694    MCFG_NVRAM_ADD_0FILL("nvram")
694   MCFG_NVRAM_ADD_0FILL("nvram")
695695
696    /* A1753CE 2048 x 8 ROM (000-7ff), 128 x 4 RAM (00-7f) and 16 I/O lines (20 ... 2f) */
697    MCFG_DEVICE_ADD( "u5", RA17XX, 0 )
698    MCFG_RA17XX_READ ( READ8 (gts1_state,gts1_switches_r) )
699    MCFG_RA17XX_WRITE( WRITE8(gts1_state,gts1_switches_w) )
696   /* A1753CE 2048 x 8 ROM (000-7ff), 128 x 4 RAM (00-7f) and 16 I/O lines (20 ... 2f) */
697   MCFG_DEVICE_ADD( "u5", RA17XX, 0 )
698   MCFG_RA17XX_READ ( READ8 (gts1_state,gts1_switches_r) )
699   MCFG_RA17XX_WRITE( WRITE8(gts1_state,gts1_switches_w) )
700700
701    /* A1752CF 2048 x 8 ROM (800-fff), 128 x 4 RAM (80-ff) and 16 I/O lines (40 ... 4f) */
702    MCFG_DEVICE_ADD( "u4", RA17XX, 0 )
703    MCFG_RA17XX_READ ( READ8 (gts1_state,gts1_solenoid_r) )
704    MCFG_RA17XX_WRITE( WRITE8(gts1_state,gts1_solenoid_w) )
701   /* A1752CF 2048 x 8 ROM (800-fff), 128 x 4 RAM (80-ff) and 16 I/O lines (40 ... 4f) */
702   MCFG_DEVICE_ADD( "u4", RA17XX, 0 )
703   MCFG_RA17XX_READ ( READ8 (gts1_state,gts1_solenoid_r) )
704   MCFG_RA17XX_WRITE( WRITE8(gts1_state,gts1_solenoid_w) )
705705
706    /* 10696 General Purpose Input/Output */
707    MCFG_DEVICE_ADD( "u2", R10696, 0 )
708    MCFG_R10696_IO( READ8 (gts1_state,gts1_nvram_r),
709                    WRITE8(gts1_state,gts1_nvram_w) )
706   /* 10696 General Purpose Input/Output */
707   MCFG_DEVICE_ADD( "u2", R10696, 0 )
708   MCFG_R10696_IO( READ8 (gts1_state,gts1_nvram_r),
709               WRITE8(gts1_state,gts1_nvram_w) )
710710
711    /* 10696 General Purpose Input/Output */
712    MCFG_DEVICE_ADD( "u3", R10696, 0 )
713    MCFG_R10696_IO( READ8 (gts1_state,gts1_lamp_apm_r),
714                    WRITE8(gts1_state,gts1_lamp_apm_w) )
711   /* 10696 General Purpose Input/Output */
712   MCFG_DEVICE_ADD( "u3", R10696, 0 )
713   MCFG_R10696_IO( READ8 (gts1_state,gts1_lamp_apm_r),
714               WRITE8(gts1_state,gts1_lamp_apm_w) )
715715
716    /* 10788 General Purpose Display and Keyboard */
717    MCFG_DEVICE_ADD( "u6", R10788, XTAL_3_579545MHz / 18 )  // divided in the circuit
718    MCFG_R10788_UPDATE( WRITE8(gts1_state,gts1_display_w) )
716   /* 10788 General Purpose Display and Keyboard */
717   MCFG_DEVICE_ADD( "u6", R10788, XTAL_3_579545MHz / 18 )  // divided in the circuit
718   MCFG_R10788_UPDATE( WRITE8(gts1_state,gts1_display_w) )
719719
720    /* Video */
721    MCFG_DEFAULT_LAYOUT( layout_gts1 )
720   /* Video */
721   MCFG_DEFAULT_LAYOUT( layout_gts1 )
722722
723    /* Sound */
724    MCFG_FRAGMENT_ADD( genpin_audio )
723   /* Sound */
724   MCFG_FRAGMENT_ADD( genpin_audio )
725725MACHINE_CONFIG_END
726726
727727
728728ROM_START( gts1 )
729    ROM_REGION( 0x10000, "maincpu", 0 )
730    ROM_LOAD("u5_cf.bin", 0x0000, 0x0800, CRC(e0d4b405) SHA1(17aadd79c0dcbb336aadd5d203bc6ca866492345))
731    ROM_LOAD("u4_ce.bin", 0x0800, 0x0800, CRC(4cd312dd) SHA1(31245daa9972ef8652caee69986585bb8239e86e))
729   ROM_REGION( 0x10000, "maincpu", 0 )
730   ROM_LOAD("u5_cf.bin", 0x0000, 0x0800, CRC(e0d4b405) SHA1(17aadd79c0dcbb336aadd5d203bc6ca866492345))
731   ROM_LOAD("u4_ce.bin", 0x0800, 0x0800, CRC(4cd312dd) SHA1(31245daa9972ef8652caee69986585bb8239e86e))
732732ROM_END
733733
734734ROM_START( gts1s )
735    ROM_REGION( 0x10000, "maincpu", 0 )
736    ROM_LOAD("u5_cf.bin", 0x0000, 0x0800, CRC(e0d4b405) SHA1(17aadd79c0dcbb336aadd5d203bc6ca866492345))
737    ROM_LOAD("u4_ce.bin", 0x0800, 0x0800, CRC(4cd312dd) SHA1(31245daa9972ef8652caee69986585bb8239e86e))
735   ROM_REGION( 0x10000, "maincpu", 0 )
736   ROM_LOAD("u5_cf.bin", 0x0000, 0x0800, CRC(e0d4b405) SHA1(17aadd79c0dcbb336aadd5d203bc6ca866492345))
737   ROM_LOAD("u4_ce.bin", 0x0800, 0x0800, CRC(4cd312dd) SHA1(31245daa9972ef8652caee69986585bb8239e86e))
738738ROM_END
739739
740740/*-------------------------------------------------------------------
741741/ Asteroid Annie and the Aliens (12/1980) #442
742742/-------------------------------------------------------------------*/
743743ROM_START(astannie)
744    ROM_REGION(0x10000, "maincpu", 0)
745    ROM_LOAD("u5_cf.bin", 0x0000, 0x0800, CRC(e0d4b405) SHA1(17aadd79c0dcbb336aadd5d203bc6ca866492345))
746    ROM_LOAD("u4_ce.bin", 0x0800, 0x0800, CRC(4cd312dd) SHA1(31245daa9972ef8652caee69986585bb8239e86e))
747    ROM_LOAD("442.cpu", 0x2000, 0x0400, CRC(579521e0) SHA1(b1b19473e1ca3373955ee96104b87f586c4c311c))
748    ROM_REGION(0x10000, "cpu2", 0)
749    ROM_LOAD("442.snd", 0x0400, 0x0400, CRC(c70195b4) SHA1(ff06197f07111d6a4b8942dcfe8d2279bda6f281))
750    ROM_RELOAD( 0x0800, 0x0400)
751    ROM_LOAD("6530sys1.bin", 0x0c00, 0x0400, CRC(b7831321) SHA1(c94f4bee97854d0373653a6867016e27d3fc1340))
752    ROM_RELOAD( 0xfc00, 0x0400)
744   ROM_REGION(0x10000, "maincpu", 0)
745   ROM_LOAD("u5_cf.bin", 0x0000, 0x0800, CRC(e0d4b405) SHA1(17aadd79c0dcbb336aadd5d203bc6ca866492345))
746   ROM_LOAD("u4_ce.bin", 0x0800, 0x0800, CRC(4cd312dd) SHA1(31245daa9972ef8652caee69986585bb8239e86e))
747   ROM_LOAD("442.cpu", 0x2000, 0x0400, CRC(579521e0) SHA1(b1b19473e1ca3373955ee96104b87f586c4c311c))
748   ROM_REGION(0x10000, "cpu2", 0)
749   ROM_LOAD("442.snd", 0x0400, 0x0400, CRC(c70195b4) SHA1(ff06197f07111d6a4b8942dcfe8d2279bda6f281))
750   ROM_RELOAD( 0x0800, 0x0400)
751   ROM_LOAD("6530sys1.bin", 0x0c00, 0x0400, CRC(b7831321) SHA1(c94f4bee97854d0373653a6867016e27d3fc1340))
752   ROM_RELOAD( 0xfc00, 0x0400)
753753ROM_END
754754
755755/*-------------------------------------------------------------------
756756/ Buck Rogers (01/1980) #437
757757/-------------------------------------------------------------------*/
758758ROM_START(buckrgrs)
759    ROM_REGION(0x10000, "maincpu", 0)
760    ROM_LOAD("u5_cf.bin", 0x0000, 0x0800, CRC(e0d4b405) SHA1(17aadd79c0dcbb336aadd5d203bc6ca866492345))
761    ROM_LOAD("u4_ce.bin", 0x0800, 0x0800, CRC(4cd312dd) SHA1(31245daa9972ef8652caee69986585bb8239e86e))
762    ROM_LOAD("437.cpu", 0x2000, 0x0400, CRC(e57d9278) SHA1(dfc4ebff1e14b9a074468671a8e5ac7948d5b352))
763    ROM_REGION(0x10000, "cpu2", 0)
764    ROM_LOAD("437.snd", 0x0400, 0x0400, CRC(732b5a27) SHA1(7860ea54e75152246c3ac3205122d750b243b40c))
765    ROM_RELOAD( 0x0800, 0x0400)
766    ROM_LOAD("6530sys1.bin", 0x0c00, 0x0400, CRC(b7831321) SHA1(c94f4bee97854d0373653a6867016e27d3fc1340))
767    ROM_RELOAD( 0xfc00, 0x0400)
759   ROM_REGION(0x10000, "maincpu", 0)
760   ROM_LOAD("u5_cf.bin", 0x0000, 0x0800, CRC(e0d4b405) SHA1(17aadd79c0dcbb336aadd5d203bc6ca866492345))
761   ROM_LOAD("u4_ce.bin", 0x0800, 0x0800, CRC(4cd312dd) SHA1(31245daa9972ef8652caee69986585bb8239e86e))
762   ROM_LOAD("437.cpu", 0x2000, 0x0400, CRC(e57d9278) SHA1(dfc4ebff1e14b9a074468671a8e5ac7948d5b352))
763   ROM_REGION(0x10000, "cpu2", 0)
764   ROM_LOAD("437.snd", 0x0400, 0x0400, CRC(732b5a27) SHA1(7860ea54e75152246c3ac3205122d750b243b40c))
765   ROM_RELOAD( 0x0800, 0x0400)
766   ROM_LOAD("6530sys1.bin", 0x0c00, 0x0400, CRC(b7831321) SHA1(c94f4bee97854d0373653a6867016e27d3fc1340))
767   ROM_RELOAD( 0xfc00, 0x0400)
768768ROM_END
769769
770770/*-------------------------------------------------------------------
771771/ Charlie's Angels (11/1978) #425
772772/-------------------------------------------------------------------*/
773773ROM_START(charlies)
774    ROM_REGION(0x10000, "maincpu", 0)
775    ROM_LOAD("u5_cf.bin", 0x0000, 0x0800, CRC(e0d4b405) SHA1(17aadd79c0dcbb336aadd5d203bc6ca866492345))
776    ROM_LOAD("u4_ce.bin", 0x0800, 0x0800, CRC(4cd312dd) SHA1(31245daa9972ef8652caee69986585bb8239e86e))
777    ROM_LOAD("425.cpu", 0x2000, 0x0400, CRC(928b4279) SHA1(51096d45e880d6a8263eaeaa0cdab0f61ad2f58d))
774   ROM_REGION(0x10000, "maincpu", 0)
775   ROM_LOAD("u5_cf.bin", 0x0000, 0x0800, CRC(e0d4b405) SHA1(17aadd79c0dcbb336aadd5d203bc6ca866492345))
776   ROM_LOAD("u4_ce.bin", 0x0800, 0x0800, CRC(4cd312dd) SHA1(31245daa9972ef8652caee69986585bb8239e86e))
777   ROM_LOAD("425.cpu", 0x2000, 0x0400, CRC(928b4279) SHA1(51096d45e880d6a8263eaeaa0cdab0f61ad2f58d))
778778ROM_END
779779/*-------------------------------------------------------------------
780780/ Cleopatra (11/1977) #409
781781/-------------------------------------------------------------------*/
782782ROM_START(cleoptra)
783    ROM_REGION(0x10000, "maincpu", 0)
784    ROM_LOAD("u5_cf.bin", 0x0000, 0x0800, CRC(e0d4b405) SHA1(17aadd79c0dcbb336aadd5d203bc6ca866492345))
785    ROM_LOAD("u4_ce.bin", 0x0800, 0x0800, CRC(4cd312dd) SHA1(31245daa9972ef8652caee69986585bb8239e86e))
786    ROM_LOAD("409.cpu", 0x2000, 0x0400, CRC(8063ff71) SHA1(205f09f067bf79544d2ce2a48d23259901f935dd))
783   ROM_REGION(0x10000, "maincpu", 0)
784   ROM_LOAD("u5_cf.bin", 0x0000, 0x0800, CRC(e0d4b405) SHA1(17aadd79c0dcbb336aadd5d203bc6ca866492345))
785   ROM_LOAD("u4_ce.bin", 0x0800, 0x0800, CRC(4cd312dd) SHA1(31245daa9972ef8652caee69986585bb8239e86e))
786   ROM_LOAD("409.cpu", 0x2000, 0x0400, CRC(8063ff71) SHA1(205f09f067bf79544d2ce2a48d23259901f935dd))
787787ROM_END
788788
789789/*-------------------------------------------------------------------
790790/ Close Encounters of the Third Kind (10/1978) #424
791791/-------------------------------------------------------------------*/
792792ROM_START(closeenc)
793    ROM_REGION(0x10000, "maincpu", 0)
794    ROM_LOAD("u5_cf.bin", 0x0000, 0x0800, CRC(e0d4b405) SHA1(17aadd79c0dcbb336aadd5d203bc6ca866492345))
795    ROM_LOAD("u4_ce.bin", 0x0800, 0x0800, CRC(4cd312dd) SHA1(31245daa9972ef8652caee69986585bb8239e86e))
796    ROM_LOAD("424.cpu", 0x2000, 0x0400, CRC(a7a5dd13) SHA1(223c67b9484baa719c91de52b363ff22813db160))
793   ROM_REGION(0x10000, "maincpu", 0)
794   ROM_LOAD("u5_cf.bin", 0x0000, 0x0800, CRC(e0d4b405) SHA1(17aadd79c0dcbb336aadd5d203bc6ca866492345))
795   ROM_LOAD("u4_ce.bin", 0x0800, 0x0800, CRC(4cd312dd) SHA1(31245daa9972ef8652caee69986585bb8239e86e))
796   ROM_LOAD("424.cpu", 0x2000, 0x0400, CRC(a7a5dd13) SHA1(223c67b9484baa719c91de52b363ff22813db160))
797797ROM_END
798798
799799/*-------------------------------------------------------------------
800800/ Count-Down (05/1979) #422
801801/-------------------------------------------------------------------*/
802802ROM_START(countdwn)
803    ROM_REGION(0x10000, "maincpu", 0)
804    ROM_LOAD("u5_cf.bin", 0x0000, 0x0800, CRC(e0d4b405) SHA1(17aadd79c0dcbb336aadd5d203bc6ca866492345))
805    ROM_LOAD("u4_ce.bin", 0x0800, 0x0800, CRC(4cd312dd) SHA1(31245daa9972ef8652caee69986585bb8239e86e))
806    ROM_LOAD("422.cpu", 0x2000, 0x0400, CRC(51bc2df0) SHA1(d4b555d106c6b4e420b0fcd1df8871f869476c22))
803   ROM_REGION(0x10000, "maincpu", 0)
804   ROM_LOAD("u5_cf.bin", 0x0000, 0x0800, CRC(e0d4b405) SHA1(17aadd79c0dcbb336aadd5d203bc6ca866492345))
805   ROM_LOAD("u4_ce.bin", 0x0800, 0x0800, CRC(4cd312dd) SHA1(31245daa9972ef8652caee69986585bb8239e86e))
806   ROM_LOAD("422.cpu", 0x2000, 0x0400, CRC(51bc2df0) SHA1(d4b555d106c6b4e420b0fcd1df8871f869476c22))
807807ROM_END
808808
809809/*-------------------------------------------------------------------
810810/ Dragon (10/1978) #419
811811/-------------------------------------------------------------------*/
812812ROM_START(dragon)
813    ROM_REGION(0x10000, "maincpu", 0)
814    ROM_LOAD("u5_cf.bin", 0x0000, 0x0800, CRC(e0d4b405) SHA1(17aadd79c0dcbb336aadd5d203bc6ca866492345))
815    ROM_LOAD("u4_ce.bin", 0x0800, 0x0800, CRC(4cd312dd) SHA1(31245daa9972ef8652caee69986585bb8239e86e))
816    ROM_LOAD("419.cpu", 0x2000, 0x0400, CRC(018d9b3a) SHA1(da37ef5017c71bc41bdb1f30d3fd7ac3b7e1ee7e))
813   ROM_REGION(0x10000, "maincpu", 0)
814   ROM_LOAD("u5_cf.bin", 0x0000, 0x0800, CRC(e0d4b405) SHA1(17aadd79c0dcbb336aadd5d203bc6ca866492345))
815   ROM_LOAD("u4_ce.bin", 0x0800, 0x0800, CRC(4cd312dd) SHA1(31245daa9972ef8652caee69986585bb8239e86e))
816   ROM_LOAD("419.cpu", 0x2000, 0x0400, CRC(018d9b3a) SHA1(da37ef5017c71bc41bdb1f30d3fd7ac3b7e1ee7e))
817817ROM_END
818818
819819/*-------------------------------------------------------------------
820820/ Genie (11/1979) #435
821821/-------------------------------------------------------------------*/
822822ROM_START(geniep)
823    ROM_REGION(0x10000, "maincpu", 0)
824    ROM_LOAD("u5_cf.bin", 0x0000, 0x0800, CRC(e0d4b405) SHA1(17aadd79c0dcbb336aadd5d203bc6ca866492345))
825    ROM_LOAD("u4_ce.bin", 0x0800, 0x0800, CRC(4cd312dd) SHA1(31245daa9972ef8652caee69986585bb8239e86e))
826    ROM_LOAD("435.cpu", 0x2000, 0x0400, CRC(7749fd92) SHA1(9cd3e799842392e3939877bf295759c27f199e58))
827    ROM_REGION(0x10000, "cpu2", 0)
828    ROM_LOAD("435.snd", 0x0400, 0x0400, CRC(4a98ceed) SHA1(f1d7548e03107033c39953ee04b043b5301dbb47))
829    ROM_RELOAD( 0x0800, 0x0400)
830    ROM_LOAD("6530sys1.bin", 0x0c00, 0x0400, CRC(b7831321) SHA1(c94f4bee97854d0373653a6867016e27d3fc1340))
831    ROM_RELOAD( 0xfc00, 0x0400)
823   ROM_REGION(0x10000, "maincpu", 0)
824   ROM_LOAD("u5_cf.bin", 0x0000, 0x0800, CRC(e0d4b405) SHA1(17aadd79c0dcbb336aadd5d203bc6ca866492345))
825   ROM_LOAD("u4_ce.bin", 0x0800, 0x0800, CRC(4cd312dd) SHA1(31245daa9972ef8652caee69986585bb8239e86e))
826   ROM_LOAD("435.cpu", 0x2000, 0x0400, CRC(7749fd92) SHA1(9cd3e799842392e3939877bf295759c27f199e58))
827   ROM_REGION(0x10000, "cpu2", 0)
828   ROM_LOAD("435.snd", 0x0400, 0x0400, CRC(4a98ceed) SHA1(f1d7548e03107033c39953ee04b043b5301dbb47))
829   ROM_RELOAD( 0x0800, 0x0400)
830   ROM_LOAD("6530sys1.bin", 0x0c00, 0x0400, CRC(b7831321) SHA1(c94f4bee97854d0373653a6867016e27d3fc1340))
831   ROM_RELOAD( 0xfc00, 0x0400)
832832ROM_END
833833
834834/*-------------------------------------------------------------------
835835/ Joker Poker (08/1978) #417
836836/-------------------------------------------------------------------*/
837837ROM_START(jokrpokr)
838    ROM_REGION(0x10000, "maincpu", 0)
839    ROM_LOAD("u5_cf.bin", 0x0000, 0x0800, CRC(e0d4b405) SHA1(17aadd79c0dcbb336aadd5d203bc6ca866492345))
840    ROM_LOAD("u4_ce.bin", 0x0800, 0x0800, CRC(4cd312dd) SHA1(31245daa9972ef8652caee69986585bb8239e86e))
841    ROM_LOAD("417.cpu", 0x2000, 0x0400, CRC(33dade08) SHA1(23b8dbd7b6c84b806fc0d2da95478235cbf9f80a))
838   ROM_REGION(0x10000, "maincpu", 0)
839   ROM_LOAD("u5_cf.bin", 0x0000, 0x0800, CRC(e0d4b405) SHA1(17aadd79c0dcbb336aadd5d203bc6ca866492345))
840   ROM_LOAD("u4_ce.bin", 0x0800, 0x0800, CRC(4cd312dd) SHA1(31245daa9972ef8652caee69986585bb8239e86e))
841   ROM_LOAD("417.cpu", 0x2000, 0x0400, CRC(33dade08) SHA1(23b8dbd7b6c84b806fc0d2da95478235cbf9f80a))
842842ROM_END
843843
844844/*-------------------------------------------------------------------
r242631r242632
848848/ L'Hexagone (04/1986)
849849/-------------------------------------------------------------------*/
850850ROM_START(hexagone)
851    ROM_REGION(0x10000, "maincpu", 0)
852    ROM_LOAD("u5_cf.bin", 0x0000, 0x0800, CRC(e0d4b405) SHA1(17aadd79c0dcbb336aadd5d203bc6ca866492345))
853    ROM_LOAD("u4_ce.bin", 0x0800, 0x0800, CRC(4cd312dd) SHA1(31245daa9972ef8652caee69986585bb8239e86e))
854    ROM_LOAD("435.cpu", 0x2000, 0x0400, CRC(7749fd92) SHA1(9cd3e799842392e3939877bf295759c27f199e58))
855    ROM_REGION(0x10000, "cpu2", 0)
856    ROM_LOAD("hexagone.bin", 0, 0x4000, CRC(002b5464) SHA1(e2d971c4e85b4fb6580c2d3945c9946ea0cebc2e))
851   ROM_REGION(0x10000, "maincpu", 0)
852   ROM_LOAD("u5_cf.bin", 0x0000, 0x0800, CRC(e0d4b405) SHA1(17aadd79c0dcbb336aadd5d203bc6ca866492345))
853   ROM_LOAD("u4_ce.bin", 0x0800, 0x0800, CRC(4cd312dd) SHA1(31245daa9972ef8652caee69986585bb8239e86e))
854   ROM_LOAD("435.cpu", 0x2000, 0x0400, CRC(7749fd92) SHA1(9cd3e799842392e3939877bf295759c27f199e58))
855   ROM_REGION(0x10000, "cpu2", 0)
856   ROM_LOAD("hexagone.bin", 0, 0x4000, CRC(002b5464) SHA1(e2d971c4e85b4fb6580c2d3945c9946ea0cebc2e))
857857ROM_END
858858/*-------------------------------------------------------------------
859859/ Movie
r242631r242632
863863/ Pinball Pool (08/1979) #427
864864/-------------------------------------------------------------------*/
865865ROM_START(pinpool)
866    ROM_REGION(0x10000, "maincpu", 0)
867    ROM_LOAD("u5_cf.bin", 0x0000, 0x0800, CRC(e0d4b405) SHA1(17aadd79c0dcbb336aadd5d203bc6ca866492345))
868    ROM_LOAD("u4_ce.bin", 0x0800, 0x0800, CRC(4cd312dd) SHA1(31245daa9972ef8652caee69986585bb8239e86e))
869    ROM_LOAD("427.cpu", 0x2000, 0x0400, CRC(c496393d) SHA1(e91d9596aacdb4277fa200a3f8f9da099c278f32))
866   ROM_REGION(0x10000, "maincpu", 0)
867   ROM_LOAD("u5_cf.bin", 0x0000, 0x0800, CRC(e0d4b405) SHA1(17aadd79c0dcbb336aadd5d203bc6ca866492345))
868   ROM_LOAD("u4_ce.bin", 0x0800, 0x0800, CRC(4cd312dd) SHA1(31245daa9972ef8652caee69986585bb8239e86e))
869   ROM_LOAD("427.cpu", 0x2000, 0x0400, CRC(c496393d) SHA1(e91d9596aacdb4277fa200a3f8f9da099c278f32))
870870ROM_END
871871
872872/*-------------------------------------------------------------------
873873/ Roller Disco (02/1980) #440
874874/-------------------------------------------------------------------*/
875875ROM_START(roldisco)
876    ROM_REGION(0x10000, "maincpu", 0)
877    ROM_LOAD("u5_cf.bin", 0x0000, 0x0800, CRC(e0d4b405) SHA1(17aadd79c0dcbb336aadd5d203bc6ca866492345))
878    ROM_LOAD("u4_ce.bin", 0x0800, 0x0800, CRC(4cd312dd) SHA1(31245daa9972ef8652caee69986585bb8239e86e))
879    ROM_LOAD("440.cpu", 0x2000, 0x0400, CRC(bc50631f) SHA1(6aa3124d09fc4e369d087a5ad6dd1737ace55e41))
880    ROM_REGION(0x10000, "cpu2", 0)
881    ROM_LOAD("440.snd", 0x0400, 0x0400, CRC(4a0a05ae) SHA1(88f21b5638494d8e78dc0b6b7d69873b76b5f75d))
882    ROM_RELOAD( 0x0800, 0x0400)
883    ROM_LOAD("6530sys1.bin", 0x0c00, 0x0400, CRC(b7831321) SHA1(c94f4bee97854d0373653a6867016e27d3fc1340))
884    ROM_RELOAD( 0xfc00, 0x0400)
876   ROM_REGION(0x10000, "maincpu", 0)
877   ROM_LOAD("u5_cf.bin", 0x0000, 0x0800, CRC(e0d4b405) SHA1(17aadd79c0dcbb336aadd5d203bc6ca866492345))
878   ROM_LOAD("u4_ce.bin", 0x0800, 0x0800, CRC(4cd312dd) SHA1(31245daa9972ef8652caee69986585bb8239e86e))
879   ROM_LOAD("440.cpu", 0x2000, 0x0400, CRC(bc50631f) SHA1(6aa3124d09fc4e369d087a5ad6dd1737ace55e41))
880   ROM_REGION(0x10000, "cpu2", 0)
881   ROM_LOAD("440.snd", 0x0400, 0x0400, CRC(4a0a05ae) SHA1(88f21b5638494d8e78dc0b6b7d69873b76b5f75d))
882   ROM_RELOAD( 0x0800, 0x0400)
883   ROM_LOAD("6530sys1.bin", 0x0c00, 0x0400, CRC(b7831321) SHA1(c94f4bee97854d0373653a6867016e27d3fc1340))
884   ROM_RELOAD( 0xfc00, 0x0400)
885885ROM_END
886886
887887/*-------------------------------------------------------------------
r242631r242632
892892/ Sinbad (05/1978) #412
893893/-------------------------------------------------------------------*/
894894ROM_START(sinbad)
895    ROM_REGION(0x10000, "maincpu", 0)
896    ROM_LOAD("u5_cf.bin", 0x0000, 0x0800, CRC(e0d4b405) SHA1(17aadd79c0dcbb336aadd5d203bc6ca866492345))
897    ROM_LOAD("u4_ce.bin", 0x0800, 0x0800, CRC(4cd312dd) SHA1(31245daa9972ef8652caee69986585bb8239e86e))
898    ROM_LOAD("412.cpu", 0x2000, 0x0400, CRC(84a86b83) SHA1(f331f2ffd7d1b279b4ffbb939aa8649e723f5fac))
895   ROM_REGION(0x10000, "maincpu", 0)
896   ROM_LOAD("u5_cf.bin", 0x0000, 0x0800, CRC(e0d4b405) SHA1(17aadd79c0dcbb336aadd5d203bc6ca866492345))
897   ROM_LOAD("u4_ce.bin", 0x0800, 0x0800, CRC(4cd312dd) SHA1(31245daa9972ef8652caee69986585bb8239e86e))
898   ROM_LOAD("412.cpu", 0x2000, 0x0400, CRC(84a86b83) SHA1(f331f2ffd7d1b279b4ffbb939aa8649e723f5fac))
899899ROM_END
900900
901901ROM_START(sinbadn)
902    ROM_REGION(0x10000, "maincpu", 0)
903    ROM_LOAD("u5_cf.bin", 0x0000, 0x0800, CRC(e0d4b405) SHA1(17aadd79c0dcbb336aadd5d203bc6ca866492345))
904    ROM_LOAD("u4_ce.bin", 0x0800, 0x0800, CRC(4cd312dd) SHA1(31245daa9972ef8652caee69986585bb8239e86e))
905    ROM_LOAD("412no1.cpu", 0x2000, 0x0400, CRC(f5373f5f) SHA1(027840501416ff01b2adf07188c7d667adf3ad5f))
902   ROM_REGION(0x10000, "maincpu", 0)
903   ROM_LOAD("u5_cf.bin", 0x0000, 0x0800, CRC(e0d4b405) SHA1(17aadd79c0dcbb336aadd5d203bc6ca866492345))
904   ROM_LOAD("u4_ce.bin", 0x0800, 0x0800, CRC(4cd312dd) SHA1(31245daa9972ef8652caee69986585bb8239e86e))
905   ROM_LOAD("412no1.cpu", 0x2000, 0x0400, CRC(f5373f5f) SHA1(027840501416ff01b2adf07188c7d667adf3ad5f))
906906ROM_END
907907
908908/*-------------------------------------------------------------------
r242631r242632
913913/ Solar Ride (02/1979) #421
914914/-------------------------------------------------------------------*/
915915ROM_START(solaride)
916    ROM_REGION(0x10000, "maincpu", 0)
917    ROM_LOAD("u5_cf.bin", 0x0000, 0x0800, CRC(e0d4b405) SHA1(17aadd79c0dcbb336aadd5d203bc6ca866492345))
918    ROM_LOAD("u4_ce.bin", 0x0800, 0x0800, CRC(4cd312dd) SHA1(31245daa9972ef8652caee69986585bb8239e86e))
919    ROM_LOAD("421.cpu", 0x2000, 0x0400, CRC(6b5c5da6) SHA1(a09b7009473be53586f53f48b7bfed9a0c5ecd55))
916   ROM_REGION(0x10000, "maincpu", 0)
917   ROM_LOAD("u5_cf.bin", 0x0000, 0x0800, CRC(e0d4b405) SHA1(17aadd79c0dcbb336aadd5d203bc6ca866492345))
918   ROM_LOAD("u4_ce.bin", 0x0800, 0x0800, CRC(4cd312dd) SHA1(31245daa9972ef8652caee69986585bb8239e86e))
919   ROM_LOAD("421.cpu", 0x2000, 0x0400, CRC(6b5c5da6) SHA1(a09b7009473be53586f53f48b7bfed9a0c5ecd55))
920920ROM_END
921921
922922/*-------------------------------------------------------------------
923923/ The Incredible Hulk (10/1979) #433
924924/-------------------------------------------------------------------*/
925925ROM_START(hulk)
926    ROM_REGION(0x10000, "maincpu", 0)
927    ROM_LOAD("u5_cf.bin", 0x0000, 0x0800, CRC(e0d4b405) SHA1(17aadd79c0dcbb336aadd5d203bc6ca866492345))
928    ROM_LOAD("u4_ce.bin", 0x0800, 0x0800, CRC(4cd312dd) SHA1(31245daa9972ef8652caee69986585bb8239e86e))
929    ROM_LOAD("433.cpu", 0x2000, 0x0400, CRC(c05d2b52) SHA1(393fe063b029246317c90ee384db95a84d61dbb7))
930    ROM_REGION(0x10000, "cpu2", 0)
931    ROM_LOAD("433.snd", 0x0400, 0x0400, CRC(20cd1dff) SHA1(93e7c47ff7051c3c0dc9f8f95aa33ba094e7cf25))
932    ROM_RELOAD( 0x0800, 0x0400)
933    ROM_LOAD("6530sys1.bin", 0x0c00, 0x0400, CRC(b7831321) SHA1(c94f4bee97854d0373653a6867016e27d3fc1340))
934    ROM_RELOAD( 0xfc00, 0x0400)
926   ROM_REGION(0x10000, "maincpu", 0)
927   ROM_LOAD("u5_cf.bin", 0x0000, 0x0800, CRC(e0d4b405) SHA1(17aadd79c0dcbb336aadd5d203bc6ca866492345))
928   ROM_LOAD("u4_ce.bin", 0x0800, 0x0800, CRC(4cd312dd) SHA1(31245daa9972ef8652caee69986585bb8239e86e))
929   ROM_LOAD("433.cpu", 0x2000, 0x0400, CRC(c05d2b52) SHA1(393fe063b029246317c90ee384db95a84d61dbb7))
930   ROM_REGION(0x10000, "cpu2", 0)
931   ROM_LOAD("433.snd", 0x0400, 0x0400, CRC(20cd1dff) SHA1(93e7c47ff7051c3c0dc9f8f95aa33ba094e7cf25))
932   ROM_RELOAD( 0x0800, 0x0400)
933   ROM_LOAD("6530sys1.bin", 0x0c00, 0x0400, CRC(b7831321) SHA1(c94f4bee97854d0373653a6867016e27d3fc1340))
934   ROM_RELOAD( 0xfc00, 0x0400)
935935ROM_END
936936
937937/*-------------------------------------------------------------------
938938/ Torch (02/1980) #438
939939/-------------------------------------------------------------------*/
940940ROM_START(torch)
941    ROM_REGION(0x10000, "maincpu", 0)
942    ROM_LOAD("u5_cf.bin", 0x0000, 0x0800, CRC(e0d4b405) SHA1(17aadd79c0dcbb336aadd5d203bc6ca866492345))
943    ROM_LOAD("u4_ce.bin", 0x0800, 0x0800, CRC(4cd312dd) SHA1(31245daa9972ef8652caee69986585bb8239e86e))
944    ROM_LOAD("438.cpu", 0x2000, 0x0400, CRC(2d396a64) SHA1(38a1862771500faa471071db08dfbadc6e8759e8))
945    ROM_REGION(0x10000, "cpu2", 0)
946    ROM_LOAD("438.snd", 0x0400, 0x0400, CRC(a9619b48) SHA1(1906bc1b059bf31082e3b4546f5a30159479ad3c))
947    ROM_RELOAD( 0x0800, 0x0400)
948    ROM_LOAD("6530sys1.bin", 0x0c00, 0x0400, CRC(b7831321) SHA1(c94f4bee97854d0373653a6867016e27d3fc1340))
949    ROM_RELOAD( 0xfc00, 0x0400)
941   ROM_REGION(0x10000, "maincpu", 0)
942   ROM_LOAD("u5_cf.bin", 0x0000, 0x0800, CRC(e0d4b405) SHA1(17aadd79c0dcbb336aadd5d203bc6ca866492345))
943   ROM_LOAD("u4_ce.bin", 0x0800, 0x0800, CRC(4cd312dd) SHA1(31245daa9972ef8652caee69986585bb8239e86e))
944   ROM_LOAD("438.cpu", 0x2000, 0x0400, CRC(2d396a64) SHA1(38a1862771500faa471071db08dfbadc6e8759e8))
945   ROM_REGION(0x10000, "cpu2", 0)
946   ROM_LOAD("438.snd", 0x0400, 0x0400, CRC(a9619b48) SHA1(1906bc1b059bf31082e3b4546f5a30159479ad3c))
947   ROM_RELOAD( 0x0800, 0x0400)
948   ROM_LOAD("6530sys1.bin", 0x0c00, 0x0400, CRC(b7831321) SHA1(c94f4bee97854d0373653a6867016e27d3fc1340))
949   ROM_RELOAD( 0xfc00, 0x0400)
950950ROM_END
951951
952952/*-------------------------------------------------------------------
953953/ Totem (10/1979) #429
954954/-------------------------------------------------------------------*/
955955ROM_START(totem)
956    ROM_REGION(0x10000, "maincpu", 0)
957    ROM_LOAD("u5_cf.bin", 0x0000, 0x0800, CRC(e0d4b405) SHA1(17aadd79c0dcbb336aadd5d203bc6ca866492345))
958    ROM_LOAD("u4_ce.bin", 0x0800, 0x0800, CRC(4cd312dd) SHA1(31245daa9972ef8652caee69986585bb8239e86e))
959    ROM_LOAD("429.cpu", 0x2000, 0x0400, CRC(7885a384) SHA1(1770662af7d48ad8297097a9877c5c497119978d))
960    ROM_REGION(0x10000, "cpu2", 0)
961    ROM_LOAD("429.snd", 0x0400, 0x0400, CRC(5d1b7ed4) SHA1(4a584f880e907fb21da78f3b3a0617f20599688f))
962    ROM_RELOAD( 0x0800, 0x0400)
963    ROM_LOAD("6530sys1.bin", 0x0c00, 0x0400, CRC(b7831321) SHA1(c94f4bee97854d0373653a6867016e27d3fc1340))
964    ROM_RELOAD( 0xfc00, 0x0400)
956   ROM_REGION(0x10000, "maincpu", 0)
957   ROM_LOAD("u5_cf.bin", 0x0000, 0x0800, CRC(e0d4b405) SHA1(17aadd79c0dcbb336aadd5d203bc6ca866492345))
958   ROM_LOAD("u4_ce.bin", 0x0800, 0x0800, CRC(4cd312dd) SHA1(31245daa9972ef8652caee69986585bb8239e86e))
959   ROM_LOAD("429.cpu", 0x2000, 0x0400, CRC(7885a384) SHA1(1770662af7d48ad8297097a9877c5c497119978d))
960   ROM_REGION(0x10000, "cpu2", 0)
961   ROM_LOAD("429.snd", 0x0400, 0x0400, CRC(5d1b7ed4) SHA1(4a584f880e907fb21da78f3b3a0617f20599688f))
962   ROM_RELOAD( 0x0800, 0x0400)
963   ROM_LOAD("6530sys1.bin", 0x0c00, 0x0400, CRC(b7831321) SHA1(c94f4bee97854d0373653a6867016e27d3fc1340))
964   ROM_RELOAD( 0xfc00, 0x0400)
965965ROM_END
966966
967967/*-------------------------------------------------------------------
968968/ System 1 Test prom
969969/-------------------------------------------------------------------*/
970970ROM_START(sys1test)
971    ROM_REGION(0x10000, "maincpu", 0)
972    ROM_LOAD("u5_cf.bin", 0x0000, 0x0800, CRC(e0d4b405) SHA1(17aadd79c0dcbb336aadd5d203bc6ca866492345))
973    ROM_LOAD("u4_ce.bin", 0x0800, 0x0800, CRC(4cd312dd) SHA1(31245daa9972ef8652caee69986585bb8239e86e))
974    ROM_LOAD("test.cpu", 0x2000, 0x0400, CRC(8b0704bb) SHA1(5f0eb8d5af867b815b6012c9d078927398efe6d8))
971   ROM_REGION(0x10000, "maincpu", 0)
972   ROM_LOAD("u5_cf.bin", 0x0000, 0x0800, CRC(e0d4b405) SHA1(17aadd79c0dcbb336aadd5d203bc6ca866492345))
973   ROM_LOAD("u4_ce.bin", 0x0800, 0x0800, CRC(4cd312dd) SHA1(31245daa9972ef8652caee69986585bb8239e86e))
974   ROM_LOAD("test.cpu", 0x2000, 0x0400, CRC(8b0704bb) SHA1(5f0eb8d5af867b815b6012c9d078927398efe6d8))
975975ROM_END
976976
977977
trunk/src/mame/drivers/gundealr.c
r242631r242632
495495
496496static MACHINE_CONFIG_DERIVED( yamyam, gundealr )
497497
498   MCFG_TIMER_DRIVER_ADD_PERIODIC("mcusim", gundealr_state, yamyam_mcu_sim, attotime::from_hz(6000000/60))   /* 6mhz confirmed */
498   MCFG_TIMER_DRIVER_ADD_PERIODIC("mcusim", gundealr_state, yamyam_mcu_sim, attotime::from_hz(6000000/60)) /* 6mhz confirmed */
499499MACHINE_CONFIG_END
500500
501501
trunk/src/mame/drivers/igs009.c
r242631r242632
510510
511511static INPUT_PORTS_START( jingbell )
512512   PORT_START("DSW1")
513   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) )   PORT_DIPLOCATION("DSW1:1")
513   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) )  PORT_DIPLOCATION("DSW1:1")
514514   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
515515   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
516   PORT_DIPNAME( 0x02, 0x00, "W-Up Bonus" )      PORT_DIPLOCATION("DSW1:2")
516   PORT_DIPNAME( 0x02, 0x00, "W-Up Bonus" )        PORT_DIPLOCATION("DSW1:2")
517517   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
518518   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
519   PORT_DIPNAME( 0x04, 0x04, "Min Bet" )         PORT_DIPLOCATION("DSW1:3")
519   PORT_DIPNAME( 0x04, 0x04, "Min Bet" )           PORT_DIPLOCATION("DSW1:3")
520520   PORT_DIPSETTING(    0x04, "1" )
521521   PORT_DIPSETTING(    0x00, "8" )
522   PORT_DIPNAME( 0x08, 0x08, "Spin Speed" )      PORT_DIPLOCATION("DSW1:4")
522   PORT_DIPNAME( 0x08, 0x08, "Spin Speed" )        PORT_DIPLOCATION("DSW1:4")
523523   PORT_DIPSETTING(    0x08, "Slow" )
524524   PORT_DIPSETTING(    0x00, "Quick" )
525   PORT_DIPNAME( 0x10, 0x00, "Strip Girl" )      PORT_DIPLOCATION("DSW1:5")
525   PORT_DIPNAME( 0x10, 0x00, "Strip Girl" )        PORT_DIPLOCATION("DSW1:5")
526526   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
527527   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
528   PORT_DIPNAME( 0x20, 0x20, "Payout Mode" )      PORT_DIPLOCATION("DSW1:6")
528   PORT_DIPNAME( 0x20, 0x20, "Payout Mode" )       PORT_DIPLOCATION("DSW1:6")
529529   PORT_DIPSETTING(    0x20, DEF_STR( Normal ) )
530530   PORT_DIPSETTING(    0x00, "Auto" )
531   PORT_DIPNAME( 0xc0, 0xc0, "Player's Panel" )   PORT_DIPLOCATION("DSW1:7,8")
531   PORT_DIPNAME( 0xc0, 0xc0, "Player's Panel" )    PORT_DIPLOCATION("DSW1:7,8")
532532   PORT_DIPSETTING(    0x00, "Type A" )
533533   PORT_DIPSETTING(    0xc0, "Type A" )
534534   PORT_DIPSETTING(    0x80, "Type B" )
535535   PORT_DIPSETTING(    0x40, "Type C" )
536536
537537   PORT_START("DSW2")
538   PORT_DIPNAME( 0x07, 0x07, "Main Game Rate (%)" )   PORT_DIPLOCATION("DSW2:1,2,3")
538   PORT_DIPNAME( 0x07, 0x07, "Main Game Rate (%)" )    PORT_DIPLOCATION("DSW2:1,2,3")
539539   PORT_DIPSETTING(    0x07, "55" )
540540   PORT_DIPSETTING(    0x06, "60" )
541541   PORT_DIPSETTING(    0x05, "65" )
r242631r242632
544544   PORT_DIPSETTING(    0x02, "80" )
545545   PORT_DIPSETTING(    0x01, "85" )
546546   PORT_DIPSETTING(    0x00, "90" )
547   PORT_DIPNAME( 0x38, 0x38, "W-Up Chance (%)" )   PORT_DIPLOCATION("DSW2:4,5,6")
547   PORT_DIPNAME( 0x38, 0x38, "W-Up Chance (%)" )   PORT_DIPLOCATION("DSW2:4,5,6")
548548   PORT_DIPSETTING(    0x38, "93" )
549549   PORT_DIPSETTING(    0x30, "94" )
550550   PORT_DIPSETTING(    0x28, "95" )
r242631r242632
553553   PORT_DIPSETTING(    0x10, "98" )
554554   PORT_DIPSETTING(    0x08, "99" )
555555   PORT_DIPSETTING(    0x00, "100" )
556   PORT_DIPNAME( 0xc0, 0xc0, "Key In Limit" )      PORT_DIPLOCATION("DSW2:7,8")
556   PORT_DIPNAME( 0xc0, 0xc0, "Key In Limit" )      PORT_DIPLOCATION("DSW2:7,8")
557557   PORT_DIPSETTING(    0xc0, "1k" )
558558   PORT_DIPSETTING(    0x80, "3k" )
559559   PORT_DIPSETTING(    0x40, "5k" )
560560   PORT_DIPSETTING(    0x00, "10k" )
561561
562562   PORT_START("DSW3")
563   PORT_DIPNAME( 0x07, 0x07, "Key In Rate" )      PORT_DIPLOCATION("DSW3:1,2,3")
563   PORT_DIPNAME( 0x07, 0x07, "Key In Rate" )       PORT_DIPLOCATION("DSW3:1,2,3")
564564   PORT_DIPSETTING(    0x07, "1" )
565565   PORT_DIPSETTING(    0x06, "5" )
566566   PORT_DIPSETTING(    0x05, "10" )
r242631r242632
569569   PORT_DIPSETTING(    0x02, "100" )
570570   PORT_DIPSETTING(    0x01, "200" )
571571   PORT_DIPSETTING(    0x00, "500" )
572   PORT_DIPNAME( 0x38, 0x38, "Coin 1 Rate" )      PORT_DIPLOCATION("DSW3:4,5,6")
572   PORT_DIPNAME( 0x38, 0x38, "Coin 1 Rate" )       PORT_DIPLOCATION("DSW3:4,5,6")
573573   PORT_DIPSETTING(    0x38, "1" )
574574   PORT_DIPSETTING(    0x30, "2" )
575575   PORT_DIPSETTING(    0x28, "5" )
r242631r242632
578578   PORT_DIPSETTING(    0x10, "25" )
579579   PORT_DIPSETTING(    0x08, "50" )
580580   PORT_DIPSETTING(    0x00, "100" )
581   PORT_DIPNAME( 0xc0, 0xc0, "System Limit" )      PORT_DIPLOCATION("DSW3:7,8")
581   PORT_DIPNAME( 0xc0, 0xc0, "System Limit" )      PORT_DIPLOCATION("DSW3:7,8")
582582   PORT_DIPSETTING(    0xc0, "5k" )
583583   PORT_DIPSETTING(    0x80, "10k" )
584584   PORT_DIPSETTING(    0x40, "30k" )
585585   PORT_DIPSETTING(    0x00, "Unlimited" )
586586
587587   PORT_START("DSW4")
588   PORT_DIPNAME( 0x01, 0x01, "Min Play For Fever" )   PORT_DIPLOCATION("DSW4:1")
588   PORT_DIPNAME( 0x01, 0x01, "Min Play For Fever" )    PORT_DIPLOCATION("DSW4:1")
589589   PORT_DIPSETTING(    0x01, "8" )
590590   PORT_DIPSETTING(    0x00, "16" )
591   PORT_DIPNAME( 0x02, 0x02, "Max Bet" )         PORT_DIPLOCATION("DSW4:2")
591   PORT_DIPNAME( 0x02, 0x02, "Max Bet" )           PORT_DIPLOCATION("DSW4:2")
592592   PORT_DIPSETTING(    0x02, "16" )
593593   PORT_DIPSETTING(    0x00, "32" )
594   PORT_DIPNAME( 0x1c, 0x1c, "Coin 2 Rate" )      PORT_DIPLOCATION("DSW4:3,4,5")
594   PORT_DIPNAME( 0x1c, 0x1c, "Coin 2 Rate" )       PORT_DIPLOCATION("DSW4:3,4,5")
595595   PORT_DIPSETTING(    0x1c, "1" )
596596   PORT_DIPSETTING(    0x18, "2" )
597597   PORT_DIPSETTING(    0x14, "5" )
r242631r242632
600600   PORT_DIPSETTING(    0x08, "40" )
601601   PORT_DIPSETTING(    0x04, "50" )
602602   PORT_DIPSETTING(    0x00, "100" )
603   PORT_DIPNAME( 0x60, 0x60, "Key Out Rate" )      PORT_DIPLOCATION("DSW4:6,7")
603   PORT_DIPNAME( 0x60, 0x60, "Key Out Rate" )      PORT_DIPLOCATION("DSW4:6,7")
604604   PORT_DIPSETTING(    0x60, "1" )
605605   PORT_DIPSETTING(    0x40, "10" )
606606   PORT_DIPSETTING(    0x20, "50" )
607607   PORT_DIPSETTING(    0x00, "100" )
608   PORT_DIPNAME( 0x80, 0x80, "Play Line" )         PORT_DIPLOCATION("DSW4:8")
608   PORT_DIPNAME( 0x80, 0x80, "Play Line" )         PORT_DIPLOCATION("DSW4:8")
609609   PORT_DIPSETTING(    0x80, "8" )
610610   PORT_DIPSETTING(    0x00, "16" )
611611
612// These are from the manual for v201us - DSW1-DSW4 match but DSW5 doesn't seem to match or actuallly do anything
612// These are from the manual for v201us - DSW1-DSW4 match but DSW5 doesn't seem to match or actuallly do anything
613613   PORT_START("DSW5")
614   PORT_DIPNAME( 0x03, 0x00, "Maximum Play" )      PORT_DIPLOCATION("DSW5:1,2")
614   PORT_DIPNAME( 0x03, 0x00, "Maximum Play" )      PORT_DIPLOCATION("DSW5:1,2")
615615   PORT_DIPSETTING(    0x00, "64" )
616616   PORT_DIPSETTING(    0x01, "32" )
617617   PORT_DIPSETTING(    0x02, "16" )
618618   PORT_DIPSETTING(    0x03, "8" )
619   PORT_DIPNAME( 0x04, 0x04, "Skill Stop" )      PORT_DIPLOCATION("DSW5:3")
619   PORT_DIPNAME( 0x04, 0x04, "Skill Stop" )        PORT_DIPLOCATION("DSW5:3")
620620   PORT_DIPSETTING(    0x04, "On" )
621621   PORT_DIPSETTING(    0x00, "Off" )
622   PORT_DIPNAME( 0x08, 0x00, "Hands Count" )      PORT_DIPLOCATION("DSW5:4")
622   PORT_DIPNAME( 0x08, 0x00, "Hands Count" )       PORT_DIPLOCATION("DSW5:4")
623623   PORT_DIPSETTING(    0x08, "No" )
624624   PORT_DIPSETTING(    0x00, "Yes" )
625   PORT_DIPNAME( 0x30, 0x00, "Hands Coin Rate" )   PORT_DIPLOCATION("DSW5:5,6")
625   PORT_DIPNAME( 0x30, 0x00, "Hands Coin Rate" )   PORT_DIPLOCATION("DSW5:5,6")
626626   PORT_DIPSETTING(    0x00, "25" )
627627   PORT_DIPSETTING(    0x20, "10" )
628628   PORT_DIPSETTING(    0x10, "5" )
629629   PORT_DIPSETTING(    0x30, "1" )
630   PORT_DIPNAME( 0x40, 0x40, "Hands Coin Value" )   PORT_DIPLOCATION("DSW5:7")
630   PORT_DIPNAME( 0x40, 0x40, "Hands Coin Value" )  PORT_DIPLOCATION("DSW5:7")
631631   PORT_DIPSETTING(    0x00, "40" )
632632   PORT_DIPSETTING(    0x40, "20" )
633   PORT_DIPNAME( 0x80, 0x80, "Unused" )         PORT_DIPLOCATION("DSW5:8")
633   PORT_DIPNAME( 0x80, 0x80, "Unused" )            PORT_DIPLOCATION("DSW5:8")
634634   PORT_DIPSETTING(    0x00, "On" )
635635   PORT_DIPSETTING(    0x80, "Off" )
636636
trunk/src/mame/drivers/jpmimpct.c
r242631r242632
13241324   MCFG_SOUND_ADD("upd",UPD7759, UPD7759_STANDARD_CLOCK)
13251325   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
13261326   MCFG_DEFAULT_LAYOUT(layout_jpmimpct)
1327   
1327
13281328   MCFG_STARPOINT_48STEP_ADD("reel0")
13291329   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(jpmimpct_state, reel0_optic_cb))
13301330   MCFG_STARPOINT_48STEP_ADD("reel1")
r242631r242632
13371337   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(jpmimpct_state, reel4_optic_cb))
13381338   MCFG_STARPOINT_48STEP_ADD("reel5")
13391339   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(jpmimpct_state, reel5_optic_cb))
1340   
1340
13411341MACHINE_CONFIG_END
13421342
13431343
trunk/src/mame/drivers/lindbergh.c
r242631r242632
114114 WCC Football Intercontinental Clubs 2008-2009 ?                 ?               ?
115115 WCC Football Intercontinental Clubs 2009-2010 ?                 ?               ?
116116
117* denotes these DVDs are archived.
118^ denotes these PICs are archived.
117* denotes these DVDs are archived.
118^ denotes these PICs are archived.
119119This list is not necessarily correct or complete.
120120Corrections and additions to the above are welcome.
121121
r242631r242632
386386   ROM_LOAD("fpr-24370b.ic6", 0x000000, 0x400000, CRC(c3b021a4) SHA1(1b6938a50fe0e4ae813864649eb103838c399ac0)) \
387387\
388388   ROM_REGION32_LE(0x10000, ":pci:01.0:00.0", 0) /* Geforce bios extension (custom for the card) */ \
389   ROM_LOAD("vid_bios.u504", 0x00000, 0x10000, CRC(f78d14d7) SHA1(f129787e487984edd23bf344f2e9500c85052275)) \
390
389   ROM_LOAD("vid_bios.u504", 0x00000, 0x10000, CRC(f78d14d7) SHA1(f129787e487984edd23bf344f2e9500c85052275))
391390ROM_START(lindbios)
392391   LINDBERGH_BIOS
393392ROM_END
trunk/src/mame/drivers/maygay1b.c
r242631r242632
628628   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(maygay1b_state, reel4_optic_cb))
629629   MCFG_STARPOINT_48STEP_ADD("reel5")
630630   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(maygay1b_state, reel5_optic_cb))
631   
631
632632   MCFG_NVRAM_ADD_0FILL("nvram")
633633
634634   MCFG_DEFAULT_LAYOUT(layout_maygay1b)
trunk/src/mame/drivers/mjkjidai.c
r242631r242632
282282void mjkjidai_state::machine_start()
283283{
284284   membank("bank1")->configure_entries(0, 4, memregion("maincpu")->base() + 0x8000, 0x4000);
285   
285
286286   save_item(NAME(m_adpcm_pos));
287287   save_item(NAME(m_adpcm_end));
288288   save_item(NAME(m_keyb));
trunk/src/mame/drivers/mpu3.c
r242631r242632
801801   MCFG_STEPPER_END_INDEX(3)\
802802   MCFG_STEPPER_INDEX_PATTERN(0x00)\
803803   MCFG_STEPPER_INIT_PHASE(2)
804   
804
805805static MACHINE_CONFIG_START( mpu3base, mpu3_state )
806806   MCFG_CPU_ADD("maincpu", M6808, MPU3_MASTER_CLOCK)///4)
807807   MCFG_CPU_PROGRAM_MAP(mpu3_basemap)
trunk/src/mame/drivers/mpu4hw.c
r242631r242632
24772477   MCFG_STEPPER_END_INDEX(3)\
24782478   MCFG_STEPPER_INDEX_PATTERN(0x00)\
24792479   MCFG_STEPPER_INIT_PHASE(2)
2480   
2480
24812481#define MCFG_MPU4_TYPE2_REEL_ADD(_tag)\
24822482   MCFG_STEPPER_ADD(_tag)\
24832483   MCFG_STEPPER_REEL_TYPE(BARCREST_48STEP_REEL)\
r242631r242632
25012501   MCFG_STEPPER_END_INDEX(3)\
25022502   MCFG_STEPPER_INDEX_PATTERN(0x00)\
25032503   MCFG_STEPPER_INIT_PHASE(2)
2504   
25052504
2505
25062506MACHINE_CONFIG_FRAGMENT( mpu4_std_4reel )
25072507   MCFG_MPU4_STD_REEL_ADD("reel0")
25082508   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu4_state, reel0_optic_cb))
r242631r242632
25112511   MCFG_MPU4_STD_REEL_ADD("reel2")
25122512   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu4_state, reel2_optic_cb))
25132513   MCFG_MPU4_STD_REEL_ADD("reel3")
2514   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu4_state, reel3_optic_cb))   
2515MACHINE_CONFIG_END   
2514   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu4_state, reel3_optic_cb))
2515MACHINE_CONFIG_END
25162516
25172517MACHINE_CONFIG_FRAGMENT( mpu4_std_5reel )
25182518   MCFG_MPU4_STD_REEL_ADD("reel0")
r242631r242632
25222522   MCFG_MPU4_STD_REEL_ADD("reel2")
25232523   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu4_state, reel2_optic_cb))
25242524   MCFG_MPU4_STD_REEL_ADD("reel3")
2525   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu4_state, reel3_optic_cb))   
2525   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu4_state, reel3_optic_cb))
25262526   MCFG_MPU4_STD_REEL_ADD("reel4")
2527   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu4_state, reel4_optic_cb))   
2528MACHINE_CONFIG_END   
2527   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu4_state, reel4_optic_cb))
2528MACHINE_CONFIG_END
25292529
25302530MACHINE_CONFIG_FRAGMENT( mpu4_std_6reel )
25312531   MCFG_MPU4_STD_REEL_ADD("reel0")
r242631r242632
25352535   MCFG_MPU4_STD_REEL_ADD("reel2")
25362536   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu4_state, reel2_optic_cb))
25372537   MCFG_MPU4_STD_REEL_ADD("reel3")
2538   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu4_state, reel3_optic_cb))   
2538   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu4_state, reel3_optic_cb))
25392539   MCFG_MPU4_STD_REEL_ADD("reel4")
2540   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu4_state, reel4_optic_cb))   
2540   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu4_state, reel4_optic_cb))
25412541   MCFG_MPU4_STD_REEL_ADD("reel5")
2542   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu4_state, reel4_optic_cb))   
2543MACHINE_CONFIG_END   
2542   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu4_state, reel4_optic_cb))
2543MACHINE_CONFIG_END
25442544
25452545MACHINE_CONFIG_FRAGMENT( mpu4_type2_6reel )
25462546   MCFG_MPU4_TYPE2_REEL_ADD("reel0")
r242631r242632
25502550   MCFG_MPU4_TYPE2_REEL_ADD("reel2")
25512551   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu4_state, reel2_optic_cb))
25522552   MCFG_MPU4_TYPE2_REEL_ADD("reel3")
2553   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu4_state, reel3_optic_cb))   
2553   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu4_state, reel3_optic_cb))
25542554   MCFG_MPU4_TYPE2_REEL_ADD("reel4")
25552555   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu4_state, reel4_optic_cb))
25562556   MCFG_MPU4_TYPE2_REEL_ADD("reel5")
25572557   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu4_state, reel5_optic_cb))
2558MACHINE_CONFIG_END   
2558MACHINE_CONFIG_END
25592559
25602560
25612561MACHINE_CONFIG_FRAGMENT( mpu4_bwb_5reel )
r242631r242632
25662566   MCFG_MPU4_BWB_REEL_ADD("reel2")
25672567   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu4_state, reel2_optic_cb))
25682568   MCFG_MPU4_BWB_REEL_ADD("reel3")
2569   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu4_state, reel3_optic_cb))   
2569   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu4_state, reel3_optic_cb))
25702570   MCFG_MPU4_BWB_REEL_ADD("reel4")
25712571   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu4_state, reel4_optic_cb))
2572MACHINE_CONFIG_END   
2573   
2572MACHINE_CONFIG_END
2573
25742574MACHINE_CONFIG_FRAGMENT( mpu4_alt_7reel )
25752575   MCFG_MPU4_TYPE3_REEL_ADD("reel0")
25762576   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu4_state, reel0_optic_cb))
r242631r242632
25792579   MCFG_MPU4_TYPE3_REEL_ADD("reel2")
25802580   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu4_state, reel2_optic_cb))
25812581   MCFG_MPU4_TYPE3_REEL_ADD("reel3")
2582   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu4_state, reel3_optic_cb))   
2582   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu4_state, reel3_optic_cb))
25832583   MCFG_MPU4_TYPE3_REEL_ADD("reel4")
25842584   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu4_state, reel4_optic_cb))
25852585   MCFG_MPU4_TYPE3_REEL_ADD("reel5")
r242631r242632
25872587   MCFG_MPU4_TYPE3_REEL_ADD("reel6")
25882588   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu4_state, reel6_optic_cb))
25892589   MCFG_MPU4_TYPE3_REEL_ADD("reel7")
2590   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu4_state, reel7_optic_cb))   
2591MACHINE_CONFIG_END   
2590   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu4_state, reel7_optic_cb))
2591MACHINE_CONFIG_END
25922592
25932593MACHINE_CONFIG_FRAGMENT( mpu4_common )
25942594   MCFG_TIMER_DRIVER_ADD_PERIODIC("50hz", mpu4_state, gen_50hz, attotime::from_hz(100))
r242631r242632
26542654   MCFG_PIA_CB2_HANDLER(WRITELINE(mpu4_state, pia_ic8_cb2_w))
26552655   MCFG_PIA_IRQA_HANDLER(WRITELINE(mpu4_state, cpu0_irq))
26562656   MCFG_PIA_IRQB_HANDLER(WRITELINE(mpu4_state, cpu0_irq))
2657   
2657
26582658MACHINE_CONFIG_END
26592659
26602660MACHINE_CONFIG_FRAGMENT( mpu4_common2 )
r242631r242632
27272727
27282728   MCFG_FRAGMENT_ADD(mpu4_common2)
27292729   MCFG_FRAGMENT_ADD(mpu4_std_6reel)
2730   
2730
27312731   MCFG_SOUND_ADD("msm6376", OKIM6376, 128000)     //16KHz sample Can also be 85430 at 10.5KHz and 64000 at 8KHz
27322732   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0)
27332733   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0)
r242631r242632
27492749
27502750   MCFG_FRAGMENT_ADD(mpu4_common2)
27512751   MCFG_FRAGMENT_ADD(mpu4_std_5reel)
2752   
2752
27532753   MCFG_SOUND_ADD("msm6376", OKIM6376, 128000)     //16KHz sample Can also be 85430 at 10.5KHz and 64000 at 8KHz
27542754   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0)
27552755   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0)
r242631r242632
27592759   MCFG_MACHINE_START_OVERRIDE(mpu4_state,mpu4bwb)
27602760   MCFG_FRAGMENT_ADD(mpu4_common2)
27612761   MCFG_FRAGMENT_ADD(mpu4_bwb_5reel)
2762   
2762
27632763   MCFG_SOUND_ADD("msm6376", OKIM6376, 128000)     //16KHz sample Can also be 85430 at 10.5KHz and 64000 at 8KHz
27642764   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0)
27652765   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0)
trunk/src/mame/drivers/namcops2.c
r242631r242632
325325// only known System Super 256 game; if more surface the BIOS should be moved out like 246/256
326326ROM_START( timecrs4 )
327327   ROM_REGION(0x200000, "bios", 0)
328   ROM_LOAD( "r27v1602f.8g", 0x000000, 0x200000, CRC(b2a8eeb6) SHA1(bc4fb4e1e53adbd92385f1726bd69663ff870f1e) )
328   ROM_LOAD( "r27v1602f.8g", 0x000000, 0x200000, CRC(b2a8eeb6) SHA1(bc4fb4e1e53adbd92385f1726bd69663ff870f1e) )
329329
330330   ROM_REGION(0x840000, "key", ROMREGION_ERASE00)
331   ROM_LOAD( "tsf1002-na-a.ic002", 0x000000, 0x800000, CRC(406183a4) SHA1(dd6afaa4808254b277c5969d071f1dd0019633a0) )
332   ROM_LOAD( "tsf1002-na-a_spr.ic002", 0x800000, 0x040000, CRC(e7339b66) SHA1(99a2fd5528daf11a7ea548d9de804f899a2a9c6b) )
331   ROM_LOAD( "tsf1002-na-a.ic002", 0x000000, 0x800000, CRC(406183a4) SHA1(dd6afaa4808254b277c5969d071f1dd0019633a0) )
332   ROM_LOAD( "tsf1002-na-a_spr.ic002", 0x800000, 0x040000, CRC(e7339b66) SHA1(99a2fd5528daf11a7ea548d9de804f899a2a9c6b) )
333333
334   DISK_REGION("dvd")   // HDD for this game
334   DISK_REGION("dvd")  // HDD for this game
335335   DISK_IMAGE_READONLY( "tsf1-ha", 0, SHA1(8ba7eec0d1add2192a115b295a32265c8d084aea) )
336336ROM_END
337337
r242631r242632
411411   SYSTEM256_BIOS
412412
413413   ROM_REGION(0x840000, "key", ROMREGION_ERASE00)
414   ROM_LOAD( "ted1vera.ic002", 0x000000, 0x800000, CRC(491521d1) SHA1(9c27836445690bc083c6f274a4b1a499d5677830) )
415   ROM_LOAD( "ted1vera_spr.ic002", 0x800000, 0x040000, CRC(a9e1e92b) SHA1(3843d0fea2f12f14f83d0a04430bb9b01cfdef07) )
414   ROM_LOAD( "ted1vera.ic002", 0x000000, 0x800000, CRC(491521d1) SHA1(9c27836445690bc083c6f274a4b1a499d5677830) )
415   ROM_LOAD( "ted1vera_spr.ic002", 0x800000, 0x040000, CRC(a9e1e92b) SHA1(3843d0fea2f12f14f83d0a04430bb9b01cfdef07) )
416416
417417   DISK_REGION("dvd")
418418   DISK_IMAGE_READONLY( "ted1dvd0b", 0, SHA1(5940cc628a1555763ef2055e518f840f9a44d123) )
r242631r242632
435435   SYSTEM246_BIOS
436436
437437   ROM_REGION(0x840000, "key", ROMREGION_ERASE00)
438   ROM_LOAD( "pr21vera.ic002", 0x000000, 0x800000, CRC(36634ad2) SHA1(e365a79220202640e5bc80bbd8a329012f22f9c4) )
439   ROM_LOAD( "pr21vera_spr.ic002", 0x000000, 0x040000, CRC(4e81ef24) SHA1(7b7b9d9a0193bcaccb1578cae9dde37fc456e6f8) )
438   ROM_LOAD( "pr21vera.ic002", 0x000000, 0x800000, CRC(36634ad2) SHA1(e365a79220202640e5bc80bbd8a329012f22f9c4) )
439   ROM_LOAD( "pr21vera_spr.ic002", 0x000000, 0x040000, CRC(4e81ef24) SHA1(7b7b9d9a0193bcaccb1578cae9dde37fc456e6f8) )
440440
441441   DISK_REGION("dvd")
442442   DISK_IMAGE_READONLY( "pr21dvd0", 0, SHA1(6bad5c25996bbe68da71199fbe8377b51fe78d81) )
r242631r242632
513513   SYSTEM246_BIOS
514514
515515   ROM_REGION(0x840000, "key", ROMREGION_ERASE00)
516   ROM_LOAD( "rrv2vera.ic002", 0x000000, 0x800000, CRC(4666f6b5) SHA1(974ed4f6c5869ecf879c0d3540db6ea576225c04) )
517   ROM_LOAD( "rrv2vera_spr.ic002", 0x800000, 0x040000, CRC(8d98ef04) SHA1(3f33046a8283b918226301fcf5538729be84bfbe) )
516   ROM_LOAD( "rrv2vera.ic002", 0x000000, 0x800000, CRC(4666f6b5) SHA1(974ed4f6c5869ecf879c0d3540db6ea576225c04) )
517   ROM_LOAD( "rrv2vera_spr.ic002", 0x800000, 0x040000, CRC(8d98ef04) SHA1(3f33046a8283b918226301fcf5538729be84bfbe) )
518518
519519   ROM_REGION(0x4010, "jvsio", 0)  // Namco "FCA" JVS I/O board PIC16F84 code (see namcos23.c for FCA details)
520520   ROM_LOAD( "fcap11.ic2",   0x000000, 0x004010, CRC(1b2592ce) SHA1(a1a487361053af564f6ec67e545413e370a3b38c) )
r242631r242632
579579   SYSTEM246_BIOS
580580
581581   ROM_REGION(0x840000, "key", ROMREGION_ERASE00)
582   ROM_LOAD( "qg1vera.ic002", 0x000000, 0x800000, CRC(650d55fa) SHA1(cf1210bc1f2d48c298ed19e3c6a1e5e564840e47) )
583   ROM_LOAD( "qg1vera_spr.ic002", 0x800000, 0x040000, CRC(d9715f53) SHA1(e45f0eef5b82b2e1afb054a137aced0344ddbd71) )
582   ROM_LOAD( "qg1vera.ic002", 0x000000, 0x800000, CRC(650d55fa) SHA1(cf1210bc1f2d48c298ed19e3c6a1e5e564840e47) )
583   ROM_LOAD( "qg1vera_spr.ic002", 0x800000, 0x040000, CRC(d9715f53) SHA1(e45f0eef5b82b2e1afb054a137aced0344ddbd71) )
584584
585585   DISK_REGION("dvd")
586586   DISK_IMAGE_READONLY( "qg1", 0, SHA1(80fe5cb325c7cfa439d66e9d264337c01559d0e5) )
r242631r242632
614614   SYSTEM256_BIOS
615615
616616   ROM_REGION(0x840000, "key", ROMREGION_ERASE00)
617   ROM_LOAD( "gvs1vera.ic002", 0x000000, 0x800000, CRC(b938b96d) SHA1(e79bc7f8c234d51d1b6a34be88f34abc8205a370) )
618   ROM_LOAD( "gvs1vera_spr.ic002", 0x800000, 0x040000, CRC(f2d65d54) SHA1(297726098c3723e38cbaf3a3150a4a027a9c2124) )
617   ROM_LOAD( "gvs1vera.ic002", 0x000000, 0x800000, CRC(b938b96d) SHA1(e79bc7f8c234d51d1b6a34be88f34abc8205a370) )
618   ROM_LOAD( "gvs1vera_spr.ic002", 0x800000, 0x040000, CRC(f2d65d54) SHA1(297726098c3723e38cbaf3a3150a4a027a9c2124) )
619619
620620   DISK_REGION("dvd")
621621   DISK_IMAGE_READONLY( "gvs1dvd0b", 0, SHA1(3cf9ade5495982fcb8e106e7be4067429530f864) )
r242631r242632
703703
704704// System Super 256
705705GAME(2006, timecrs4,   sys256, system256, system246, driver_device, 0, ROT0, "Namco", "Time Crisis 4", GAME_IS_SKELETON)
706
trunk/src/mame/drivers/relief.c
r242631r242632
106106
107107static ADDRESS_MAP_START( oki_map, AS_0, 8, relief_state )
108108   AM_RANGE(0x00000, 0x1ffff) AM_ROMBANK("okibank")
109   AM_RANGE(0x20000, 0x3ffff) AM_ROM
109   AM_RANGE(0x20000, 0x3ffff) AM_ROM
110110ADDRESS_MAP_END
111111
112112
r242631r242632
431431}
432432
433433
434     
435434
435
436436/*************************************
437437 *
438438 *  Game driver(s)
trunk/src/mame/drivers/renegade.c
r242631r242632
131131   // (chip select for an unpopulated fourth ROM?)
132132   switch (data & 0x1c)
133133   {
134      case 0x18: m_adpcm_pos = 0 * 0x8000 * 2; break;      // 110 -> ic33
135      case 0x14: m_adpcm_pos = 1 * 0x8000 * 2; break;      // 101 -> ic32
136      case 0x0c: m_adpcm_pos = 2 * 0x8000 * 2; break;      // 011 -> ic31
137      default: m_adpcm_pos = m_adpcm_end = 0; return;   // doesn't happen
134      case 0x18: m_adpcm_pos = 0 * 0x8000 * 2; break;     // 110 -> ic33
135      case 0x14: m_adpcm_pos = 1 * 0x8000 * 2; break;     // 101 -> ic32
136      case 0x0c: m_adpcm_pos = 2 * 0x8000 * 2; break;     // 011 -> ic31
137      default: m_adpcm_pos = m_adpcm_end = 0; return; // doesn't happen
138138   }
139139   // bits 0-1 are a13-a14
140140   m_adpcm_pos |= (data & 0x03) * 0x2000 * 2;
trunk/src/mame/drivers/sbrkout.c
r242631r242632
66
77    Games supported:
88        * Super Breakout
9        * Super Breakout (Canyon and Vertical Breakout, prototype)
10      * Super Breakout (Cocktail, prototype)
9        * Super Breakout (Canyon and Vertical Breakout, prototype)
10        * Super Breakout (Cocktail, prototype)
1111
1212    Known issues:
1313        * none at this time
r242631r242632
529529
530530   PORT_MODIFY("SELECT")
531531   PORT_CONFNAME(0x80, 0x00, "Game Select" )
532   PORT_CONFSETTING( 0x00,   DEF_STR( Off ) )
532   PORT_CONFSETTING( 0x00, DEF_STR( Off ) )
533533   PORT_CONFSETTING( 0x80, DEF_STR( On ) )
534534INPUT_PORTS_END
535535
trunk/src/mame/drivers/snowbros.c
r242631r242632
14011401   PORT_DIPUNUSED_DIPLOC( 0x0020, 0x0000, "SW1:6" )
14021402   PORT_DIPUNUSED_DIPLOC( 0x0040, 0x0000, "SW1:7" )
14031403   PORT_SERVICE_DIPLOC(   0x0080, IP_ACTIVE_LOW, "SW1:8" )
1404   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Button 4 / Stand / Stop / Drop / Full Bet / Take") PORT_CODE(KEYCODE_V)
1405   PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Button 1 / High") PORT_CODE(KEYCODE_Z)
1406   PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Button 2 / Low") PORT_CODE(KEYCODE_X)
1407   PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Button 3 / Hit / Go / Double Up") PORT_CODE(KEYCODE_C)
1404   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Button 4 / Stand / Stop / Drop / Full Bet / Take") PORT_CODE(KEYCODE_V)
1405   PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Button 1 / High") PORT_CODE(KEYCODE_Z)
1406   PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Button 2 / Low") PORT_CODE(KEYCODE_X)
1407   PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Button 3 / Hit / Go / Double Up") PORT_CODE(KEYCODE_C)
14081408   PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_UNKNOWN )
1409   PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Button 6 / Bet / Raise") PORT_CODE(KEYCODE_N)
1409   PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Button 6 / Bet / Raise") PORT_CODE(KEYCODE_N)
14101410   PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_UNKNOWN )
14111411   PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_UNKNOWN )
14121412
r242631r242632
14291429   PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_UNKNOWN )
14301430
14311431   PORT_START("SYSTEM")
1432   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Button 5 / Start / Double / Call / Check") PORT_CODE(KEYCODE_B) // Double != Double Up
1432   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Button 5 / Start / Double / Call / Check") PORT_CODE(KEYCODE_B) // Double != Double Up
14331433   PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_UNKNOWN )
14341434   PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_COIN1 )
14351435   PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_COIN2 )
trunk/src/mame/drivers/taito_f3.c
r242631r242632
31433143   ROM_LOAD16_BYTE("e29-04.ic39", 0x800000, 0x200000, CRC(d1f42457) SHA1(2c77be6365deb5ef215da0c66da23b415623bdb1) )    // D2 C8 C9 CA
31443144   ROM_LOAD16_BYTE("e29-05.ic41", 0xc00000, 0x200000, CRC(e33c1234) SHA1(84c336ed6fd8723e824889fe7b52c284be659e62) )    // CB CC -std-
31453145
3146    ROM_REGION(0x034a, "pals", 0)
3147    ROM_LOAD("d77-12.ic48.bin", 0x0000, 0x0001, NO_DUMP) /* PALCE16V8Q-15PC/4 */
3148    ROM_LOAD("d77-14.ic21.bin", 0x0001, 0x0001, NO_DUMP) /* PALCE16V8Q-15PC/4 */
3149    ROM_LOAD("d77-11.ic37.bin", 0x0002, 0x0001, NO_DUMP) /* PALCE16V8Q-15PC/4 */
3150    ROM_LOAD("d77-09.ic14.bin", 0x0003, 0x0001, NO_DUMP) /* PAL16L8ACN */
3151    ROM_LOAD("d77-10.ic28.bin", 0x0004, 0x0001, NO_DUMP) /* PAL16L8ACN */
3146   ROM_REGION(0x034a, "pals", 0)
3147   ROM_LOAD("d77-12.ic48.bin", 0x0000, 0x0001, NO_DUMP) /* PALCE16V8Q-15PC/4 */
3148   ROM_LOAD("d77-14.ic21.bin", 0x0001, 0x0001, NO_DUMP) /* PALCE16V8Q-15PC/4 */
3149   ROM_LOAD("d77-11.ic37.bin", 0x0002, 0x0001, NO_DUMP) /* PALCE16V8Q-15PC/4 */
3150   ROM_LOAD("d77-09.ic14.bin", 0x0003, 0x0001, NO_DUMP) /* PAL16L8ACN */
3151   ROM_LOAD("d77-10.ic28.bin", 0x0004, 0x0001, NO_DUMP) /* PAL16L8ACN */
31523152ROM_END
31533153
31543154ROM_START( arkretrn )
trunk/src/mame/drivers/tigeroad.c
r242631r242632
619619   MCFG_SCREEN_PALETTE("palette")
620620
621621   MCFG_GFXDECODE_ADD("gfxdecode", "palette", tigeroad)
622   
622
623623   MCFG_DEVICE_ADD("spritegen", TIGEROAD_SPRITE, 0)
624624
625625   MCFG_PALETTE_ADD("palette", 1024)
trunk/src/mame/drivers/viper.c
r242631r242632
8080       DS2430 - Dallas DS2430 256-bits 1-Wire EEPROM. Has 256 bits x8 EEPROM (32 bytes), 64 bits x8 (8 bytes)
8181                one-time programmable application register and unique factory-lasered and tested 64-bit
8282                registration number (8-bit family code + 48-bit serial number + 8-bit CRC) (TO-92 @ U37)
83                The OTP application register on the common DS2430 and the Police 911 2 DS2430 are not programmed
84                (application register reads all 0xFF and the status register reads back 0xFF), so it's probably safe
83                The OTP application register on the common DS2430 and the Police 911 2 DS2430 are not programmed
84                (application register reads all 0xFF and the status register reads back 0xFF), so it's probably safe
8585                to assume they're not used on any of them.
8686                It appears the DS2430 is not protected from reading and the unique silicon serial number is
8787                included in the 40 byte dump. This serial number is used as a check to verify the NVRAM and DS2430.
8888                In the Police 911 2 NVRAM dump the serial number of the DS2430 is located at 0x002A and 0x1026
8989                If the serial number in the NVRAM and DS2430 match then they are paired and the game accepts the NVRAM.
9090                If they don't match the game requires an external DS2430 (i.e. dongle) and flags the NVRAM as 'BAD'
91                The serial number is not present in the CF card (2 different Police 911 2 cards of the same version
91                The serial number is not present in the CF card (2 different Police 911 2 cards of the same version
9292                were dumped and matched).
93                When the lasered ROM is read from the DS2430, it comes out from LSB to MSB (family code, LSB of
93                When the lasered ROM is read from the DS2430, it comes out from LSB to MSB (family code, LSB of
9494                S/N->MSB of S/N, CRC)
9595                For Police 911 2 that is 0x14 0xB2 0xB7 0x4A 0x00 0x00 0x00 0x83
9696                Family code=0x14
r242631r242632
104104                It may be possible to hand craft a DS2430 for a dongle-protected version of a game simply by using
105105                one of the existing DS2430 dumps and adjusting the serial number found in a dump of the NVRAM to pair them
106106                or adjusting the serial number in the NVRAM to match the serial number found in one of the dumped DS2430s.
107                This Police 911 2 board was upgraded from Police 911 by plugging in the dongle and changing the CF card.
108                The NVRAM had previously died and the board was dead. Normally for a Viper game that is fatal. Using
109                the NVRAM from Police 911 allowed it to boot and then the NVRAM upgraded itself with some additional
107                This Police 911 2 board was upgraded from Police 911 by plugging in the dongle and changing the CF card.
108                The NVRAM had previously died and the board was dead. Normally for a Viper game that is fatal. Using
109                the NVRAM from Police 911 allowed it to boot and then the NVRAM upgraded itself with some additional
110110                data (the original data remained untouched). This means the dongle does more than just protect the game.
111                Another interesting fact about this upgrade is it has been discovered that the PCB can write to the
112                external DS2430 in the dongle. This has been proven because the serial number of the DS2430 soldered
111                Another interesting fact about this upgrade is it has been discovered that the PCB can write to the
112                external DS2430 in the dongle. This has been proven because the serial number of the DS2430 soldered
113113                on the PCB is present in the EEPROM area of the Police 911 2 DS2430.
114114                Here is a dump of the DS2430 from Police 911. Note the EEPROM area is empty and the serial number (from 0x20 onwards)
115115                is present in the above Police 911 2 DS2430 dump at locations 0x11, 0x10 and 0x0F
r242631r242632
117117                00000010h FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
118118                00000020h 14 A9 30 74 00 00 00 E7
119119                This proves that the EEPROM area in the DS2430 is unused by an unprotected game and in fact the on-board
120                DS2430 is completely unused by an unprotected game. That is why any unprotected game will work on any
120                DS2430 is completely unused by an unprotected game. That is why any unprotected game will work on any
121121                Viper PCB regardless of the on-board DS2430 serial number.
122                The existing DS2430 'common' dump used in the unprotected games was actually from a (dongle-protected)
122                The existing DS2430 'common' dump used in the unprotected games was actually from a (dongle-protected)
123123                Mahjong Fight Club PCB but that PCB was used to test and run all of the unprotected Viper games.
124124      M48T58Y - ST Microelectronics M48T58Y Timekeeper RAM (DIP28 @ U39). When this dies (after 10 year lifespan)
125125                the game will complain with error RTC BAD then reset. The data inside the RTC can not be hand created
126126                (yet) so to revive the PCB the correct RTC data must be re-programmed to a new RTC and replaced
127127                on the PCB.
128128                Regarding the RTC and protection-related checks....
129                "RTC OK" checks 0x0000->0x0945 (i.e. I can clear the contents after 0x0945 and the game will still
129                "RTC OK" checks 0x0000->0x0945 (i.e. I can clear the contents after 0x0945 and the game will still
130130                happily boot). The NVRAM contents are split into chunks, each of which are checksummed.  It is a 16-bit checksum,
131                computed by summing two consecutive bytes as a 16-bit integer, where the final sum must add up to 0xFFFF (mod
132                65536).  The last two bytes in the chunk are used to make the value 0xFFFF.  There doesn't appear to be a
133                complete checksum over all the chunks (I can pick and choose chunks from various NVRAMs, as long as each chunk
131                computed by summing two consecutive bytes as a 16-bit integer, where the final sum must add up to 0xFFFF (mod
132                65536).  The last two bytes in the chunk are used to make the value 0xFFFF.  There doesn't appear to be a
133                complete checksum over all the chunks (I can pick and choose chunks from various NVRAMs, as long as each chunk
134134                checksum checks out). The important chunks for booting are the first two.
135                The first chunk goes from 0x0000-0x000F.  This seems to be a game/region identifier, and doesn't like its
136                contents changed (I didn't try changing every byte, but several of the bytes would throw RTC errors, even with a
137                fixed checksum).  I'd guess that the CF verifies this value, since it's different for every game (i.e. Mocap
135                The first chunk goes from 0x0000-0x000F.  This seems to be a game/region identifier, and doesn't like its
136                contents changed (I didn't try changing every byte, but several of the bytes would throw RTC errors, even with a
137                fixed checksum).  I'd guess that the CF verifies this value, since it's different for every game (i.e. Mocap
138138                Boxing NVRAM would have a correct checksum, but shouldn't pass Police 911 checks).
139                The second chunk goes from 0x0010-0x0079.  This seems to be a board identifier.  This has (optionally)
140                several fields, each of which are 20 bytes long.  I'm unsure of the first 6 bytes, the following 6
141                bytes are the DS2430A S/N, and the last 8 bytes are a game/region/dongle identifier.  If running
142                without a dongle, only the first 20 byte field is present.  With a dongle, a second 20 byte field will
143                be present.  Moving this second field into the place of the first field (and fixing the checksum)
144                doesn't work, and the second field will be ignored if the first field is valid for the game (and in
145                which case the dongle will be ignored).  For example, Police 911 will boot with a valid first field,
146                with or without the second field, and with or without the dongle plugged in.  If you have both fields,
147                and leave the dongle plugged in, you can switch between Police 911 and Police 911/2 by simply swapping
139                The second chunk goes from 0x0010-0x0079.  This seems to be a board identifier.  This has (optionally)
140                several fields, each of which are 20 bytes long.  I'm unsure of the first 6 bytes, the following 6
141                bytes are the DS2430A S/N, and the last 8 bytes are a game/region/dongle identifier.  If running
142                without a dongle, only the first 20 byte field is present.  With a dongle, a second 20 byte field will
143                be present.  Moving this second field into the place of the first field (and fixing the checksum)
144                doesn't work, and the second field will be ignored if the first field is valid for the game (and in
145                which case the dongle will be ignored).  For example, Police 911 will boot with a valid first field,
146                with or without the second field, and with or without the dongle plugged in.  If you have both fields,
147                and leave the dongle plugged in, you can switch between Police 911 and Police 911/2 by simply swapping
148148                CF cards.
149149       29F002 - Fujitsu 29F002 256k x8 EEPROM stamped '941B01' (PLCC44 @ U25). Earlier revision stamped '941A01'
150150      CN4/CN5 - RCA-type network connection jacks
r242631r242632
244244      CN2/CN3 - Video output connector to external monitors
245245      CN4/CN5 - Multi-pin IDC connectors joining to main board CN15/CN16
246246
247An additional control PCB is used for Mocap Golf for the golf club sensor. It contains a ROMless MCU, an EPROM and
247An additional control PCB is used for Mocap Golf for the golf club sensor. It contains a ROMless MCU, an EPROM and
248248some other components. It will be documented at a later date.
249249
250250*/
trunk/src/mame/drivers/wallc.c
r242631r242632
6464
6565   required_device<cpu_device> m_maincpu;
6666   required_device<gfxdecode_device> m_gfxdecode;
67   
67
6868   required_shared_ptr<UINT8> m_videoram;
69   
69
7070   tilemap_t *m_bg_tilemap;
71   
71
7272   DECLARE_WRITE8_MEMBER(wallc_videoram_w);
7373   DECLARE_WRITE8_MEMBER(wallc_coin_counter_w);
7474   DECLARE_DRIVER_INIT(wallc);
trunk/src/mame/drivers/yunsun16.c
r242631r242632
634634   MCFG_CPU_ADD("maincpu", M68000, XTAL_16MHz)
635635   MCFG_CPU_PROGRAM_MAP(main_map)
636636   MCFG_CPU_VBLANK_INT_DRIVER("screen", yunsun16_state,  irq2_line_hold)
637   
637
638638   MCFG_MACHINE_START_OVERRIDE(yunsun16_state, shocking)
639639   MCFG_MACHINE_RESET_OVERRIDE(yunsun16_state, shocking)
640640
r242631r242632
876876
877877   ROM_REGION( 0x080000, "oki", 0 )    /* Samples */
878878   ROM_LOAD( "u131.bin", 0x000000, 0x080000, CRC(bcf7aa12) SHA1(f7bf5258396ed0eb7e85eccf250c6d0a333a4d61) )
879   
879
880880ROM_END
881881
882882/***************************************************************************
r242631r242632
905905
906906   ROM_REGION( 0x080000, "oki", 0 )    /* Samples */
907907   ROM_LOAD( "yunsun16.131", 0x000000, 0x080000, CRC(d0a1bb8c) SHA1(10f33521bd6031ed73ee5c7be1382165925aa8f8) )
908   
908
909909ROM_END
910910
911911ROM_START( shockingk )
r242631r242632
928928
929929   ROM_REGION( 0x080000, "oki", 0 )    /* Samples */
930930   ROM_LOAD( "yunsun16.131", 0x000000, 0x080000, CRC(d0a1bb8c) SHA1(10f33521bd6031ed73ee5c7be1382165925aa8f8) )
931   
931
932932ROM_END
933933
934934
r242631r242632
960960
961961   ROM_REGION( 0x080000, "oki", 0 )    /* Samples */
962962   ROM_LOAD( "bk_u131", 0x000000, 0x080000, CRC(22cc5732) SHA1(38aefa4e543ea54e004eee428ee087121eb20905) )
963   
963
964964ROM_END
965965
966966ROM_START( bombkicka ) // marked 'Bomb Kick 98'
r242631r242632
983983
984984   ROM_REGION( 0x080000, "oki", 0 )    /* Samples */
985985   ROM_LOAD( "bk_u131", 0x000000, 0x080000, CRC(22cc5732) SHA1(38aefa4e543ea54e004eee428ee087121eb20905) )
986   
986
987987ROM_END
988988
989989/***************************************************************************
trunk/src/mame/includes/asteroid.h
r242631r242632
4343   DECLARE_WRITE8_MEMBER(asteroid_noise_reset_w);
4444   DECLARE_WRITE8_MEMBER(llander_snd_reset_w);
4545   DECLARE_WRITE8_MEMBER(llander_sounds_w);
46   
46
4747   DECLARE_CUSTOM_INPUT_MEMBER(clock_r);
48   
48
4949   INTERRUPT_GEN_MEMBER(asteroid_interrupt);
5050   INTERRUPT_GEN_MEMBER(asterock_interrupt);
5151   INTERRUPT_GEN_MEMBER(llander_interrupt);
52   
52
5353   DECLARE_DRIVER_INIT(asterock);
5454   DECLARE_DRIVER_INIT(asteroidb);
5555
trunk/src/mame/includes/bionicc.h
r242631r242632
2020      m_maincpu(*this, "maincpu"),
2121      m_gfxdecode(*this, "gfxdecode"),
2222      m_palette(*this, "palette"),
23      m_spritegen(*this, "spritegen")   
23      m_spritegen(*this, "spritegen")
2424   { }
2525
2626   /* memory pointers */
trunk/src/mame/includes/galaxold.h
r242631r242632
5252   required_device<gfxdecode_device> m_gfxdecode;
5353   required_device<screen_device> m_screen;
5454   required_device<palette_device> m_palette;
55   
55
5656   /* memory pointers */
5757   required_shared_ptr<UINT8> m_videoram;
5858   required_shared_ptr<UINT8> m_spriteram;
r242631r242632
7474   UINT8 m_color_mask;
7575   tilemap_t *m_dambustr_tilemap2;
7676   UINT8 *m_dambustr_videoram2;
77   
77
7878   void (galaxold_state::*m_modify_charcode)(UINT16 *code, UINT8 x);     /* function to call to do character banking */
7979   void (galaxold_state::*m_modify_spritecode)(UINT8 *spriteram, int*, int*, int*, int); /* function to call to do sprite banking */
8080   void (galaxold_state::*m_modify_color)(UINT8 *color);   /* function to call to do modify how the color codes map to the PROM */
r242631r242632
147147   DECLARE_WRITE8_MEMBER(dambustr_bg_split_line_w);
148148   DECLARE_WRITE8_MEMBER(dambustr_bg_color_w);
149149   DECLARE_WRITE_LINE_MEMBER(galaxold_7474_9m_2_q_callback);
150   DECLARE_WRITE_LINE_MEMBER(galaxold_7474_9m_1_callback);   
151   
150   DECLARE_WRITE_LINE_MEMBER(galaxold_7474_9m_1_callback);
151
152152   DECLARE_CUSTOM_INPUT_MEMBER(_4in1_fake_port_r);
153153   DECLARE_CUSTOM_INPUT_MEMBER(vpool_lives_r);
154154   DECLARE_CUSTOM_INPUT_MEMBER(ckongg_coinage_r);
155155   DECLARE_CUSTOM_INPUT_MEMBER(dkongjrm_coinage_r);
156   
156
157157   DECLARE_DRIVER_INIT(bullsdrtg);
158158   DECLARE_DRIVER_INIT(ladybugg);
159159   DECLARE_DRIVER_INIT(4in1);
160160   DECLARE_DRIVER_INIT(guttangt);
161161   DECLARE_DRIVER_INIT(ckonggx);
162   
162
163163   TILE_GET_INFO_MEMBER(drivfrcg_get_tile_info);
164164   TILE_GET_INFO_MEMBER(racknrol_get_tile_info);
165165   TILE_GET_INFO_MEMBER(dambustr_get_tile_info2);
166166   TILE_GET_INFO_MEMBER(get_tile_info);
167167   TILE_GET_INFO_MEMBER(rockclim_get_tile_info);
168168   TILE_GET_INFO_MEMBER(harem_get_tile_info);
169   
169
170170   DECLARE_MACHINE_RESET(galaxold);
171171   DECLARE_MACHINE_RESET(devilfsg);
172172   DECLARE_MACHINE_RESET(hunchbkg);
173   
173
174174   DECLARE_PALETTE_INIT(galaxold);
175175   DECLARE_PALETTE_INIT(rockclim);
176176   DECLARE_PALETTE_INIT(scrambold);
r242631r242632
181181   DECLARE_PALETTE_INIT(mariner);
182182   DECLARE_PALETTE_INIT(dambustr);
183183   DECLARE_PALETTE_INIT(turtles);
184   
184
185185   DECLARE_VIDEO_START(galaxold);
186186   DECLARE_VIDEO_START(drivfrcg);
187187   DECLARE_VIDEO_START(racknrol);
r242631r242632
206206   DECLARE_VIDEO_START(dambustr);
207207   DECLARE_VIDEO_START(harem);
208208   DECLARE_VIDEO_START(bagmanmc);
209   
209
210210   UINT32 screen_update_galaxold(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
211211   UINT32 screen_update_dambustr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
212   
212
213213   INTERRUPT_GEN_MEMBER(hunchbks_vh_interrupt);
214214   TIMER_CALLBACK_MEMBER(stars_blink_callback);
215215   TIMER_CALLBACK_MEMBER(stars_scroll_callback);
216216   TIMER_DEVICE_CALLBACK_MEMBER(galaxold_interrupt_timer);
217217   IRQ_CALLBACK_MEMBER(hunchbkg_irq_callback);
218   
218
219219   void state_save_register();
220220   void video_start_common();
221221   void pisces_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs);
trunk/src/mame/includes/renegade.h
r242631r242632
8484   DECLARE_WRITE8_MEMBER(adpcm_addr_w);
8585   DECLARE_WRITE8_MEMBER(adpcm_stop_w);
8686   DECLARE_WRITE_LINE_MEMBER(adpcm_int);
87   
87
8888   DECLARE_DRIVER_INIT(kuniokun);
8989   DECLARE_DRIVER_INIT(kuniokunb);
9090   DECLARE_DRIVER_INIT(renegade);
trunk/src/mame/includes/yunsun16.h
r242631r242632
2727   required_device<gfxdecode_device> m_gfxdecode;
2828   required_device<screen_device> m_screen;
2929   required_device<palette_device> m_palette;
30   
30
3131   /* memory pointers */
3232   required_shared_ptr<UINT16> m_vram_0;
3333   required_shared_ptr<UINT16> m_vram_1;
trunk/src/mame/includes/zac2650.h
r242631r242632
1919   required_device<gfxdecode_device> m_gfxdecode;
2020   required_device<screen_device> m_screen;
2121   required_device<palette_device> m_palette;
22   
22
2323   /* memory pointers */
2424   required_shared_ptr<UINT8> m_videoram;
2525   required_shared_ptr<UINT8> m_s2636_0_ram;
r242631r242632
2929   int m_CollisionBackground;
3030   int m_CollisionSprite;
3131   tilemap_t *m_bg_tilemap;
32   
32
3333   DECLARE_WRITE8_MEMBER(tinvader_sound_w);
3434   DECLARE_WRITE8_MEMBER(tinvader_videoram_w);
3535   DECLARE_READ8_MEMBER(zac_s2636_r);
trunk/src/mame/includes/zaccaria.h
r242631r242632
2020      m_spriteram(*this, "spriteram"),
2121      m_spriteram2(*this, "spriteram2"),
2222      m_dsw_port(*this, "DSW") { }
23     
24     
25   
23
24
25
2626   /* devices */
2727   required_device<cpu_device> m_maincpu;
2828   required_device<cpu_device> m_audio2;
r242631r242632
3232   required_device<tms5220_device> m_tms;
3333   required_device<gfxdecode_device> m_gfxdecode;
3434   required_device<palette_device> m_palette;
35   
35
3636   /* memory pointers */
3737   required_shared_ptr<UINT8> m_videoram;
3838   required_shared_ptr<UINT8> m_attributesram;
3939   required_shared_ptr<UINT8> m_spriteram;
4040   required_shared_ptr<UINT8> m_spriteram2;
41   
41
4242   required_ioport_array<3> m_dsw_port;
4343
4444   int m_dsw_sel;
r242631r242632
4949   int m_toggle;
5050   tilemap_t *m_bg_tilemap;
5151   UINT8 m_nmi_mask;
52   
52
5353   DECLARE_READ8_MEMBER(dsw_r);
5454   DECLARE_WRITE8_MEMBER(sound_command_w);
5555   DECLARE_WRITE8_MEMBER(sound1_command_w);
trunk/src/mame/machine/atarigen.c
r242631r242632
11991199   {
12001200      if (!m_slapstic_device)
12011201      fatalerror("Slapstic device is missing?\n");
1202   
1202
12031203      slapstic_update_bank(m_slapstic_device->slapstic_bank());
12041204   }
12051205}
trunk/src/mame/mame.lst
r242631r242632
46424642wrestwar        // (c) 1989 (8751)
46434643wrestwar2       // (c) 1989 (FD1094, decrypted)
46444644wrestwar1       // (c) 1989 (FD1094, decrypted)
4645fantzoneta      // (c) 2008 Sega / M2 (bootleg conversion)
4645fantzoneta      // (c) 2008 Sega / M2 (bootleg conversion)
46464646
46474647// System 16C
46484648fantzn2x        // (c) 2008 Sega / M2
r242631r242632
68616861sprint4a        // 008716           1977/12 [6502]
68626862nitedrvr        // 006321           1976/10 [6502]
68636863dominos         // 007305           1977/01 [6502]
6864dominos4        // 007754-007765   ??????? [6502]
6864dominos4        // 007754-007765    ??????? [6502]
68656865triplhnt        // 008422-008791    1977/04 [6800]
68666866sprint8         // ??????           1977/05 [6800]
68676867sprint8a        // ??????           1977/05 [6800]
r242631r242632
68916891sbrkoutct       // 034555-034559 proto ???? [6502]
68926892atarifb         // 033xxx           1978/10 [6502]
68936893atarifb1        // 033xxx           1978/10 [6502]
6894atarifb2      // 035330-035350   ???      [6502]
6894atarifb2        // 035330-035350    ???     [6502]
68956895orbit           // 033689-033702    1978/11 [6800]
68966896boxer           // ?????? prototype 1978    [6502]
68976897wolfpack        // ?????? prototype         [6502]
r242631r242632
92459245wiseguy         // (c) 1990 Dooyong
92469246lastday         // (c) 1990 Dooyong
92479247lastdaya        // (c) 1990 Dooyong
9248ddaydoo         // (c) 1990 Dooyong
9248ddaydoo         // (c) 1990 Dooyong
92499249gulfstrm        // (c) 1991 Dooyong
92509250gulfstrma       // (c) 1991 Dooyong
92519251gulfstrmb       // (c) 1991 Dooyong
r242631r242632
1037410374rundeep         // (c) 1988 Cream (bootleg?)
1037510375wallc           // (c) 1984 Midcoin
1037610376wallca          // (c) 1984 Midcoin
10377brkblast      // bootleg (Fadesa)
10377brkblast        // bootleg (Fadesa)
1037810378sidampkr        //
1037910379wink            // (c) 1985 Midcoin
1038010380winka           // (c) 1985 Midcoin
trunk/src/mame/video/chihiro.c
r242631r242632
546546            }
547547         }
548548         if ((d->OutputWriteMask != 0) && (d->MultiplexerControl == 0)) {
549            //o[1] = 1;
549            //o[1] = 1;
550550            if (d->OutputSelect) { // assign to output
551551               int wm = d->OutputWriteMask;
552552               for (p1 = 0; p1 < 4; p1++) {
r242631r242632
737737      t_out[2] = par_in[p1_A + 2] * par_in[p2_B + 2];
738738      t_out[3] = par_in[p1_A + 3] * par_in[p2_B + 3];
739739      break;
740   case 3: // "ADD"
740   case 3: // "ADD"
741741      t_out[0] = par_in[p1_A + 0] + par_in[p3_C + 0];
742742      t_out[1] = par_in[p1_A + 1] + par_in[p3_C + 1];
743743      t_out[2] = par_in[p1_A + 2] + par_in[p3_C + 2];
744744      t_out[3] = par_in[p1_A + 3] + par_in[p3_C + 3];
745745      break;
746   case 4: // "MAD"
746   case 4: // "MAD"
747747      t_out[0] = par_in[p1_A + 0] * par_in[p2_B + 0] + par_in[p3_C + 0];
748748      t_out[1] = par_in[p1_A + 1] * par_in[p2_B + 1] + par_in[p3_C + 1];
749749      t_out[2] = par_in[p1_A + 2] * par_in[p2_B + 2] + par_in[p3_C + 2];
750750      t_out[3] = par_in[p1_A + 3] * par_in[p2_B + 3] + par_in[p3_C + 3];
751751      break;
752   case 5: // "DP3"
752   case 5: // "DP3"
753753      t_out[0] = par_in[p1_A + 0] * par_in[p2_B + 0] + par_in[p1_A + 1] * par_in[p2_B + 1] + par_in[p1_A + 2] * par_in[p2_B + 2];
754754      t_out[1] = t_out[2] = t_out[3] = t_out[0];
755755      break;
756   case 6: // "DPH"
756   case 6: // "DPH"
757757      t_out[0] = par_in[p1_A + 0] * par_in[p2_B + 0] + par_in[p1_A + 1] * par_in[p2_B + 1] + par_in[p1_A + 2] * par_in[p2_B + 2] + par_in[p2_B + 3];
758758      t_out[1] = t_out[2] = t_out[3] = t_out[0];
759759      break;
760   case 7: // "DP4"
760   case 7: // "DP4"
761761      t_out[0] = par_in[p1_A + 0] * par_in[p2_B + 0] + par_in[p1_A + 1] * par_in[p2_B + 1] + par_in[p1_A + 2] * par_in[p2_B + 2] + par_in[p1_A + 3] * par_in[p2_B + 3];
762762      t_out[1] = t_out[2] = t_out[3] = t_out[0];
763763      break;
764   case 8: // "DST"
764   case 8: // "DST"
765765      t_out[0] = 1.0;
766766      t_out[1] = par_in[p1_A + 1] * par_in[p2_B + 1];
767767      t_out[2] = par_in[p1_A + 2];
768768      t_out[3] = par_in[p2_B + 3];
769769      break;
770   case 9: // "MIN"
770   case 9: // "MIN"
771771      t_out[0] = fmin(par_in[p1_A + 0], par_in[p2_B + 0]);
772772      t_out[1] = fmin(par_in[p1_A + 1], par_in[p2_B + 1]);
773773      t_out[2] = fmin(par_in[p1_A + 2], par_in[p2_B + 2]);
774774      t_out[3] = fmin(par_in[p1_A + 3], par_in[p2_B + 3]);
775775      break;
776   case 10: // "MAX"
776   case 10: // "MAX"
777777      t_out[0] = fmax(par_in[p1_A + 0], par_in[p2_B + 0]);
778778      t_out[1] = fmax(par_in[p1_A + 1], par_in[p2_B + 1]);
779779      t_out[2] = fmax(par_in[p1_A + 2], par_in[p2_B + 2]);
780780      t_out[3] = fmax(par_in[p1_A + 3], par_in[p2_B + 3]);
781781      break;
782   case 11: // "SLT"
782   case 11: // "SLT"
783783      t_out[0] = (par_in[p1_A + 0] < par_in[p2_B + 0]) ? 1.0 : 0;
784784      t_out[1] = (par_in[p1_A + 1] < par_in[p2_B + 1]) ? 1.0 : 0;
785785      t_out[2] = (par_in[p1_A + 2] < par_in[p2_B + 2]) ? 1.0 : 0;
786786      t_out[3] = (par_in[p1_A + 3] < par_in[p2_B + 3]) ? 1.0 : 0;
787787      break;
788   case 12: // "SGE"
788   case 12: // "SGE"
789789      t_out[0] = (par_in[p1_A + 0] >= par_in[p2_B + 0]) ? 1.0 : 0;
790790      t_out[1] = (par_in[p1_A + 1] >= par_in[p2_B + 1]) ? 1.0 : 0;
791791      t_out[2] = (par_in[p1_A + 2] >= par_in[p2_B + 2]) ? 1.0 : 0;
r242631r242632
817817      t_out[2] = par_in[p3_C + 2];
818818      t_out[3] = par_in[p3_C + 3];
819819      break;
820   case 2:   // "RCP"
820   case 2: // "RCP"
821821      t_out[0] = t_out[1] = t_out[2] = t_out[3] = 1.0 / par_in[p3_C + 0];
822822      break;
823   case 3:   // "RCC"
823   case 3: // "RCC"
824824      t_out[0] = t_out[1] = t_out[2] = t_out[3] = 1.0 / par_in[p3_C + 0]; // ?
825825      break;
826   case 4: // "RSQ"
826   case 4: // "RSQ"
827827      t_out[0] = t_out[1] = t_out[2] = t_out[3] = 1.0 / sqrt(abs(par_in[p3_C + 0]));
828828      break;
829   case 5: // "EXP"
829   case 5: // "EXP"
830830      t_out[0] = pow(2, floor(par_in[p3_C + 0]));
831831      t_out[1] = par_in[p3_C + 0] - floor(par_in[p3_C + 0]);
832832      t.f = pow(2, par_in[p3_C + 0]);
r242631r242632
834834      t_out[2] = t.f;
835835      t_out[3] = 1.0;
836836      break;
837   case 6: // "LOG"
837   case 6: // "LOG"
838838      t_out[1] = frexp(par_in[p3_C + 0], &e)*2.0; // frexp gives mantissa as 0.5....1
839839      t_out[0] = e - 1;
840840      t.f = log2(abs(par_in[p3_C + 0]));
r242631r242632
958958{
959959int xx1,yy1,xx2,yy2;
960960
961   xx1=x1;
962   xx2=x2;
963   yy1=y1;
964   yy2=y2;
965   if (xx1 == xx2) {
966      if (yy1 > yy2) {
967         int t=yy1;
968         yy1=yy2;
969         yy2=t;
970      }
971      for (int y=yy1;y <= yy2;y++)
972         *((UINT32 *)bmp.raw_pixptr(y,xx1))= -1;
973      } else if (yy1 == yy2) {
974      if (xx1 > xx2) {
975         int t=xx1;
976         xx1=xx2;
977         xx2=t;
978      }
979      for (int x=xx1;x <= xx2;x++)
980         *((UINT32 *)bmp.raw_pixptr(yy1,x))= -1;
981   }
961    xx1=x1;
962    xx2=x2;
963    yy1=y1;
964    yy2=y2;
965    if (xx1 == xx2) {
966        if (yy1 > yy2) {
967            int t=yy1;
968            yy1=yy2;
969            yy2=t;
970        }
971        for (int y=yy1;y <= yy2;y++)
972            *((UINT32 *)bmp.raw_pixptr(y,xx1))= -1;
973        } else if (yy1 == yy2) {
974        if (xx1 > xx2) {
975            int t=xx1;
976            xx1=xx2;
977            xx2=t;
978        }
979        for (int x=xx1;x <= xx2;x++)
980            *((UINT32 *)bmp.raw_pixptr(yy1,x))= -1;
981    }
982982}*/
983983
984984inline UINT32 convert_a4r4g4b4_a8r8g8b8(UINT32 a4r4g4b4)
trunk/src/mame/video/galpani2.c
r242631r242632
115115void galpani2_state::copybg15(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
116116{
117117   UINT16* ram = m_bg15 + 0x40000/2;
118   
118
119119   //int x = 0;
120120   //int y = 0;
121121
trunk/src/mame/video/segaic16.c
r242631r242632
11261126      info->tilemaps[pagenum]->set_scrolldx(0, 22);
11271127      info->tilemaps[pagenum]->set_scrolldy(0, 38);
11281128   }
1129   
1129
11301130   save_item(NAME(info->flip), which);
11311131   save_item(NAME(info->rowscroll), which);
11321132   save_item(NAME(info->colscroll), which);
trunk/src/mame/video/tigeroad.c
r242631r242632
122122   m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 2);
123123   return 0;
124124}
125
trunk/src/mame/video/tigeroad_spr.c
r242631r242632
11/*
22
3   very simple sprite scheme, used by some Capcom games and hardware cloned from them
3    very simple sprite scheme, used by some Capcom games and hardware cloned from them
44
5   bionicc.c
6   tigeroad.c
7   supduck.c
5    bionicc.c
6    tigeroad.c
7    supduck.c
88
9   it is unknown if this is handled by a custom chip, or simple logic.
10   y positions are inverted in Bionic Commando, but it seems otherwise the same as
11   Tiger Road
9    it is unknown if this is handled by a custom chip, or simple logic.
10    y positions are inverted in Bionic Commando, but it seems otherwise the same as
11    Tiger Road
1212
1313*/
1414
r242631r242632
3939   4  words per sprite
4040
4141   0  ---- ---t tttt tttt = tile number
42   
42
4343   1  ---- ---- --cc cc-- = colour
4444   1  ---- ---- ---- --x- = flip x
4545   1  ---- ---- ---- ---y = flip y
trunk/src/mame/video/zac2650.c
r242631r242632
125125
126126   m_gfxdecode->gfx(1)->set_source(m_s2636_0_ram);
127127   m_gfxdecode->gfx(2)->set_source(m_s2636_0_ram);
128   
128
129129   save_item(NAME(m_bitmap));
130130   save_item(NAME(m_spritebitmap));
131131   save_item(NAME(m_CollisionBackground));
trunk/src/mess/drivers/amaztron.c
r242631r242632
44
55  Coleco Amaze-A-Tron
66  * TMS1100 MCU, labeled MP3405(die label too)
7 
7
88  This is an electronic board game with a selection of 8 maze games,
99  most of them for 2 players. A 5x5 playing grid and four markers are
1010  required to play. Refer to the official manual for more information.
r242631r242632
4242   DECLARE_READ8_MEMBER(read_k);
4343   DECLARE_WRITE16_MEMBER(write_o);
4444   DECLARE_WRITE16_MEMBER(write_r);
45   
45
4646   void leds_update();
47   
47
4848   virtual void machine_start();
4949};
5050
r242631r242632
8585   // R6,R7: lamps
8686   output_set_lamp_value(0, data >> 6 & 1);
8787   output_set_lamp_value(1, data >> 7 & 1);
88   
88
8989   // R8,R9: select digit
9090   m_r = data;
9191   leds_update();
92   
92
9393   // R10: speaker out
9494   m_speaker->level_w(data >> 10 & 1);
9595}
r242631r242632
166166{
167167   m_r = 0;
168168   m_o = 0;
169   
169
170170   save_item(NAME(m_r));
171171   save_item(NAME(m_o));
172172}
trunk/src/mess/drivers/bitgraph.c
r242631r242632
165165static ADDRESS_MAP_START(bitgrapha_mem, AS_PROGRAM, 16, bitgraph_state)
166166   ADDRESS_MAP_UNMAP_HIGH
167167   AM_RANGE(0x000000, 0x007fff) AM_ROM
168   AM_RANGE(0x010000, 0x010001) AM_DEVREADWRITE8(ACIA0_TAG, acia6850_device, data_r, data_w, 0xff00)   // HOST
168   AM_RANGE(0x010000, 0x010001) AM_DEVREADWRITE8(ACIA0_TAG, acia6850_device, data_r, data_w, 0xff00)   // HOST
169169   AM_RANGE(0x010002, 0x010003) AM_DEVREADWRITE8(ACIA0_TAG, acia6850_device, status_r, control_w, 0xff00)
170   AM_RANGE(0x010008, 0x010009) AM_DEVREADWRITE8(ACIA1_TAG, acia6850_device, data_r, data_w, 0x00ff)   // KEYBOARD
170   AM_RANGE(0x010008, 0x010009) AM_DEVREADWRITE8(ACIA1_TAG, acia6850_device, data_r, data_w, 0x00ff)   // KEYBOARD
171171   AM_RANGE(0x01000a, 0x01000b) AM_DEVREADWRITE8(ACIA1_TAG, acia6850_device, status_r, control_w, 0x00ff)
172   AM_RANGE(0x010010, 0x010011) AM_DEVREADWRITE8(ACIA2_TAG, acia6850_device, data_r, data_w, 0x00ff)   // DEBUGGER
172   AM_RANGE(0x010010, 0x010011) AM_DEVREADWRITE8(ACIA2_TAG, acia6850_device, data_r, data_w, 0x00ff)   // DEBUGGER
173173   AM_RANGE(0x010012, 0x010013) AM_DEVREADWRITE8(ACIA2_TAG, acia6850_device, status_r, control_w, 0x00ff)
174   AM_RANGE(0x010018, 0x010019) AM_DEVREADWRITE8(ACIA3_TAG, acia6850_device, data_r, data_w, 0x00ff)   // POINTER
174   AM_RANGE(0x010018, 0x010019) AM_DEVREADWRITE8(ACIA3_TAG, acia6850_device, data_r, data_w, 0x00ff)   // POINTER
175175   AM_RANGE(0x01001a, 0x01001b) AM_DEVREADWRITE8(ACIA3_TAG, acia6850_device, status_r, control_w, 0x00ff)
176176   AM_RANGE(0x010020, 0x010027) AM_READWRITE8(adlc_r, adlc_w, 0xff00)
177   AM_RANGE(0x010028, 0x01002f) AM_READWRITE8(pia_r, pia_w, 0xff00)   // EAROM, PSG
177   AM_RANGE(0x010028, 0x01002f) AM_READWRITE8(pia_r, pia_w, 0xff00)    // EAROM, PSG
178178   AM_RANGE(0x010030, 0x010031) AM_WRITE(baud_write)
179179   AM_RANGE(0x3e0000, 0x3fffff) AM_RAM
180180ADDRESS_MAP_END
r242631r242632
182182static ADDRESS_MAP_START(bitgraphb_mem, AS_PROGRAM, 16, bitgraph_state)
183183   ADDRESS_MAP_UNMAP_HIGH
184184   AM_RANGE(0x000000, 0x007fff) AM_ROM
185   AM_RANGE(0x010000, 0x010001) AM_DEVREADWRITE8(ACIA0_TAG, acia6850_device, data_r, data_w, 0xff00)   // HOST
185   AM_RANGE(0x010000, 0x010001) AM_DEVREADWRITE8(ACIA0_TAG, acia6850_device, data_r, data_w, 0xff00)   // HOST
186186   AM_RANGE(0x010002, 0x010003) AM_DEVREADWRITE8(ACIA0_TAG, acia6850_device, status_r, control_w, 0xff00)
187   AM_RANGE(0x010008, 0x010009) AM_DEVREADWRITE8(ACIA1_TAG, acia6850_device, data_r, data_w, 0x00ff)   // KEYBOARD
187   AM_RANGE(0x010008, 0x010009) AM_DEVREADWRITE8(ACIA1_TAG, acia6850_device, data_r, data_w, 0x00ff)   // KEYBOARD
188188   AM_RANGE(0x01000a, 0x01000b) AM_DEVREADWRITE8(ACIA1_TAG, acia6850_device, status_r, control_w, 0x00ff)
189   AM_RANGE(0x010010, 0x010011) AM_DEVREADWRITE8(ACIA2_TAG, acia6850_device, data_r, data_w, 0x00ff)   // DEBUGGER
189   AM_RANGE(0x010010, 0x010011) AM_DEVREADWRITE8(ACIA2_TAG, acia6850_device, data_r, data_w, 0x00ff)   // DEBUGGER
190190   AM_RANGE(0x010012, 0x010013) AM_DEVREADWRITE8(ACIA2_TAG, acia6850_device, status_r, control_w, 0x00ff)
191191   AM_RANGE(0x01001a, 0x01001b) AM_WRITE8(misccr_write, 0x00ff)
192192   AM_RANGE(0x010020, 0x010027) AM_READWRITE8(adlc_r, adlc_w, 0xff00)
193   AM_RANGE(0x010028, 0x01002f) AM_READWRITE8(pia_r, pia_w, 0xff00)   // EAROM, PSG
193   AM_RANGE(0x010028, 0x01002f) AM_READWRITE8(pia_r, pia_w, 0xff00)    // EAROM, PSG
194194   AM_RANGE(0x010030, 0x010031) AM_WRITE(baud_write)
195//   AM_RANGE(0x010030, 0x010037) AM_READ8(ppu_read, 0x00ff)
196//   AM_RANGE(0x010038, 0x01003f) AM_WRITE8(ppu_write, 0x00ff)
195//  AM_RANGE(0x010030, 0x010037) AM_READ8(ppu_read, 0x00ff)
196//  AM_RANGE(0x010038, 0x01003f) AM_WRITE8(ppu_write, 0x00ff)
197197   AM_RANGE(0x380000, 0x3fffff) AM_RAM
198198ADDRESS_MAP_END
199199
r242631r242632
257257   m_pia_b = data;
258258
259259   switch (m_pia_b & 0x03) {
260      case 2:   m_psg->data_w(space, 0, m_pia_a); break;
261      case 3:   m_psg->address_w(space, 0, m_pia_a); break;
260      case 2: m_psg->data_w(space, 0, m_pia_a); break;
261      case 3: m_psg->address_w(space, 0, m_pia_a); break;
262262   }
263263
264264   if (BIT(m_pia_b, 3)) {
r242631r242632
302302WRITE16_MEMBER(bitgraph_state::baud_write)
303303{
304304   DBG_LOG(1,"Baud", ("%04X\n", data));
305   m_dbrgb->str_w(data & 15);      // 2 DBG
306   m_dbrga->stt_w((data >> 4) & 15);   // 1 KBD
307   m_dbrgb->stt_w((data >> 8) & 15);   // 3 PNT
308   m_dbrga->str_w((data >> 12) & 15);   // 0 HOST
305   m_dbrgb->str_w(data & 15);      // 2 DBG
306   m_dbrga->stt_w((data >> 4) & 15);   // 1 KBD
307   m_dbrgb->stt_w((data >> 8) & 15);   // 3 PNT
308   m_dbrga->str_w((data >> 12) & 15);  // 0 HOST
309309}
310310
311311WRITE_LINE_MEMBER(bitgraph_state::com8116_a_fr_w)
r242631r242632
398398
399399#ifdef UNUSED_FUNCTION
400400static ADDRESS_MAP_START(ppu_io, AS_IO, 8, bitgraph_state)
401//   AM_RANGE(0x00, 0x00) AM_READ(ppu_irq)
402//   AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1)
403//   AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(ppu_t0_r)
401//  AM_RANGE(0x00, 0x00) AM_READ(ppu_irq)
402//  AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1)
403//  AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(ppu_t0_r)
404404   AM_RANGE(MCS48_PORT_PROG, MCS48_PORT_PROG) AM_DEVWRITE("i8243", i8243_device, i8243_prog_w)
405405ADDRESS_MAP_END
406406#endif
407407
408408/*
409   p4   O: Centronics data 3..0
410   p5   O: Centronics data 7..4
411   p6   O: Centronics control
412   p7   I: Centronics status
409    p4  O: Centronics data 3..0
410    p5  O: Centronics data 7..4
411    p6  O: Centronics control
412    p7  I: Centronics status
413413*/
414414WRITE8_MEMBER(bitgraph_state::ppu_i8243_w)
415415{
r242631r242632
572572   MCFG_CPU_PROGRAM_MAP(bitgraphb_mem)
573573
574574   MCFG_FRAGMENT_ADD(bg_motherboard)
575//   MCFG_FRAGMENT_ADD(bg_ppu)
575//  MCFG_FRAGMENT_ADD(bg_ppu)
576576
577577   MCFG_DEVICE_ADD("system_clock", CLOCK, 1040)
578578   MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(bitgraph_state, system_clock_write))
trunk/src/mess/drivers/cnsector.c
r242631r242632
44
55  Parker Brothers Code Name: Sector
66  * MP0905BNL ZA0379 (die labeled 0970F-05B)
7 
7
88  This is a tabletop submarine pursuit game. A grid board and small toy
99  boats are used to remember your locations (a Paint app should be ok too).
1010  Refer to the official manual for more information, it is not a simple game.
r242631r242632
6969void cnsector_state::leds_update()
7070{
7171   UINT16 active_state[0x10];
72   
72
7373   for (int i = 0; i < 0x10; i++)
7474   {
7575      active_state[i] = 0;
76     
76
7777      for (int j = 0; j < 0x10; j++)
7878      {
7979         int di = j << 4 | i;
80         
80
8181         // turn on powered leds
8282         if (m_leds_state[i] >> j & 1)
8383            m_leds_decay[di] = LEDS_DECAY_TIME;
84         
84
8585         // determine active state
8686         int ds = (m_leds_decay[di] != 0) ? 1 : 0;
8787         active_state[i] |= (ds << j);
8888      }
8989   }
90   
90
9191   // on difference, send to output
9292   for (int i = 0; i < 0x10; i++)
9393      if (m_leds_cache[i] != active_state[i])
9494         output_set_digit_value(i, active_state[i]);
95   
95
9696   memcpy(m_leds_cache, active_state, sizeof(m_leds_cache));
9797}
9898
r242631r242632
102102   for (int i = 0; i < 0x100; i++)
103103      if (!(m_leds_state[i & 0xf] >> (i>>4) & 1) && m_leds_decay[i])
104104         m_leds_decay[i]--;
105   
105
106106   leds_update();
107107}
108108
r242631r242632
122122   for (int i = 0; i < 5; i++)
123123      if (m_o >> i & 1)
124124         k |= m_button_matrix[i]->read();
125   
125
126126   return k;
127127}
128128
r242631r242632
201201   memset(m_leds_decay, 0, sizeof(m_leds_decay));
202202
203203   m_o = 0;
204   
204
205205   // register for savestates
206206   save_item(NAME(m_leds_state));
207207   save_item(NAME(m_leds_cache));
r242631r242632
218218   MCFG_TMS1XXX_READ_K_CB(READ8(cnsector_state, read_k))
219219   MCFG_TMS1XXX_WRITE_O_CB(WRITE16(cnsector_state, write_o))
220220   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(cnsector_state, write_r))
221   
221
222222   MCFG_TIMER_DRIVER_ADD_PERIODIC("leds_decay", cnsector_state, leds_decay_tick, attotime::from_msec(10))
223223
224224   MCFG_DEFAULT_LAYOUT(layout_cnsector)
trunk/src/mess/drivers/comp4.c
r242631r242632
44
55  Milton Bradley Comp IV
66  * TMC0904NL CP0904A (die labeled 4A0970D-04A)
7 
7
88  This is small tabletop Mastermind game; a code-breaking game where the player
99  needs to find out the correct sequence of colours (numbers in our case).
1010  It is known as Logic 5 in Europe, and as Pythaligoras in Japan.
11 
11
1212  Press the R key to start, followed by a set of unique numbers and E.
1313  Refer to the official manual for more information.
1414
r242631r242632
7474      // turn on powered leds
7575      if (m_leds_state >> i & 1)
7676         m_leds_decay[i] = LEDS_DECAY_TIME;
77     
77
7878      // send to output
7979      output_set_lamp_value(i, (m_leds_decay[i] != 0) ? 1 : 0);
8080   }
r242631r242632
8686   for (int i = 0; i < 0x10; i++)
8787      if (!(m_leds_state >> i & 1) && m_leds_decay[i])
8888         m_leds_decay[i]--;
89   
89
9090   leds_update();
9191}
9292
r242631r242632
106106   for (int i = 0; i < 3; i++)
107107      if (m_o >> (i+1) & 1)
108108         k |= m_button_matrix[i]->read();
109   
109
110110   return k;
111111}
112112
r242631r242632
173173   memset(m_leds_decay, 0, sizeof(m_leds_decay));
174174
175175   m_o = 0;
176   
176
177177   // register for savestates
178178   save_item(NAME(m_leds_state));
179179   save_item(NAME(m_leds_decay));
r242631r242632
189189   MCFG_TMS1XXX_READ_K_CB(READ8(comp4_state, read_k))
190190   MCFG_TMS1XXX_WRITE_O_CB(WRITE16(comp4_state, write_o))
191191   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(comp4_state, write_r))
192   
192
193193   MCFG_TIMER_DRIVER_ADD_PERIODIC("leds_decay", comp4_state, leds_decay_tick, attotime::from_msec(10))
194194
195195   MCFG_DEFAULT_LAYOUT(layout_comp4)
trunk/src/mess/drivers/ec184x.c
r242631r242632
202202
203203static ADDRESS_MAP_START( ec1847_io, AS_IO, 8, ec184x_state )
204204   ADDRESS_MAP_UNMAP_HIGH
205//   AM_RANGE(0x0210, 0x021f) AM_RAM // internal (non-standard?) bus extender
205//  AM_RANGE(0x0210, 0x021f) AM_RAM // internal (non-standard?) bus extender
206206ADDRESS_MAP_END
207207
208208
trunk/src/mess/drivers/excali64.c
r242631r242632
101101   DECLARE_WRITE8_MEMBER(motor_w);
102102   DECLARE_MACHINE_RESET(excali64);
103103   required_device<palette_device> m_palette;
104   
104
105105private:
106106   const UINT8 *m_p_chargen;
107107   UINT8 *m_p_videoram;
r242631r242632
585585      }
586586      else
587587         gfx = m_p_chargen[(chr<<4) | ra]; // normal character
588     
588
589589      gfx ^= (x == cursor_x) ? 0xff : 0;
590590
591591      /* Display a scanline of a character */
trunk/src/mess/drivers/gamate.c
r242631r242632
22 PeT mess@utanet.at 2007, 2014
33 Peter Wilhelmsen peter.wilhelmsen@gmail.com
44 Morten Shearman Kirkegaard morten+gamate@afdelingp.dk
5 Juan Félix Mateos vectrex@hackermesh.org
5 Juan F??lix Mateos vectrex@hackermesh.org
66******************************************************************************/
77
88#include "emu.h"
r242631r242632
1818      : driver_device(mconfig, type, tag)
1919      , m_maincpu(*this, "maincpu")
2020      , m_cart(*this, "cartslot")
21//      , m_gfxdecode(*this, "gfxdecode")
21//      , m_gfxdecode(*this, "gfxdecode")
2222      , m_io_joy(*this, "JOY")
2323      , m_palette(*this, "palette")
2424      , m_bios(*this, "bios")
r242631r242632
4747
4848   struct
4949   {
50     UINT8 reg[8];
51     struct {
52       bool write;
53       bool page2; // else page1
50   UINT8 reg[8];
51   struct {
52      bool write;
53      bool page2; // else page1
5454   UINT8 ypos, xpos/*tennis*/;
55       UINT8 data[2][0x100][0x20];
56     } bitmap;
57     UINT8 x, y;
55      UINT8 data[2][0x100][0x20];
56      } bitmap;
57   UINT8 x, y;
5858      bool y_increment;
5959   } video;
6060
r242631r242632
6868
6969   required_device<cpu_device> m_maincpu;
7070   required_device<generic_slot_device> m_cart;
71//   required_device<gfxdecode_device> m_gfxdecode;
71//  required_device<gfxdecode_device> m_gfxdecode;
7272   required_ioport m_io_joy;
7373   required_device<palette_device> m_palette;
7474   required_shared_ptr<UINT8> m_bios;
r242631r242632
113113
114114WRITE8_MEMBER( gamate_state::gamate_video_w )
115115{
116  video.reg[offset]=data;
117  switch (offset) {
118  case 1: video.bitmap.write=data&0xc0; // more addressing mode
116   video.reg[offset]=data;
117   switch (offset) {
118   case 1: video.bitmap.write=data&0xc0; // more addressing mode
119119      video.y_increment=data&0x40;
120120      break;
121121   case 2: video.bitmap.xpos=data;break; // at least 7 bits
122122   case 3: video.bitmap.ypos=data;break; // at least 7 bits
123  case 4: video.bitmap.page2=data&0x80;video.x=data&0x7f;break;
124  case 5: video.y=data;break;
125  case 7:
126    if (video.bitmap.write) {
127      if (video.x<ARRAY_LENGTH(video.bitmap.data[0][0]) /*&& video.y<ARRAY_LENGTH(video.bitmap.data[0])*/)
128        video.bitmap.data[video.bitmap.page2][video.y][video.x]=data;
129      else
130        logerror("%.6f %04x video bitmap x %x invalid\n",machine().time().as_double(), m_maincpu->pc(), video.x);
131    } else {
132        video.bitmap.data[0][video.y][video.x&(ARRAY_LENGTH(video.bitmap.data[0][0])-1)]=data;
133    }
134    if (video.y_increment) video.y++;
123   case 4: video.bitmap.page2=data&0x80;video.x=data&0x7f;break;
124   case 5: video.y=data;break;
125   case 7:
126   if (video.bitmap.write) {
127      if (video.x<ARRAY_LENGTH(video.bitmap.data[0][0]) /*&& video.y<ARRAY_LENGTH(video.bitmap.data[0])*/)
128      video.bitmap.data[video.bitmap.page2][video.y][video.x]=data;
129      else
130      logerror("%.6f %04x video bitmap x %x invalid\n",machine().time().as_double(), m_maincpu->pc(), video.x);
131   } else {
132      video.bitmap.data[0][video.y][video.x&(ARRAY_LENGTH(video.bitmap.data[0][0])-1)]=data;
133   }
134   if (video.y_increment) video.y++;
135135      else video.x++;
136  }
136   }
137137}
138138
139139WRITE8_MEMBER( gamate_state::cart_bankswitchmulti_w )
r242631r242632
149149READ8_MEMBER( gamate_state::gamate_video_r )
150150{
151151   if (offset!=6) return 0;
152  UINT8 data=0;
153  if (video.bitmap.write) {
154      if (video.x<ARRAY_LENGTH(video.bitmap.data[0][0]) /*&& video.y<ARRAY_LENGTH(video.bitmap.data[0])*/)
155        data=video.bitmap.data[video.bitmap.page2][video.y][video.x];
156      else
157        logerror("%.6f video bitmap x %x invalid\n",machine().time().as_double(),video.x);
158  } else {
159    data=video.bitmap.data[0][video.y][video.x&(ARRAY_LENGTH(video.bitmap.data[0][0])-1)];
160  }
161  if (m_maincpu->pc()<0xf000)
162    logerror("%.6f video read %04x %02x\n",machine().time().as_double(),offset, data);
163  return data;
152   UINT8 data=0;
153   if (video.bitmap.write) {
154      if (video.x<ARRAY_LENGTH(video.bitmap.data[0][0]) /*&& video.y<ARRAY_LENGTH(video.bitmap.data[0])*/)
155      data=video.bitmap.data[video.bitmap.page2][video.y][video.x];
156      else
157      logerror("%.6f video bitmap x %x invalid\n",machine().time().as_double(),video.x);
158   } else {
159   data=video.bitmap.data[0][video.y][video.x&(ARRAY_LENGTH(video.bitmap.data[0][0])-1)];
160   }
161   if (m_maincpu->pc()<0xf000)
162   logerror("%.6f video read %04x %02x\n",machine().time().as_double(),offset, data);
163   return data;
164164}
165165
166166WRITE8_MEMBER( gamate_state::gamate_audio_w )
167167{
168  logerror("%.6f %04x audio write %04x %02x\n",machine().time().as_double(),m_maincpu->pc(),offset,data);
168   logerror("%.6f %04x audio write %04x %02x\n",machine().time().as_double(),m_maincpu->pc(),offset,data);
169169}
170170
171171READ8_MEMBER( gamate_state::gamate_audio_r )
172172{
173  logerror("%.6f %04x audio read %04x \n",machine().time().as_double(),m_maincpu->pc(),offset);
173   logerror("%.6f %04x audio read %04x \n",machine().time().as_double(),m_maincpu->pc(),offset);
174174   return 0;
175175}
176176
177177
178178READ8_MEMBER( gamate_state::gamate_pad_r )
179179{
180  UINT8 data=m_io_joy->read();
181  return data;
180   UINT8 data=m_io_joy->read();
181   return data;
182182}
183183
184184static ADDRESS_MAP_START( gamate_mem, AS_PROGRAM, 8, gamate_state )
185    AM_RANGE(0x0000, 0x03ff) AM_RAM
186  AM_RANGE(0x4000, 0x400d) AM_READWRITE(gamate_audio_r, gamate_audio_w)
187  AM_RANGE(0x4400, 0x4400) AM_READ(gamate_pad_r)
188  AM_RANGE(0x5000, 0x5007) AM_READWRITE(gamate_video_r, gamate_video_w)
189  AM_RANGE(0x5a00, 0x5a00) AM_READ(protection_r)
185   AM_RANGE(0x0000, 0x03ff) AM_RAM
186   AM_RANGE(0x4000, 0x400d) AM_READWRITE(gamate_audio_r, gamate_audio_w)
187   AM_RANGE(0x4400, 0x4400) AM_READ(gamate_pad_r)
188   AM_RANGE(0x5000, 0x5007) AM_READWRITE(gamate_video_r, gamate_video_w)
189   AM_RANGE(0x5a00, 0x5a00) AM_READ(protection_r)
190190
191  AM_RANGE(0x6000, 0x9fff) AM_READ_BANK("bankmulti")
192  AM_RANGE(0xa000, 0xdfff) AM_READ_BANK("bank")
191   AM_RANGE(0x6000, 0x9fff) AM_READ_BANK("bankmulti")
192   AM_RANGE(0xa000, 0xdfff) AM_READ_BANK("bank")
193193
194194   AM_RANGE(0x6000, 0x6002) AM_READWRITE(gamate_cart_protection_r, gamate_cart_protection_w)
195//   AM_RANGE(0x6000, 0xdfff) AM_READWRITE(gamate_cart_r, gamate_cart_w)
195//  AM_RANGE(0x6000, 0xdfff) AM_READWRITE(gamate_cart_r, gamate_cart_w)
196196   AM_RANGE(0x8000, 0x8000) AM_WRITE(cart_bankswitchmulti_w)
197197   AM_RANGE(0xc000, 0xc000) AM_WRITE(cart_bankswitch_w)
198198
199  AM_RANGE(0xf000, 0xffff) AM_ROM AM_SHARE("bios")
199   AM_RANGE(0xf000, 0xffff) AM_ROM AM_SHARE("bios")
200200ADDRESS_MAP_END
201201
202202
r242631r242632
215215#ifdef UNUSED_CODE
216216static const struct gfx_layout gamate_charlayout =
217217{
218        4,      /* width of object */
219        1,      /* height of object */
220        256,/* 256 characters */
221        2,      /* bits per pixel */
222        { 0,1 }, /* no bitplanes */
223        /* x offsets */
224        { 0,2,4,6 },
225        /* y offsets */
226        { 0 },
227        8*1 /* size of 1 object in bits */
218      4,      /* width of object */
219      1,      /* height of object */
220      256,/* 256 characters */
221      2,      /* bits per pixel */
222      { 0,1 }, /* no bitplanes */
223      /* x offsets */
224      { 0,2,4,6 },
225      /* y offsets */
226      { 0 },
227      8*1 /* size of 1 object in bits */
228228};
229229
230230static const unsigned short gamate_palette[4] =
r242631r242632
233233};
234234
235235static GFXDECODE_START( gamate_charlayout )
236        GFXDECODE_ENTRY( "gfx1", 0x0000, gamate_charlayout, 0, 0x100 )
236      GFXDECODE_ENTRY( "gfx1", 0x0000, gamate_charlayout, 0, 0x100 )
237237GFXDECODE_END
238238#endif
239239
240240/* palette in red, green, blue tribles */
241241static const unsigned char gamate_colors[4][3] =
242242{
243  { 255,255,255 },
244  { 0xa0, 0xa0, 0xa0 },
245  { 0x60, 0x60, 0x60 },
246  { 0, 0, 0 }
243   { 255,255,255 },
244   { 0xa0, 0xa0, 0xa0 },
245   { 0x60, 0x60, 0x60 },
246   { 0, 0, 0 }
247247};
248248
249249PALETTE_INIT_MEMBER(gamate_state, gamate)
r242631r242632
274274
275275UINT32 gamate_state::screen_update_gamate(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
276276{
277  int x, y, j;
278  for (y=0;y<152;y++) {
279    for (x=-(video.bitmap.xpos&7), j=0;x<160;x+=8, j++) {
280      UINT8 d1=video.bitmap.data[0][(y+video.bitmap.ypos)&0xff][(j+video.bitmap.xpos/8)&0x1f];
281      UINT8 d2=video.bitmap.data[1][(y+video.bitmap.ypos)&0xff][(j+video.bitmap.xpos/8)&0x1f];
282      BlitPlane(&bitmap.pix16(y, x+4), d1, d2);
283      BlitPlane(&bitmap.pix16(y, x), d1>>4, d2>>4);
284    }
285  }
286  return 0;
277   int x, y, j;
278   for (y=0;y<152;y++) {
279   for (x=-(video.bitmap.xpos&7), j=0;x<160;x+=8, j++) {
280      UINT8 d1=video.bitmap.data[0][(y+video.bitmap.ypos)&0xff][(j+video.bitmap.xpos/8)&0x1f];
281      UINT8 d2=video.bitmap.data[1][(y+video.bitmap.ypos)&0xff][(j+video.bitmap.xpos/8)&0x1f];
282      BlitPlane(&bitmap.pix16(y, x+4), d1, d2);
283      BlitPlane(&bitmap.pix16(y, x), d1>>4, d2>>4);
284   }
285   }
286   return 0;
287287}
288288
289289DRIVER_INIT_MEMBER(gamate_state,gamate)
290290{
291291   memset(&video, 0, sizeof(video));/* memset(m_ram, 0, sizeof(m_ram));*/
292   UINT8 *gfx=memregion("gfx1")->base();   for (int i=0; i<256; i++) gfx[i]=i;
292   UINT8 *gfx=memregion("gfx1")->base();   for (int i=0; i<256; i++) gfx[i]=i;
293293   timer1 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gamate_state::gamate_timer),this));
294294   timer2 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gamate_state::gamate_timer2),this));
295295}
r242631r242632
298298void gamate_state::machine_start()
299299{
300300   if (m_cart->exists()) {
301//      m_maincpu->space(AS_PROGRAM).install_read_handler(0x6000, 0x6000, READ8_DELEGATE(gamate_state, gamate_cart_protection_r));
301//      m_maincpu->space(AS_PROGRAM).install_read_handler(0x6000, 0x6000, READ8_DELEGATE(gamate_state, gamate_cart_protection_r));
302302      membank("bankmulti")->set_base(m_cart->get_rom_base());
303303      membank("bank")->set_base(m_cart->get_rom_base()+0x4000); // bankswitched games in reality no offset
304304   }
r242631r242632
355355   MCFG_SCREEN_UPDATE_DRIVER(gamate_state, screen_update_gamate)
356356   MCFG_SCREEN_PALETTE("palette")
357357
358//   MCFG_GFXDECODE_ADD("gfxdecode", "palette", gamate )
358//  MCFG_GFXDECODE_ADD("gfxdecode", "palette", gamate )
359359   MCFG_PALETTE_ADD("palette", ARRAY_LENGTH(gamate_colors))
360//   MCFG_PALETTE_INDIRECT_ENTRIES(4)
360//  MCFG_PALETTE_INDIRECT_ENTRIES(4)
361361   MCFG_PALETTE_INIT_OWNER(gamate_state, gamate)
362362   MCFG_DEFAULT_LAYOUT(layout_lcd)
363363
r242631r242632
371371ROM_START(gamate)
372372   ROM_REGION(0x10000,"maincpu", 0)
373373   ROM_LOAD("gamate_bios_umc.bin", 0xf000, 0x1000, CRC(07090415) SHA1(ea449dc607601f9a68d855ad6ab53800d2e99297) )
374 ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
374   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
375375ROM_END
376376
377377
378378/*    YEAR  NAME      PARENT  COMPAT    MACHINE   INPUT    CLASS          INIT      COMPANY    FULLNAME */
379379CONS( 19??, gamate,  0,      0,        gamate,  gamate, gamate_state, gamate, "Bit Corp", "Gamate", GAME_NO_SOUND)
380
381
trunk/src/mess/drivers/hp16500.c
r242631r242632
11/***************************************************************************
2 
3   Hewlett-Packard HP16500b Logic Analyzer
42
3    Hewlett-Packard HP16500b Logic Analyzer
4
55    MC68EC030 @ 25 MHz
66
77    WD37C65C floppy controller (NEC765 type)
r242631r242632
1616    IRQ 5 = 814a
1717    IRQ 6 = 35c8 (jump 840120)
1818    IRQ 7 = 35d4 (jump 840120)
19
19
2020****************************************************************************/
2121
2222#include "emu.h"
r242631r242632
2828   hp16500_state(const machine_config &mconfig, device_type type, const char *tag)
2929      : driver_device(mconfig, type, tag),
3030      m_maincpu(*this, "maincpu")
31    { }                                     
31      { }
3232
3333   virtual void video_start();
3434   UINT32 screen_update_hp16500(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
r242631r242632
5555
5656READ32_MEMBER(hp16500_state::vbl_state_r)
5757{
58   return 0x03000000;   // bit 0 set means the interrupt handler advances the pSOS tick counter.
58   return 0x03000000;  // bit 0 set means the interrupt handler advances the pSOS tick counter.
5959}
6060
6161WRITE32_MEMBER(hp16500_state::vbl_ack_w)
r242631r242632
7171   AM_RANGE(0x00203000, 0x00203003) AM_WRITE(vbl_ack_w)
7272   AM_RANGE(0x00209800, 0x00209803) AM_READ(vbl_state_r)
7373
74   AM_RANGE(0x0020b800, 0x0020b8ff) AM_RAM   // system ram test is really strange.
74   AM_RANGE(0x0020b800, 0x0020b8ff) AM_RAM // system ram test is really strange.
7575
7676   AM_RANGE(0x00600000, 0x0061ffff) AM_WRITE16(vram_w, 0xffffffff)
7777   AM_RANGE(0x00600000, 0x0067ffff) AM_READ8  (vram_r, 0x00ff00ff)
r242631r242632
201201ROM_END
202202
203203COMP( 1994, hp16500b, 0, 0, hp16500, hp16500, driver_device, 0,  "Hewlett Packard", "HP 16500b", GAME_NOT_WORKING|GAME_NO_SOUND)
204
trunk/src/mess/drivers/hp9k_3xx.c
r242631r242632
11// license:BSD-3-Clause
22// copyright-holders:R. Belmont
33/***************************************************************************
4 
4
55  hp9k3xx.c: preliminary driver for HP9000 300 Series (aka HP9000/3xx)
6
6
77  Currently supporting:
8
8
99  320:
1010      MC68020 CPU @ 16.67 MHz
1111      HP custom MMU
1212      MC68881 FPU
13
13
1414  330:
15     MC68020 CPU @ 16.67 MHz
16     MC68851 MMU
17     MC68881 FPU
18 
15      MC68020 CPU @ 16.67 MHz
16      MC68851 MMU
17      MC68881 FPU
18
1919  All models have an MC6840 PIT on IRQ6 clocked at 250 kHz.
20
20
2121  TODO:
2222    BBCADDR   0x420000
2323    RTC_DATA: 0x420001
r242631r242632
2727    KBDNMIST: 0x478005
2828    DMA:      0x500000
2929    FRAMEBUF: 0x560000
30
30
3131    6840:     0x5F8001/3/5/7/9, IRQ 6
32
32
3333****************************************************************************/
3434
3535#include "emu.h"
r242631r242632
8888
8989// shared mappings for all 9000/3xx systems
9090static ADDRESS_MAP_START(hp9k3xx_common, AS_PROGRAM, 32, hp9k3xx_state)
91   AM_RANGE(0x00000000, 0x0001ffff) AM_ROM AM_REGION("maincpu",0) AM_WRITENOP   // writes to 1fffc are the LED
91   AM_RANGE(0x00000000, 0x0001ffff) AM_ROM AM_REGION("maincpu",0) AM_WRITENOP  // writes to 1fffc are the LED
9292
93   AM_RANGE(0x00200000, 0x002fffff) AM_RAM AM_SHARE("vram")   // 98544 mono framebuffer
94   AM_RANGE(0x00560000, 0x00563fff) AM_ROM AM_REGION("graphics", 0x0000)   // 98544 mono ROM
93   AM_RANGE(0x00200000, 0x002fffff) AM_RAM AM_SHARE("vram")    // 98544 mono framebuffer
94   AM_RANGE(0x00560000, 0x00563fff) AM_ROM AM_REGION("graphics", 0x0000)   // 98544 mono ROM
9595
96   AM_RANGE(0x00510000, 0x00510003) AM_READWRITE(buserror_r, buserror_w)    // no "Alpha display"
97   AM_RANGE(0x00538000, 0x00538003) AM_READWRITE(buserror_r, buserror_w)   // no "Graphics"
98   AM_RANGE(0x005c0000, 0x005c0003) AM_READWRITE(buserror_r, buserror_w)   // no add-on FP coprocessor
96   AM_RANGE(0x00510000, 0x00510003) AM_READWRITE(buserror_r, buserror_w)   // no "Alpha display"
97   AM_RANGE(0x00538000, 0x00538003) AM_READWRITE(buserror_r, buserror_w)   // no "Graphics"
98   AM_RANGE(0x005c0000, 0x005c0003) AM_READWRITE(buserror_r, buserror_w)   // no add-on FP coprocessor
9999   AM_RANGE(0x005f8000, 0x005f800f) AM_DEVREADWRITE8(PTM6840_TAG, ptm6840_device, read, write, 0x00ff00ff)
100100ADDRESS_MAP_END
101101
r242631r242632
148148   MCFG_CPU_PROGRAM_MAP(hp9k320_map)
149149
150150   MCFG_DEVICE_ADD(PTM6840_TAG, PTM6840, 0)
151   MCFG_PTM6840_INTERNAL_CLOCK(250000.0f)   // from oscillator module next to the 6840
151   MCFG_PTM6840_INTERNAL_CLOCK(250000.0f)  // from oscillator module next to the 6840
152152   MCFG_PTM6840_EXTERNAL_CLOCKS(250000.0f, 250000.0f, 250000.0f)
153153
154154   MCFG_SCREEN_ADD( "screen", RASTER)
r242631r242632
164164   MCFG_CPU_PROGRAM_MAP(hp9k330_map)
165165
166166   MCFG_DEVICE_ADD(PTM6840_TAG, PTM6840, 0)
167   MCFG_PTM6840_INTERNAL_CLOCK(250000.0f)   // from oscillator module next to the 6840
167   MCFG_PTM6840_INTERNAL_CLOCK(250000.0f)  // from oscillator module next to the 6840
168168   MCFG_PTM6840_EXTERNAL_CLOCKS(250000.0f, 250000.0f, 250000.0f)
169169
170170   MCFG_SCREEN_ADD( "screen", RASTER)
r242631r242632
176176
177177ROM_START( hp9k320 )
178178   ROM_REGION( 0x20000, MAINCPU_TAG, 0 )
179   ROM_LOAD16_BYTE( "5061-6538.bin", 0x000001, 0x004000, CRC(d6aafeb1) SHA1(88c6b0b2f504303cbbac0c496c26b85458ac5d63) )
180   ROM_LOAD16_BYTE( "5061-6539.bin", 0x000000, 0x004000, CRC(a7ff104c) SHA1(c640fe68314654716bd41b04c6a7f4e560036c7e) )
181   ROM_LOAD16_BYTE( "5061-6540.bin", 0x008001, 0x004000, CRC(4f6796d6) SHA1(fd254897ac1afb8628f40ea93213f60a082c8d36) )
182   ROM_LOAD16_BYTE( "5061-6541.bin", 0x008000, 0x004000, CRC(39d32998) SHA1(6de1bda75187b0878c03c074942b807cf2924f0e) )
179   ROM_LOAD16_BYTE( "5061-6538.bin", 0x000001, 0x004000, CRC(d6aafeb1) SHA1(88c6b0b2f504303cbbac0c496c26b85458ac5d63) )
180   ROM_LOAD16_BYTE( "5061-6539.bin", 0x000000, 0x004000, CRC(a7ff104c) SHA1(c640fe68314654716bd41b04c6a7f4e560036c7e) )
181   ROM_LOAD16_BYTE( "5061-6540.bin", 0x008001, 0x004000, CRC(4f6796d6) SHA1(fd254897ac1afb8628f40ea93213f60a082c8d36) )
182   ROM_LOAD16_BYTE( "5061-6541.bin", 0x008000, 0x004000, CRC(39d32998) SHA1(6de1bda75187b0878c03c074942b807cf2924f0e) )
183183
184184   ROM_REGION( 0x4000, "graphics", ROMREGION_ERASEFF | ROMREGION_BE | ROMREGION_32BIT )
185185   ROM_LOAD16_BYTE( "98544_1818-1999.bin", 0x000001, 0x002000, CRC(8c7d6480) SHA1(d2bcfd39452c38bc652df39f84c7041cfdf6bd51) )
r242631r242632
187187
188188ROM_START( hp9k330 )
189189   ROM_REGION( 0x20000, MAINCPU_TAG, 0 )
190   ROM_LOAD16_BYTE( "1818-4416.bin", 0x000000, 0x010000, CRC(cd71e85e) SHA1(3e83a80682f733417fdc3720410e45a2cfdcf869) )
191   ROM_LOAD16_BYTE( "1818-4417.bin", 0x000001, 0x010000, CRC(374d49db) SHA1(a12cbf6c151e2f421da4571000b5dffa3ef403b3) )
190   ROM_LOAD16_BYTE( "1818-4416.bin", 0x000000, 0x010000, CRC(cd71e85e) SHA1(3e83a80682f733417fdc3720410e45a2cfdcf869) )
191   ROM_LOAD16_BYTE( "1818-4417.bin", 0x000001, 0x010000, CRC(374d49db) SHA1(a12cbf6c151e2f421da4571000b5dffa3ef403b3) )
192192
193193   ROM_REGION( 0x4000, "graphics", ROMREGION_ERASEFF | ROMREGION_BE | ROMREGION_32BIT )
194194   ROM_LOAD16_BYTE( "98544_1818-1999.bin", 0x000001, 0x002000, CRC(8c7d6480) SHA1(d2bcfd39452c38bc652df39f84c7041cfdf6bd51) )
trunk/src/mess/drivers/intv.c
r242631r242632
682682
683683TI    8S030N  1149-0360  0360.U58  32x8  Timing prom?
684684TI    8S030N  1149-0370  0370.U74  32x8  Timing prom?
685
685
686686GI    RO-3-9502-024       024.U60  2Kx10 Mask ROM+Addr Decoder, CP1600 code
687687GI    9316B-4D72         4D72.U62  2Kx8  Mask ROM, CP1600 code (upper)
688688GI    9316B-4D71         4D71.U63  2Kx8  Mask ROM, CP1600 code (lower)
r242631r242632
691691Main board also includes:
692692
693693    2  2114 DRAMS        1Kx4  Character memory
694    10 MM5290J DRAMS    16Kx10 CP1600 memory?     
694    10 MM5290J DRAMS    16Kx10 CP1600 memory?
695695    1  6502
696696    1  Mystery 40-pin chip (under heat sink)
697697       (actually a SMC CRT5027 aka TI TMS9927 CRT controller)
r242631r242632
715715
716716   ROM_REGION(0x0100,"proms",0)
717717   ROM_LOAD( "0360.u58", 0x00, 0x20, CRC(1295528a) SHA1(b35e598891f1185e02cbacb4811d2334357abd79))
718   ROM_LOAD( "0370.u74", 0x20, 0x20, CRC(19da5096) SHA1(76af50e4fd29649fc4837120c245321a8fc84cd3))   
718   ROM_LOAD( "0370.u74", 0x20, 0x20, CRC(19da5096) SHA1(76af50e4fd29649fc4837120c245321a8fc84cd3))
719719ROM_END
720720
721721DRIVER_INIT_MEMBER(intv_state,intv)
trunk/src/mess/drivers/leapster.c
r242631r242632
283283static ADDRESS_MAP_START( leapster_map, AS_PROGRAM, 32, leapster_state )
284284   AM_RANGE(0x00000000, 0x001fffff) AM_ROM AM_MIRROR(0x40000000) // pointers in the bios region seem to be to the 40xxxxxx region, either we mirror there or something (real bios?) is acutally missing
285285   AM_RANGE(0x0180D800, 0x0180D803) AM_READ(leapster_random_r)
286   AM_RANGE(0x03000000, 0x030007ff) AM_RAM // puts stack here, writes a pointer @ 0x03000000 on startup
286   AM_RANGE(0x03000000, 0x030007ff) AM_RAM // puts stack here, writes a pointer @ 0x03000000 on startup
287287   AM_RANGE(0x3c000000, 0x3c1fffff) AM_RAM // really ram, or has our code execution gone wrong?
288//   AM_RANGE(0x80000000, 0x807fffff) AM_ROMBANK("cartrom") // game ROM pointers are all to the 80xxxxxx region, so I assume it maps here - installed if a cart is present
288//  AM_RANGE(0x80000000, 0x807fffff) AM_ROMBANK("cartrom") // game ROM pointers are all to the 80xxxxxx region, so I assume it maps here - installed if a cart is present
289289ADDRESS_MAP_END
290290
291291static MACHINE_CONFIG_START( leapster, leapster_state )
r242631r242632
323323
324324DRIVER_INIT_MEMBER(leapster_state,leapster)
325325{
326
327326}
328327
329328CONS(2003,  leapster,    0,         0,  leapster,    leapster, leapster_state, leapster,    "LeapFrog",   "Leapster (Germany)",    GAME_NOT_WORKING | GAME_NO_SOUND | GAME_IS_SKELETON )
trunk/src/mess/drivers/mathmagi.c
r242631r242632
66  * TMS1100 MP1030 - MCU
77  * 2 x DS8870N - Hex LED Digit Driver
88  * 2 x DS8861N - MOS-to-LED 5-Segment Driver
9 
9
1010  This is a tabletop educational calculator. It came with plastic overlays
1111  for playing different kind of games. Refer to the manual on how to use it.
1212  In short, to start from scratch, press [SEL]. By default the device is in
1313  calculator teaching mode. If [SEL] is followed with 1-6 and then [NXT],
1414  one of the games is started.
15 
15
1616  1) Number Machine
1717  2) Countin' On
1818  3) Walk The Plank
r242631r242632
2424  TODO:
2525  - some of the led symbols are probably wrong, output PLA is unknown
2626  - microinstructions PLA is not verified
27 
27
2828***************************************************************************/
2929
3030#include "emu.h"
r242631r242632
102102         if (i >= 8)
103103            for (int j = 0; j < 8; j++)
104104               output_set_lamp_value(i*10 + j, m_o >> j & 1);
105         
105
106106         // R0-R7: 7seg leds
107107         else
108108            output_set_digit_value(i, m_o >> 1 & 0x7f);
trunk/src/mess/drivers/mc1502.c
r242631r242632
5151   key |= ioport("Y10")->read();
5252   key |= ioport("Y11")->read();
5353   key |= ioport("Y12")->read();
54//   DBG_LOG(1,"mc1502_k_s_c",("= %02X (%d) %s\n", key, m_kbd.pulsing,
55//       (key || m_kbd.pulsing) ? " will IRQ" : ""));
54//  DBG_LOG(1,"mc1502_k_s_c",("= %02X (%d) %s\n", key, m_kbd.pulsing,
55//      (key || m_kbd.pulsing) ? " will IRQ" : ""));
5656
5757   /*
5858      If a key is pressed and we're not pulsing yet, start pulsing the IRQ1;
r242631r242632
7373
7474WRITE8_MEMBER(mc1502_state::mc1502_ppi_portb_w)
7575{
76//   DBG_LOG(2,"mc1502_ppi_portb_w",("( %02X )\n", data));
76//  DBG_LOG(2,"mc1502_ppi_portb_w",("( %02X )\n", data));
7777   m_ppi_portb = data;
7878   m_pit8253->write_gate2(BIT(data, 0));
7979   mc1502_speaker_set_spkrdata(BIT(data, 1));
r242631r242632
8787// bit 3: i8251 SYNDET pin triggers NMI (default = 1 = no)
8888WRITE8_MEMBER(mc1502_state::mc1502_ppi_portc_w)
8989{
90//   DBG_LOG(2,"mc1502_ppi_portc_w",("( %02X )\n", data));
90//  DBG_LOG(2,"mc1502_ppi_portc_w",("( %02X )\n", data));
9191   m_ppi_portc = data & 15;
9292}
9393
r242631r242632
104104   data = ( data & ~0x20 ) | ( m_pit_out2 ? 0x20 : 0x00 );
105105   data = ( data & ~0x10 ) | ( (BIT(m_ppi_portb, 1) && m_pit_out2) ? 0x10 : 0x00 );
106106
107//   DBG_LOG(2,"mc1502_ppi_portc_r",("= %02X (tap_val %f t2out %d) at %s\n",
108//       data, tap_val, m_pit_out2, machine().describe_context()));
107//  DBG_LOG(2,"mc1502_ppi_portc_r",("= %02X (tap_val %f t2out %d) at %s\n",
108//      data, tap_val, m_pit_out2, machine().describe_context()));
109109   return data;
110110}
111111
r242631r242632
126126   if (m_kbd.mask & 0x0400) { key |= ioport("Y11")->read(); }
127127   if (m_kbd.mask & 0x0800) { key |= ioport("Y12")->read(); }
128128   key ^= 0xff;
129//   DBG_LOG(2,"mc1502_kppi_porta_r",("= %02X\n", key));
129//  DBG_LOG(2,"mc1502_kppi_porta_r",("= %02X\n", key));
130130   return key;
131131}
132132
r242631r242632
138138      m_kbd.mask |= 1 << 11;
139139   else
140140      m_kbd.mask &= ~(1 << 11);
141//   DBG_LOG(2,"mc1502_kppi_portb_w",("( %02X -> %04X )\n", data, m_kbd.mask));
141//  DBG_LOG(2,"mc1502_kppi_portb_w",("( %02X -> %04X )\n", data, m_kbd.mask));
142142}
143143
144144WRITE8_MEMBER(mc1502_state::mc1502_kppi_portc_w)
145145{
146146   m_kbd.mask &= ~(7 << 8);
147147   m_kbd.mask |= ((data ^ 7) & 7) << 8;
148//   DBG_LOG(2,"mc1502_kppi_portc_w",("( %02X -> %04X )\n", data, m_kbd.mask));
148//  DBG_LOG(2,"mc1502_kppi_portc_w",("( %02X -> %04X )\n", data, m_kbd.mask));
149149}
150150
151151WRITE_LINE_MEMBER(mc1502_state::mc1502_i8251_syndet)
trunk/src/mess/drivers/megadriv.c
r242631r242632
769769
770770ROM_START( megacdj )
771771   ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 )
772   ROM_DEFAULT_BIOS("v100g")   // this seems the only revision where the cursor in CD menu works, allowing to boot games
772   ROM_DEFAULT_BIOS("v100g")   // this seems the only revision where the cursor in CD menu works, allowing to boot games
773773   /* Confirmed by ElBarto */
774774   ROM_SYSTEM_BIOS(0, "v100s", "v1.00S")
775775   ROMX_LOAD( "mpr-14088h.bin", 0x000000,  0x020000, CRC(3773d5aa) SHA1(bbf729a1aaa1667b783749299e1ad932aaf5f253), ROM_BIOS(1) | ROM_GROUPWORD | ROM_REVERSE)
r242631r242632
782782   /* Confirmed by ElBarto */
783783   ROM_SYSTEM_BIOS(3, "v100o", "v1.00O")
784784   ROMX_LOAD( "epr-14088d.bin", 0x000000,  0x020000, CRC(dfa95ee9) SHA1(e13666c76fa0a2e94e2f651b26b0fd625bf55f07), ROM_BIOS(4) | ROM_GROUPWORD | ROM_REVERSE)
785   ROM_SYSTEM_BIOS(4, "v100p", "v1.00P")   // CRC: e2e70bc8 when byteswapped
785   ROM_SYSTEM_BIOS(4, "v100p", "v1.00P")   // CRC: e2e70bc8 when byteswapped
786786   ROMX_LOAD( "epr-14088e.bin", 0x000000,  0x020000, CRC(9d2da8f2) SHA1(4846f448160059a7da0215a5df12ca160f26dd69), ROM_BIOS(5) )
787787ROM_END
788788
trunk/src/mess/drivers/merlin.c
r242631r242632
44
55  Parker Bros Merlin handheld computer game
66  * TMS1100NLL MP3404A-N2 (has internal ROM)
7 
7
88  To start a game, press NEW GAME, followed by a number:
99  1: Tic-Tac-Toe
1010  2: Music Machine
r242631r242632
1212  4: Blackjack 13
1313  5: Magic Square
1414  6: Mindbender
15 
15
1616  Refer to the official manual for more information on the games.
17 
18 
17
18
1919  Other handhelds assumed to be on similar hardware:
2020  - Dr. Smith - by Tomy, released in Japan (basically a white version of Merlin,
2121    let's assume for now that the ROM contents is identical)
2222  - Master Merlin
23 
23
2424  Another sequel, called Split Second, looks like different hardware.
2525
2626
r242631r242632
7575READ8_MEMBER(merlin_state::read_k)
7676{
7777   UINT8 k = 0;
78   
78
7979   // read selected button rows
8080   for (int i = 0; i < 4; i++)
8181      if (m_o >> i & 1)
trunk/src/mess/drivers/ngen.c
r242631r242632
44
55    10-11-14 - Skeleton driver
66
7   Interrupts based on patents:
8   level 1 - SIO
9   level 3 - timer (from PIT, presumably channel 0? Patent says "channel 3")
10   level 4 - "interrupt detector" - keyboard, printer, RTC
11   level 7 - floppy/hard disk
7    Interrupts based on patents:
8    level 1 - SIO
9    level 3 - timer (from PIT, presumably channel 0? Patent says "channel 3")
10    level 4 - "interrupt detector" - keyboard, printer, RTC
11    level 7 - floppy/hard disk
1212
13   DMA channels:
14   channel 0 - communications (RS-232)
15   channel 1 - X-Bus expansion modules (except disk and graphics)
16   channel 2 - graphics?
17   channel 3 - hard disk
18   
13    DMA channels:
14    channel 0 - communications (RS-232)
15    channel 1 - X-Bus expansion modules (except disk and graphics)
16    channel 2 - graphics?
17    channel 3 - hard disk
18
1919    To get to "menu mode", press Space quickly after reset (might need good timing)
2020    The bootstrap ROM version number is displayed, along with "B,D,L,M,P,T:"
2121    You can press one of these keys for the following tests:
r242631r242632
3333    T: Type of Operating System
3434       Gives an "OS:" prompt, at which you can enter the number of the system image to
3535       load at the master workstation.
36       
36
3737    Panel Debugger:
3838    - Open/Modify RAM
3939    Enter an address (seg:off) followed by a forward-slash, the contents of this word will
4040    appear, you can enter a value to set it to, or just press Next (default: Enter) to leave
41    it as is.  It will then go on to the next word.  Pressing Return (scan code unknown
41    it as is.  It will then go on to the next word.  Pressing Return (scan code unknown
4242    currently) will return to the debugger prompt.
4343    - Open/Modify Register
4444    Enter the register only, and the contents will appear, you can leave it or alter it (you
4545    must enter all digits (eg: 0A03 if you're modifying DX) then press Return.
4646    - I/O to or from a port
47    Input: Address (segment is ignored, and not required) followed by I, a byte is read from
47    Input: Address (segment is ignored, and not required) followed by I, a byte is read from
4848    the port defined by the offset, and the byte is displayed.
4949    Output: Address followed by O, you are now prompted with an '='.  Enter the byte to send
5050    to the port, and press Return.
r242631r242632
5252    Enter an address (seg:off) followed by H.  Sets a haltpoint at the specified address.  Does
5353    not work for ROM addresses.  Only one allowed at a time.  Haltpoint info is stored at
5454    0000:01F0.  Uses a software interrupt (INT 7C), rather than INT 3.
55   
55
5656    To start or continue from the current address, enter P.
5757    To start from a specific address, enter the address (seg:off) followed by a G.
5858*/
r242631r242632
624624   MCFG_I8251_TXD_HANDLER(DEVWRITELINE("keyboard", rs232_port_device, write_txd))
625625   MCFG_RS232_PORT_ADD("keyboard", keyboard, "ngen")
626626   MCFG_RS232_RXD_HANDLER(DEVWRITELINE("videouart", i8251_device, write_rxd))
627   
627
628628   MCFG_DEVICE_ADD("refresh_clock", CLOCK, 19200*16)  // should be 19530Hz
629629   MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(ngen_state,timer_clk_out))
630630
r242631r242632
662662   ROM_REGION( 0x2000, "bios", 0)
663663   ROM_LOAD16_BYTE( "72-00414_80186_cpu.bin",  0x000000, 0x001000, CRC(e1387a03) SHA1(ddca4eba67fbf8b731a8009c14f6b40edcbc3279) )  // bootstrap ROM v8.4
664664   ROM_LOAD16_BYTE( "72-00415_80186_cpu.bin",  0x000001, 0x001000, CRC(a6dde7d9) SHA1(b4d15c1bce31460ab5b92ff43a68c15ac5485816) )
665   
665
666666   ROM_REGION( 0x1000, "disk", 0)
667667   ROM_LOAD( "72-00422_10mb_disk.bin", 0x000000, 0x001000,  CRC(f5b046b6) SHA1(b303c6f6aa40504016de9826879bc316e44389aa) )
668   
668
669669   ROM_REGION( 0x20, "disk_prom", 0)
670670   ROM_LOAD( "72-00422_10mb_disk_15d.bin", 0x000000, 0x000020,  CRC(121ee494) SHA1(9a8d3c336cc7378a71f9d48c99f88515eb236fbf) )
671671ROM_END
trunk/src/mess/drivers/simon.c
r242631r242632
33/***************************************************************************
44
55  Milton Bradley Simon
6 
6
77  Revision A hardware:
88  * TMS1000 (has internal ROM), DS75494 lamp driver
9 
9
1010  Newer revisions have a smaller 16-pin MB4850 chip instead of the TMS1000.
1111  This one has been decapped too, but we couldn't find an internal ROM.
1212  It is possibly a cost-reduced custom ASIC specifically for Simon.
13 
13
1414  Other games assumed to be on similar hardware:
1515  - Pocket Simon, but there's a chance it only exists with MB4850 chip
1616  - Super Simon (TMS1100)
r242631r242632
6161READ8_MEMBER(simon_state::read_k)
6262{
6363   UINT8 k = 0;
64   
64
6565   // read selected button rows
6666   for (int i = 0; i < 4; i++)
6767   {
r242631r242632
8282   // R7 -> 75494 IN2 -> blue lamp
8383   for (int i = 0; i < 4; i++)
8484      output_set_lamp_value(i, data >> (4 + i) & 1);
85   
85
8686   // R8 -> 75494 IN0 -> speaker
8787   m_speaker->level_w(data >> 8 & 1);
8888
trunk/src/mess/drivers/starwbc.c
r242631r242632
44
55  Kenner Star Wars - Electronic Battle Command
66  * TMS1100 MCU, labeled MP3438A
7 
7
88  This is a small tabletop space-dogfighting game. To start the game,
99  press BASIC/INTER/ADV and enter P#(number of players), then
1010  START TURN. Refer to the official manual for more information.
r242631r242632
4646   DECLARE_READ8_MEMBER(read_k);
4747   DECLARE_WRITE16_MEMBER(write_o);
4848   DECLARE_WRITE16_MEMBER(write_r);
49   
49
5050   TIMER_DEVICE_CALLBACK_MEMBER(leds_decay_tick);
5151   void leds_update();
5252   void prepare_and_update();
r242631r242632
7171void starwbc_state::leds_update()
7272{
7373   UINT16 active_state[0x10];
74   
74
7575   for (int i = 0; i < 0x10; i++)
7676   {
7777      active_state[i] = 0;
78     
78
7979      for (int j = 0; j < 0x10; j++)
8080      {
8181         int di = j << 4 | i;
82         
82
8383         // turn on powered leds
8484         if (m_leds_state[i] >> j & 1)
8585            m_leds_decay[di] = LEDS_DECAY_TIME;
86         
86
8787         // determine active state
8888         int ds = (m_leds_decay[di] != 0) ? 1 : 0;
8989         active_state[i] |= (ds << j);
9090      }
9191   }
92   
92
9393   // on difference, send to output
9494   for (int i = 0; i < 0x10; i++)
9595      if (m_leds_cache[i] != active_state[i])
9696      {
9797         output_set_digit_value(i, active_state[i]);
98         
98
9999         for (int j = 0; j < 8; j++)
100100            output_set_lamp_value(i*10 + j, active_state[i] >> j & 1);
101101      }
102   
102
103103   memcpy(m_leds_cache, active_state, sizeof(m_leds_cache));
104104}
105105
r242631r242632
109109   for (int i = 0; i < 0x100; i++)
110110      if (!(m_leds_state[i & 0xf] >> (i>>4) & 1) && m_leds_decay[i])
111111         m_leds_decay[i]--;
112   
112
113113   leds_update();
114114}
115115
r242631r242632
117117{
118118   UINT8 o = (m_o << 4 & 0xf0) | (m_o >> 4 & 0x0f);
119119   const UINT8 mask[5] = { 0x30, 0xff, 0xff, 0x7f, 0x7f };
120   
120
121121   // R0,R2,R4,R6,R8
122122   for (int i = 0; i < 5; i++)
123123      m_leds_state[i*2] = (m_r >> (i*2) & 1) ? (o & mask[i]) : 0;
r242631r242632
155155   // R0,R1,R3,R5,R7: input mux
156156   // R9: piezo speaker
157157   m_speaker->level_w(data >> 9 & 1);
158   
158
159159   m_r = data;
160160   prepare_and_update();
161161}
r242631r242632
233233
234234   m_r = 0;
235235   m_o = 0;
236   
236
237237   // register for savestates
238238   save_item(NAME(m_leds_state));
239239   save_item(NAME(m_leds_cache));
r242631r242632
253253   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(starwbc_state, write_r))
254254
255255   MCFG_TIMER_DRIVER_ADD_PERIODIC("leds_decay", starwbc_state, leds_decay_tick, attotime::from_msec(10))
256   
256
257257   MCFG_DEFAULT_LAYOUT(layout_starwbc)
258258
259259   /* no video! */
trunk/src/mess/drivers/stopthie.c
r242631r242632
44
55  Parker Brothers Stop Thief
66  * TMS0980NLL MP6101B (die labeled 0980B-01A)
7 
7
88  Stop Thief is actually a board game, the electronic device emulated here
99  (called Electronic Crime Scanner) is an accessory. To start a game, press
1010  the ON button. Otherwise, it is in test-mode where you can hear all sounds.
r242631r242632
7878void stopthief_state::leds_update()
7979{
8080   UINT16 active_state[0x10];
81   
81
8282   for (int i = 0; i < 0x10; i++)
8383   {
8484      active_state[i] = 0;
85     
85
8686      for (int j = 0; j < 0x10; j++)
8787      {
8888         int di = j << 4 | i;
89         
89
9090         // turn on powered leds
9191         if (m_leds_state[i] >> j & 1)
9292            m_leds_decay[di] = LEDS_DECAY_TIME;
93         
93
9494         // determine active state
9595         int ds = (m_power_on && m_leds_decay[di] != 0) ? 1 : 0;
9696         active_state[i] |= (ds << j);
9797      }
9898   }
99   
99
100100   // on difference, send to output
101101   for (int i = 0; i < 0x10; i++)
102102      if (m_leds_cache[i] != active_state[i])
103103         output_set_digit_value(i, active_state[i]);
104   
104
105105   memcpy(m_leds_cache, active_state, sizeof(m_leds_cache));
106106}
107107
r242631r242632
111111   for (int i = 0; i < 0x100; i++)
112112      if (!(m_leds_state[i & 0xf] >> (i>>4) & 1) && m_leds_decay[i])
113113         m_leds_decay[i]--;
114   
114
115115   leds_update();
116116}
117117
r242631r242632
145145   UINT8 o = BITSWAP8(m_o,3,5,2,1,4,0,6,7) & 0x7f;
146146   for (int i = 0; i < 3; i++)
147147      m_leds_state[i] = (data >> i & 1) ? o : 0;
148   
148
149149   leds_update();
150   
150
151151   // R3-R8: speaker on
152152   m_speaker->level_w((data & 0x1f8 && m_o & 8) ? 1 : 0);
153153}
r242631r242632
261261   MCFG_TMS1XXX_POWER_OFF_CB(WRITELINE(stopthief_state, auto_power_off))
262262
263263   MCFG_TIMER_DRIVER_ADD_PERIODIC("leds_decay", stopthief_state, leds_decay_tick, attotime::from_msec(10))
264   
264
265265   MCFG_DEFAULT_LAYOUT(layout_stopthie)
266266
267267   /* no video! */
trunk/src/mess/drivers/tandy12.c
r242631r242632
44
55  Tandy Radio Shack Computerized Arcade (1981, 1982, 1995)
66  * TMS1100 CD7282SL
7 
7
88  This handheld contains 12 minigames. It looks and plays like "Fabulous Fred"
99  by the Japanese company Mego Corp. in 1980, which in turn is a mix of Merlin
1010  and Simon. Unlike Merlin and Simon, spin-offs like these were not successful.
1111  There were releases with and without the prefix "Tandy-12", I don't know
1212  which name was more common. Also not worth noting is that it needed five
1313  batteries; 4 C-cells and a 9-volt.
14 
14
1515  Some of the games require accessories included with the toy (eg. the Baseball
1616  game is played with a board representing the playing field). To start a game,
1717  hold the [SELECT] button, then press [START] when the game button lights up.
1818  As always, refer to the official manual for more information.
19 
19
2020  See below at the input defs for a list of the games.
2121
22 
22
2323  TODO:
2424  - output PLA is not verified
2525  - microinstructions PLA is not verified
r242631r242632
7070READ8_MEMBER(tandy12_state::read_k)
7171{
7272   UINT8 k = 0;
73   
73
7474   // read selected button rows
7575   for (int i = 0; i < 5; i++)
7676      if (m_r >> (i+5) & 1)
r242631r242632
114114
115115    [purple]1     [blue]5       [l-green]9
116116    ORGAN         TAG-IT        TREASURE HUNT
117   
117
118118    [l-orange]2   [turquoise]6  [red]10
119119    SONG WRITER   ROULETTE      COMPETE
120   
120
121121    [pink]3       [yellow]7     [violet]11
122122    REPEAT        BASEBALL      FIRE AWAY
123123
r242631r242632
180180   // these are certain
181181   0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40,
182182   0x80, 0x00, 0x00, 0x00, 0x00,
183   
183
184184   // rest is unused?
185185   0x00, 0x00, 0x00,
186186   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
trunk/src/mess/drivers/ticalc1x.c
r242631r242632
33/***************************************************************************
44
55  Texas Instruments TMS1xxx/0970/0980 handheld calculators (mostly single-chip)
6 
6
77  Refer to their official manuals on how to use them.
88
9 
9
1010  TODO:
1111  - MCU clocks are unknown
1212
r242631r242632
8585void ticalc1x_state::leds_update()
8686{
8787   UINT16 active_state[0x10];
88   
88
8989   for (int i = 0; i < 0x10; i++)
9090   {
9191      active_state[i] = 0;
92     
92
9393      for (int j = 0; j < 0x10; j++)
9494      {
9595         int di = j << 4 | i;
96         
96
9797         // turn on powered leds
9898         if (m_leds_state[i] >> j & 1)
9999            m_leds_decay[di] = LEDS_DECAY_TIME;
100         
100
101101         // determine active state
102102         int ds = (m_power_on && m_leds_decay[di] != 0) ? 1 : 0;
103103         active_state[i] |= (ds << j);
104104      }
105105   }
106   
106
107107   // on difference, send to output
108108   for (int i = 0; i < 0x10; i++)
109109      if (m_leds_cache[i] != active_state[i])
110110      {
111111         output_set_digit_value(i, active_state[i]);
112         
112
113113         for (int j = 0; j < 8; j++)
114114            output_set_lamp_value(i*10 + j, active_state[i] >> j & 1);
115115      }
r242631r242632
123123   for (int i = 0; i < 0x100; i++)
124124      if (!(m_leds_state[i & 0xf] >> (i>>4) & 1) && m_leds_decay[i])
125125         m_leds_decay[i]--;
126   
126
127127   leds_update();
128128}
129129
r242631r242632
143143   for (int i = 0; i < 11; i++)
144144      if (m_r >> i & 1)
145145         m_leds_state[i] = m_o;
146   
146
147147   // exponent sign (not 100% sure this is correct)
148148   m_leds_state[11] = (m_leds_state[0] | m_leds_state[1]) ? 0x40 : 0;
149149
r242631r242632
169169   // R0-R10: input mux
170170   // R0-R10: select digit (right-to-left)
171171   m_r = data;
172   
172
173173   tisr16_leds_update();
174174}
175175
r242631r242632
233233   // note: 3rd digit is custom(not 7seg), for math symbols
234234   for (int i = 0; i < 9; i++)
235235      m_leds_state[i] = (data >> i & 1) ? m_o : 0;
236   
236
237237   // 6th digit only has A and G for =
238238   m_leds_state[3] &= 0x41;
239239
r242631r242632
272272   UINT8 o = BITSWAP8(m_o,7,5,2,1,4,0,6,3);
273273   for (int i = 0; i < 9; i++)
274274      m_leds_state[i] = (data >> i & 1) ? o : 0;
275   
275
276276   // 1st digit only has segments B,F,G,DP
277277   m_leds_state[0] &= 0xe2;
278278
trunk/src/mess/drivers/tispeak.c
r242631r242632
33/***************************************************************************
44
55  Texas Instruments Speak & Spell hardware
6 
6
77  (still need to write notes here..)
8 
8
99  Other stuff on similar hardware:
1010  - Language Tutor/Translator
1111  - Touch & Tell, but it runs on a TMS1100!
r242631r242632
134134      // schedule delayed filament-off
135135      m_filoff_timer->adjust(attotime::from_msec(FILOFF_DECAY_TIME));
136136   }
137   
137
138138   // update digit state
139139   for (int i = 0; i < 9; i++)
140140      if (m_r >> i & 1)
r242631r242632
145145   {
146146      // standard led14seg
147147      output_set_digit_value(i, m_filament_on ? m_digit_state[i] & 0x3fff : 0);
148     
148
149149      // DP(display point) and AP(apostrophe) segments as lamps
150150      output_set_lamp_value(i*10 + 0, m_digit_state[i] >> 14 & m_filament_on);
151151      output_set_lamp_value(i*10 + 1, m_digit_state[i] >> 15 & m_filament_on);
r242631r242632
233233INPUT_CHANGED_MEMBER(tispeak_state::power_button)
234234{
235235   int on = (int)(FPTR)param;
236   
236
237237   if (on && !m_power_on)
238238   {
239239      m_power_on = 1;
r242631r242632
391391   save_item(NAME(m_o));
392392   save_item(NAME(m_filament_on));
393393   save_item(NAME(m_power_on));
394   
394
395395   // init cartridge
396396   if (m_cart != NULL && m_cart->exists())
397397   {
r242631r242632
442442   /* basic machine hardware */
443443   MCFG_CPU_MODIFY("maincpu")
444444   MCFG_TMS1XXX_WRITE_O_CB(WRITE16(tispeak_state, snspell_write_o))
445   
445
446446   /* cartridge */
447447   MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "snspell")
448448   MCFG_GENERIC_EXTENSIONS("vsm")
trunk/src/mess/drivers/trs80.c
r242631r242632
55
660000-2fff ROM                 R   D0-D7
773000-37ff ROM on Model III        R   D0-D7
8     unused on Model I
8      unused on Model I
9937de      UART status             R/W D0-D7
101037df      UART data           R/W D0-D7
111137e0      interrupt latch address (lnw80 = for the realtime clock)
r242631r242632
161637e5      select disk drive 2         W
171737e7      select disk drive 3         W
181837e0-37e3 floppy motor            W   D0-D3
19     or floppy head select   W   D3
19      or floppy head select   W   D3
202037e8      send a byte to printer          W   D0-D7
212137e8      read printer status             R   D7
222237ec-37ef FDC WD179x              R/W D0-D7
r242631r242632
4242Due to the above, the only working emulated UART is for the Model 3.
4343
4444Cassette baud rates:    Model I level I - 250 baud
45       Model I level II and all clones - 500 baud
46       Model III/4 - 500 and 1500 baud selectable at boot time
47       - When it says "Cass?" press L for 500 baud, or Enter otherwise.
48       LNW-80 - 500 baud @1.77MHz and 1000 baud @4MHz.
45        Model I level II and all clones - 500 baud
46        Model III/4 - 500 and 1500 baud selectable at boot time
47        - When it says "Cass?" press L for 500 baud, or Enter otherwise.
48        LNW-80 - 500 baud @1.77MHz and 1000 baud @4MHz.
4949
5050I/O ports
5151FF:
r242631r242632
9292    - 80-8F hires graphics (optional)
9393
9494About the ht1080z - This was made for schools in Hungary. Each comes with a BASIC extension roms
95   which activated Hungarian features. To activate - start emulation - enter SYSTEM
96   Enter /12288 and the extensions will be installed and you are returned to READY.
97   The ht1080z is identical to the System 80, apart from the character rom.
98   The ht1080z2 has a modified extension rom and character generator.
95    which activated Hungarian features. To activate - start emulation - enter SYSTEM
96    Enter /12288 and the extensions will be installed and you are returned to READY.
97    The ht1080z is identical to the System 80, apart from the character rom.
98    The ht1080z2 has a modified extension rom and character generator.
9999
100100About the RTC - The time is incremented while ever the cursor is flashing. It is stored in a series
101   of bytes in the computer's work area. The bytes are in a certain order, this is:
102   seconds, minutes, hours, year, day, month. On a model 1, the seconds are stored at
103   0x4041, while on the model 4 it is 0x4217. A reboot always sets the time to zero.
101    of bytes in the computer's work area. The bytes are in a certain order, this is:
102    seconds, minutes, hours, year, day, month. On a model 1, the seconds are stored at
103    0x4041, while on the model 4 it is 0x4217. A reboot always sets the time to zero.
104104
105105Model 4 memory organisation -
106   Mode 0: ROM=0-37E7 and 37EA-3FFF; Printer=37E8-37E9; Keyboard=3800-3BFF; Video=3C00-3FFF
107   Mode 1: Keyboard and Video as above; 0-3FFF read=ROM and write=RAM
108   Mode 2: Keyboard=F400-F7FF; Video=F800-FFFF; the rest is RAM
109   Mode 3: All RAM
110   In the "maincpu" memory map, the first 64k is given to the ROM, keyboard, printer and video,
111       while the second 64k is RAM that is switched in as needed. The area from 4800-FFFF
112       is considered a "black hole", any writes to there will disappear.
113   The video is organised as 2 banks of 0x400 bytes, except in Mode 2 where it becomes contiguous.
106    Mode 0: ROM=0-37E7 and 37EA-3FFF; Printer=37E8-37E9; Keyboard=3800-3BFF; Video=3C00-3FFF
107    Mode 1: Keyboard and Video as above; 0-3FFF read=ROM and write=RAM
108    Mode 2: Keyboard=F400-F7FF; Video=F800-FFFF; the rest is RAM
109    Mode 3: All RAM
110    In the "maincpu" memory map, the first 64k is given to the ROM, keyboard, printer and video,
111        while the second 64k is RAM that is switched in as needed. The area from 4800-FFFF
112        is considered a "black hole", any writes to there will disappear.
113    The video is organised as 2 banks of 0x400 bytes, except in Mode 2 where it becomes contiguous.
114114
115115Model 4P - is the same as Model 4 except:
116   - ROM is only 0000-0FFF, while 1000-37FF is given over to RAM
117   - There is no cassette support in hardware.
116    - ROM is only 0000-0FFF, while 1000-37FF is given over to RAM
117    - There is no cassette support in hardware.
118118
119119***************************************************************************
120120
trunk/src/mess/drivers/unk3403.c
r242631r242632
33/***************************************************************************
44
55  TMS1100NLL MP3403 DBS 7836 SINGAPORE some game board with 7-segs.
6 
6
77  What old electronic game is this?
8 
8
99  some clues:
1010  - it's from 1978
1111  - Merlin is MP3404, Amaze-A-Tron is MP3405, this one is MP3403
1212  - it plays some short jingles (you need to be lucky with button mashing),
1313    jingles feel like maybe a horse racing game
14 
14
1515***************************************************************************/
1616
1717#include "emu.h"
r242631r242632
4242   DECLARE_READ8_MEMBER(read_k);
4343   DECLARE_WRITE16_MEMBER(write_o);
4444   DECLARE_WRITE16_MEMBER(write_r);
45   
45
4646   void leds_update();
47   
47
4848   virtual void machine_start();
4949};
5050
r242631r242632
7373      sprintf(dig, "\n  %X   %c   %02X",i, (m_r >> i & 1) ? 'X' : '_', leds[i]);
7474      strcat(msg, dig);
7575   }
76   
76
7777   popmessage("%s", msg);
7878}
7979
r242631r242632
8787      if (m_r >> (i + 4) & 1)
8888         k |= m_button_matrix[i]->read();
8989   }
90   
90
9191   return k;
9292}
9393
r242631r242632
9797   // R10: maybe a switch or other button row?
9898   // R9: speaker out
9999   m_speaker->level_w(data >> 9 & 1);
100   
100
101101   // others: ?
102102   m_r = data;
103103   leds_update();
r242631r242632
156156{
157157   m_r = 0;
158158   m_o = 0;
159   
159
160160   save_item(NAME(m_r));
161161   save_item(NAME(m_o));
162162}
trunk/src/mess/drivers/victor9k.c
r242631r242632
1414    TODO:
1515
1616    - keyboard
17   - expansion bus
18      - Z80 card
19      - Winchester DMA card (Xebec S1410 + Tandon TM502/TM603SE)
20      - RAM cards
21      - clock cards
17    - expansion bus
18        - Z80 card
19        - Winchester DMA card (Xebec S1410 + Tandon TM502/TM603SE)
20        - RAM cards
21        - clock cards
2222    - floppy 8048
2323    - hires graphics
2424    - brightness/contrast
trunk/src/mess/drivers/vt240.c
r242631r242632
205205   MCFG_T11_INITIAL_MODE(5 << 13)
206206
207207/*
208   MCFG_CPU_ADD("charcpu", I8085A, XTAL_16MHz / 4)
209   MCFG_CPU_PROGRAM_MAP(vt240_char_mem)
210   MCFG_CPU_IO_MAP(vt240_char_io)
211   MCFG_CPU_VBLANK_INT_DRIVER("screen", vt240_state, vt240_irq)
208    MCFG_CPU_ADD("charcpu", I8085A, XTAL_16MHz / 4)
209    MCFG_CPU_PROGRAM_MAP(vt240_char_mem)
210    MCFG_CPU_IO_MAP(vt240_char_io)
211    MCFG_CPU_VBLANK_INT_DRIVER("screen", vt240_state, vt240_irq)
212212*/
213213
214214   MCFG_SCREEN_ADD("screen", RASTER)
r242631r242632
216216   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
217217   MCFG_SCREEN_SIZE(640, 480)
218218   MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
219//   MCFG_VIDEO_START_OVERRIDE(vt240_state,vt240)
219//  MCFG_VIDEO_START_OVERRIDE(vt240_state,vt240)
220220   MCFG_SCREEN_UPDATE_DEVICE("upd7220", upd7220_device, screen_update)
221221   MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette")
222222   MCFG_GFXDECODE_ADD("gfxdecode", "palette", vt240)
r242631r242632
226226   MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(vt240_state, hgdc_draw_text)
227227
228228   MCFG_MC68681_ADD("duart", XTAL_3_6864MHz) /* 2681 duart (not 68681!) */
229//   MCFG_MC68681_IRQ_CALLBACK(WRITELINE(dectalk_state, dectalk_duart_irq_handler))
229//  MCFG_MC68681_IRQ_CALLBACK(WRITELINE(dectalk_state, dectalk_duart_irq_handler))
230230   MCFG_MC68681_A_TX_CALLBACK(DEVWRITELINE("rs232", rs232_port_device, write_txd))
231//   MCFG_MC68681_B_TX_CALLBACK(WRITELINE(dectalk_state, dectalk_duart_txa))
232//   MCFG_MC68681_INPORT_CALLBACK(READ8(dectalk_state, dectalk_duart_input))
233//   MCFG_MC68681_OUTPORT_CALLBACK(WRITE8(dectalk_state, dectalk_duart_output))
234//   MCFG_I8251_DTR_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_dtr))
235//   MCFG_I8251_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts))
231//  MCFG_MC68681_B_TX_CALLBACK(WRITELINE(dectalk_state, dectalk_duart_txa))
232//  MCFG_MC68681_INPORT_CALLBACK(READ8(dectalk_state, dectalk_duart_input))
233//  MCFG_MC68681_OUTPORT_CALLBACK(WRITE8(dectalk_state, dectalk_duart_output))
234//  MCFG_I8251_DTR_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_dtr))
235//  MCFG_I8251_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts))
236236
237237   MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "null_modem")
238238   MCFG_RS232_RXD_HANDLER(DEVWRITELINE("duart", mc68681_device, rx_a_w))
239//   MCFG_RS232_DSR_HANDLER(DEVWRITELINE("duart", mc68681_device, ipX_w))
239//  MCFG_RS232_DSR_HANDLER(DEVWRITELINE("duart", mc68681_device, ipX_w))
240240MACHINE_CONFIG_END
241241
242242static MACHINE_CONFIG_START( mc7105, vt240_state )
r242631r242632
244244
245245   // serial connection to MS7004 keyboard
246246   MCFG_DEVICE_ADD("i8251", I8251, 0)
247//   MCFG_I8251_RXRDY_HANDLER(DEVWRITELINE("pic8259", pic8259_device, ir1_w))
247//  MCFG_I8251_RXRDY_HANDLER(DEVWRITELINE("pic8259", pic8259_device, ir1_w))
248248
249249   MCFG_DEVICE_ADD("ms7004", MS7004, 0)
250250   MCFG_MS7004_TX_HANDLER(DEVWRITELINE("i8251", i8251_device, write_rxd))
trunk/src/mess/includes/victor9k.h
r242631r242632
4848#define RS232_A_TAG     "rs232a"
4949#define RS232_B_TAG     "rs232b"
5050#define SCREEN_TAG      "screen"
51#define KB_TAG         "kb"
51#define KB_TAG          "kb"
5252#define FDC_TAG         "fdc"
5353
5454class victor9k_state : public driver_device
trunk/src/mess/layout/starwbc.lay
r242631r242632
5050
5151   <view name="Internal Layout">
5252      <bounds left="0" right="165" top="0" bottom="105" />
53     
53
5454      <bezel element="static_yellow"><bounds x="3" y="17" width="10" height="83" /></bezel>
5555      <bezel element="static_black"><bounds x="4" y="18" width="8" height="81" /></bezel>
5656
r242631r242632
7575      <bezel element="text_3"><bounds x="64.5" y="4" width="8" height="8" /></bezel>
7676      <bezel element="text_4"><bounds x="84.5" y="4" width="8" height="8" /></bezel>
7777
78     
78
7979   <!-- lamp matrix -->
80     
80
8181      <bezel element="static_gray"><bounds x="17" y="17" width="83" height="83" /></bezel>
8282
8383      <bezel name="lamp20" element="lamp"><bounds x="20" y="20" width="17" height="17" /></bezel>
trunk/src/mess/machine/gamecom.c
r242631r242632
500500         UINT16 dest_addr = m_dma.dest_current & m_dma.dest_mask;
501501         UINT8 dest_adj = (3 - (m_dma.dest_x_current & 3)) << 1;
502502         UINT8 src_adj = (3 - (m_dma.source_x_current & 3)) << 1;
503         
503
504504         /* handle DMA for 1 pixel */
505505         // Get new pixel
506506         UINT8 source_pixel = (m_dma.source_bank[src_addr] >> src_adj) & 3;
trunk/src/mess/machine/ngen_kb.c
r242631r242632
216216}
217217
218218const device_type NGEN_KEYBOARD = &device_creator<ngen_keyboard_device>;
219
trunk/src/mess/machine/sms.c
r242631r242632
12991299               /* Do horizontal scaling */
13001300               for (int plot_x = plot_min_x; plot_x <= plot_max_x;)
13011301               {
1302                   for (int j = (plot_x - plot_x_group); j <= MIN(1, plot_max_x - plot_x_group); j++)
1302                  for (int j = (plot_x - plot_x_group); j <= MIN(1, plot_max_x - plot_x_group); j++)
13031303                  {
13041304                     if (sms_x + j >= vdp_bitmap.cliprect().min_x && sms_x + j + 1 <= vdp_bitmap.cliprect().max_x)
13051305                     {
r242631r242632
13661366               rgb_t   c4 = line4[plot_x];
13671367               p_bitmap[plot_x] =
13681368                  rgb_t( ( c1.r() / 6 + c2.r() / 3 + c3.r() / 3 + c4.r() / 6 ),
1369                         ( c1.g() / 6 + c2.g() / 3 + c3.g() / 3 + c4.g() / 6 ),
1370                         ( c1.b() / 6 + c2.b() / 3 + c3.b() / 3 + c4.b() / 6 ) );
1369                        ( c1.g() / 6 + c2.g() / 3 + c3.g() / 3 + c4.g() / 6 ),
1370                        ( c1.b() / 6 + c2.b() / 3 + c3.b() / 3 + c4.b() / 6 ) );
13711371            }
13721372         }
13731373      }
trunk/src/mess/machine/victor9k_fdc.c
r242631r242632
1111
1212/*
1313
14   value   error description
14    value   error description
1515
16   01      no sync pulse detected
17   02      no header track
18   03      checksum error in header
19   04      not right track
20   05      not right sector
21   06      not a data block
22   07      data checksum error
23   08      sync too long
24   99      not a system disc
16    01      no sync pulse detected
17    02      no header track
18    03      checksum error in header
19    04      not right track
20    05      not right sector
21    06      not a data block
22    07      data checksum error
23    08      sync too long
24    99      not a system disc
2525
26   11      Noise on sync
27   FF      No sync (bad or unformatted disk)
26    11      Noise on sync
27    FF      No sync (bad or unformatted disk)
2828
2929*/
3030
r242631r242632
3232
3333    TODO:
3434
35   - communication error with SCP after loading boot sector
36      - bp ff1a8
37      - patch ff1ab=c3
35    - communication error with SCP after loading boot sector
36        - bp ff1a8
37        - patch ff1ab=c3
3838    - single/double sided jumper
3939    - header sync length unknown (6 is too short)
4040    - 8048 spindle speed control
r242631r242632
6060
6161// this is exactly the same decode/encode as used in the Commodore 4040/8050 series drives
6262#define GCR_DECODE(_e, _i) \
63    ((BIT(_e, 6) << 7) | (BIT(_i, 7) << 6) | (_e & 0x33) | (BIT(_e, 2) << 3) | (_i & 0x04))
63   ((BIT(_e, 6) << 7) | (BIT(_i, 7) << 6) | (_e & 0x33) | (BIT(_e, 2) << 3) | (_i & 0x04))
6464
6565// E7 E6 I7 E5 E4 E3 E2 I2 E1 E0
6666#define GCR_ENCODE(_e, _i) \
67    ((_e & 0xc0) << 2 | (_i & 0x80) | (_e & 0x3c) << 1 | (_i & 0x04) | (_e & 0x03))
67   ((_e & 0xc0) << 2 | (_i & 0x80) | (_e & 0x3c) << 1 | (_i & 0x04) | (_e & 0x03))
6868
6969// Tandon TM-100 spindle @ 300RPM, measured TACH 12VAC 256Hz
7070// TACH = RPM / 60 * SPINDLE RATIO * MOTOR POLES
7171// 256 = 300 / 60 * 6.4 * 8
72#define SPINDLE_RATIO    6.4
73#define MOTOR_POLES      8
72#define SPINDLE_RATIO   6.4
73#define MOTOR_POLES     8
7474
7575// TODO wrong values here! motor speed is controlled by an LM2917, with help from the spindle TACH and a DAC0808 whose value is set by the SCP 8048
7676const int victor_9000_fdc_t::rpm[] = { 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 254, 255, 257, 259, 260, 262, 264, 266, 267, 269, 271, 273, 275, 276, 278, 280, 282, 284, 286, 288, 290, 291, 293, 295, 297, 299, 301, 303, 305, 307, 309, 311, 313, 315, 318, 320, 322, 324, 326, 328, 330, 333, 335, 337, 339, 342, 344, 346, 348, 351, 353, 355, 358, 360, 362, 365, 367, 370, 372, 375, 377, 380, 382, 385, 387, 390, 392, 395, 398, 400, 403, 406, 408, 411, 414, 416, 419, 422, 425, 428, 430, 433, 436, 439, 442, 445, 448, 451, 454, 457, 460, 463, 466, 469, 472, 475, 478, 482, 485, 488, 491, 494, 498, 501, 504, 508, 511, 514, 518, 521, 525, 528, 532, 535, 539, 542, 546, 550, 553, 557, 561, 564, 568, 572, 576, 579, 583, 587, 591, 595, 599, 603, 607, 611, 615, 619, 623, 627, 631, 636, 640, 644, 648, 653, 657, 661, 666, 670, 674, 679, 683, 688, 693, 697, 702, 706, 711, 716, 721, 725, 730, 735, 740, 745, 750, 755, 760, 765, 770, 775, 780, 785, 790, 796, 801, 806, 812, 817, 822, 828, 833, 839, 844, 850, 856, 861, 867, 873, 878, 884 };
trunk/src/mess/machine/victor9kb.c
r242631r242632
347347
348348#define I8021_TAG   "z3"
349349
350#define LOG       0
350#define LOG         0
351351
352352
353353
r242631r242632
433433   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') // S36
434434   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') // S56
435435   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') // S57
436   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("UNUSED S75") // unused // S75
436   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("UNUSED S75") // unused // S75
437437   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') // S76
438438
439439   PORT_START("Y2")
trunk/src/mess/mess.mak
r242631r242632
13021302   $(MESS_DRIVERS)/hp49gp.o    \
13031303   $(MESS_DRIVERS)/hp9845.o    \
13041304   $(MESS_DRIVERS)/hp9k.o      \
1305   $(MESS_DRIVERS)/hp9k_3xx.o   \
1305   $(MESS_DRIVERS)/hp9k_3xx.o  \
13061306
13071307
13081308$(MESSOBJ)/hec2hrp.a:           \
trunk/src/mess/video/apple2.c
r242631r242632
12091209               }
12101210               else
12111211               {
1212                  artifact_map_ptr = &m_hires_artifact_map[((vram_row[col + 1] & 0x80) >> 7) * 16];
1212                  artifact_map_ptr = &m_hires_artifact_map[((vram_row[col + 1] & 0x80) >> 7) * 16];
12131213               }
12141214               for (b = 0; b < 7; b++)
12151215               {
trunk/src/mess/video/maria.c
r242631r242632
44
55
66  - some history:
7    2014-12-01 Mike Saarna, Robert Tuccitto Implemented "colorburst kill" bit
8               of the MARIA CTRL register.
7    2014-12-01 Mike Saarna, Robert Tuccitto Implemented "colorburst kill" bit
8                of the MARIA CTRL register.
99    2014-10-05 Mike Saarna, Robert Tuccitto Last Line DMA value corrected
1010                to 6. GCC and Atari docs both show a difference between
1111                Other Line and Last Line as +6 at the lowest part of the
trunk/src/osd/modules/debugger/qt/debugqtdeviceswindow.c
r242631r242632
1414
1515QVariant DevicesWindowModel::data(const QModelIndex &index, int role) const
1616{
17    if(!index.isValid() || role != Qt::DisplayRole)
18        return QVariant();
17   if(!index.isValid() || role != Qt::DisplayRole)
18      return QVariant();
1919
2020   device_t *dev = static_cast<device_t *>(index.internalPointer());
2121   switch(index.column()) {
r242631r242632
4343
4444QModelIndex DevicesWindowModel::index(int row, int column, const QModelIndex &parent) const
4545{
46    if(!hasIndex(row, column, parent))
47        return QModelIndex();
46   if(!hasIndex(row, column, parent))
47      return QModelIndex();
4848
4949   device_t *target = NULL;
5050
r242631r242632
6767
6868QModelIndex DevicesWindowModel::parent(const QModelIndex &index) const
6969{
70    if(!index.isValid())
71        return QModelIndex();
70   if(!index.isValid())
71      return QModelIndex();
7272
73    device_t *dchild = static_cast<device_t *>(index.internalPointer());
73   device_t *dchild = static_cast<device_t *>(index.internalPointer());
7474   device_t *dparent = dchild->owner();
7575
7676   if(!dparent)
r242631r242632
8282      for(device_t *child = dpp->first_subdevice(); child && child != dparent; child = child->next())
8383         row++;
8484   }
85    return createIndex(row, 0, dparent);
85   return createIndex(row, 0, dparent);
8686}
8787
8888int DevicesWindowModel::rowCount(const QModelIndex &parent) const
8989{
9090   if(!parent.isValid())
9191      return 1;
92   
92
9393   device_t *dparent = static_cast<device_t *>(parent.internalPointer());
9494   int count = 0;
9595   for(device_t *child = dparent->first_subdevice(); child; child = child->next())
r242631r242632
157157void DevicesWindowQtConfig::buildFromQWidget(QWidget* widget)
158158{
159159   WindowQtConfig::buildFromQWidget(widget);
160   //   DevicesWindow* window = dynamic_cast<DevicesWindow*>(widget);
160   //  DevicesWindow* window = dynamic_cast<DevicesWindow*>(widget);
161161}
162162
163163
164164void DevicesWindowQtConfig::applyToQWidget(QWidget* widget)
165165{
166166   WindowQtConfig::applyToQWidget(widget);
167   //   DevicesWindow* window = dynamic_cast<DevicesWindow*>(widget);
167   //  DevicesWindow* window = dynamic_cast<DevicesWindow*>(widget);
168168}
169169
170170
trunk/src/osd/modules/debugger/qt/debugqtdeviceswindow.h
r242631r242632
2323   QVariant headerData(int section, Qt::Orientation orientation,
2424                  int role = Qt::DisplayRole) const;
2525   QModelIndex index(int row, int column,
26                 const QModelIndex &parent = QModelIndex()) const;
26                  const QModelIndex &parent = QModelIndex()) const;
2727   QModelIndex parent(const QModelIndex &index) const;
2828   int rowCount(const QModelIndex &parent = QModelIndex()) const;
2929   int columnCount(const QModelIndex &parent = QModelIndex()) const;
30   
30
3131private:
3232   running_machine *m_machine;
3333};
r242631r242632
4444   virtual ~DevicesWindow();
4545
4646public slots:
47    void currentRowChanged(const QModelIndex &current, const QModelIndex &previous);
48    void activated(const QModelIndex &index);
47   void currentRowChanged(const QModelIndex &current, const QModelIndex &previous);
48   void activated(const QModelIndex &index);
4949
5050private:
5151   QTreeView *m_devices_view;
trunk/src/osd/sdl/input.c
r242631r242632
19411941         machine.schedule_exit();
19421942         break;
19431943      case SDL_VIDEORESIZE:
1944          sdl_window_list->window_resize(event.resize.w, event.resize.h);
1944         sdl_window_list->window_resize(event.resize.w, event.resize.h);
19451945         break;
19461946#else
19471947      case SDL_TEXTINPUT:
trunk/src/osd/sdl/video.h
r242631r242632
7070   float               aspect;                 // computed/configured aspect ratio of the physical device
7171   int                 center_width;           // width of first physical screen for centering
7272   int                 center_height;          // height of first physical screen for centering
73   int               monitor_x;            // X position of this monitor in virtual desktop space (SDL virtual space has them all horizontally stacked, not real geometry)
73   int                 monitor_x;              // X position of this monitor in virtual desktop space (SDL virtual space has them all horizontally stacked, not real geometry)
7474};
7575
7676
trunk/src/osd/sdl/window.c
r242631r242632
101101static sdl_draw_info draw;
102102
103103struct worker_param {
104    worker_param()
105    : m_window(NULL), m_list(NULL), m_machine(NULL), m_resize_new_width(0), m_resize_new_height(0)
106    {
107    }
108    worker_param(running_machine &amachine, sdl_window_info *awindow)
109    : m_window(awindow), m_list(NULL), m_machine(&amachine), m_resize_new_width(0), m_resize_new_height(0)
110    {
111    }
112    worker_param(running_machine &amachine, sdl_window_info *awindow, render_primitive_list *alist)
113    : m_window(awindow), m_list(alist), m_machine(&amachine), m_resize_new_width(0), m_resize_new_height(0)
114    {
115    }
116    worker_param(sdl_window_info *awindow, int anew_width, int anew_height)
117    : m_window(awindow), m_list(NULL), m_machine(NULL), m_resize_new_width(anew_width), m_resize_new_height(anew_height)
118    {
119    }
120    worker_param(sdl_window_info *awindow)
121    : m_window(awindow), m_list(NULL), m_machine(NULL), m_resize_new_width(0), m_resize_new_height(0)
122    {
123    }
104   worker_param()
105   : m_window(NULL), m_list(NULL), m_machine(NULL), m_resize_new_width(0), m_resize_new_height(0)
106   {
107   }
108   worker_param(running_machine &amachine, sdl_window_info *awindow)
109   : m_window(awindow), m_list(NULL), m_machine(&amachine), m_resize_new_width(0), m_resize_new_height(0)
110   {
111   }
112   worker_param(running_machine &amachine, sdl_window_info *awindow, render_primitive_list *alist)
113   : m_window(awindow), m_list(alist), m_machine(&amachine), m_resize_new_width(0), m_resize_new_height(0)
114   {
115   }
116   worker_param(sdl_window_info *awindow, int anew_width, int anew_height)
117   : m_window(awindow), m_list(NULL), m_machine(NULL), m_resize_new_width(anew_width), m_resize_new_height(anew_height)
118   {
119   }
120   worker_param(sdl_window_info *awindow)
121   : m_window(awindow), m_list(NULL), m_machine(NULL), m_resize_new_width(0), m_resize_new_height(0)
122   {
123   }
124124   running_machine &machine() const { assert(m_machine != NULL); return *m_machine; }
125125   sdl_window_info *window() const { assert(m_window != NULL); return m_window; }
126    render_primitive_list *list() const { return m_list; }
126   render_primitive_list *list() const { return m_list; }
127127   int new_width() const { return m_resize_new_width; }
128    int new_height() const { return m_resize_new_height; }
129    // FIXME: only needed for window set-up which returns an error.
130    void set_window(sdl_window_info *window) { m_window = window; }
128   int new_height() const { return m_resize_new_height; }
129   // FIXME: only needed for window set-up which returns an error.
130   void set_window(sdl_window_info *window) { m_window = window; }
131131private:
132132   sdl_window_info *m_window;
133133   render_primitive_list *m_list;
r242631r242632
170170
171171INLINE void execute_sync(osd_work_callback callback, const worker_param &wp)
172172{
173    worker_param *wp_temp = (worker_param *) osd_malloc(sizeof(worker_param));
174    *wp_temp = wp;
173   worker_param *wp_temp = (worker_param *) osd_malloc(sizeof(worker_param));
174   *wp_temp = wp;
175175
176    callback((void *) wp_temp, 0);
176   callback((void *) wp_temp, 0);
177177}
178178
179179
r242631r242632
307307
308308void sdl_osd_interface::window_exit()
309309{
310    worker_param wp_dummy;
310   worker_param wp_dummy;
311311
312312   ASSERT_MAIN_THREAD();
313313
r242631r242632
319319      sdl_window_info *temp = sdl_window_list;
320320      sdl_window_list = temp->next;
321321      temp->video_window_destroy(machine());
322       // free the window itself
323       global_free(temp);
322      // free the window itself
323      global_free(temp);
324324   }
325325
326326   // if we're multithreaded, clean up the window thread
r242631r242632
495495      execute_async_wait(&sdlwindow_clear_surface_wt, worker_param(this));
496496   }
497497   else
498       execute_sync(&sdlwindow_clear_surface_wt, worker_param(this));
498      execute_sync(&sdlwindow_clear_surface_wt, worker_param(this));
499499}
500500
501501
r242631r242632
651651
652652static OSDWORK_CALLBACK( sdlwindow_update_cursor_state_wt )
653653{
654    worker_param *      wp = (worker_param *) param;
655    //sdl_window_info *   window = wp->window;
654   worker_param *      wp = (worker_param *) param;
655   //sdl_window_info *   window = wp->window;
656656
657    sdlwindow_update_cursor_state(wp->machine(), wp->window());
657   sdlwindow_update_cursor_state(wp->machine(), wp->window());
658658
659    return NULL;
659   return NULL;
660660}
661661
662662
r242631r242632
725725
726726error:
727727   window->video_window_destroy(machine);
728    // free the window itself
729    global_free(window);
728   // free the window itself
729   global_free(window);
730730   return 1;
731731}
732732
r242631r242632
946946   // adjust the cursor state
947947   //sdlwindow_update_cursor_state(machine, window);
948948
949    execute_async(&sdlwindow_update_cursor_state_wt, worker_param(machine, this));
949   execute_async(&sdlwindow_update_cursor_state_wt, worker_param(machine, this));
950950
951951   // if we're visible and running and not in the middle of a resize, draw
952952   if (target != NULL)
r242631r242632
979979
980980      if (osd_event_wait(rendered_event, event_wait_ticks))
981981      {
982            // ensure the target bounds are up-to-date, and then get the primitives
982         // ensure the target bounds are up-to-date, and then get the primitives
983983         render_primitive_list *primlist = &get_primitives(this);
984984
985985         // and redraw now
r242631r242632
10381038
10391039      // if we're allowed to switch resolutions, override with something better
10401040      if (video_config.switchres)
1041          window->pick_best_mode(&tempwidth, &tempheight);
1041         window->pick_best_mode(&tempwidth, &tempheight);
10421042   }
10431043   else if (window->windowed_width)
10441044   {
trunk/src/osd/sdl/window.h
r242631r242632
3434
3535struct sdl_window_info
3636{
37
38    sdl_window_info(running_machine *a_machine, sdl_monitor_info *a_monitor,
39            int index, const sdl_window_config *config)
40    : next(NULL), m_minwidth(0), m_minheight(0),
41      startmaximized(0),
42      rendered_event(0), target(0), primlist(NULL), dxdata(NULL),
43      width(0), height(0), blitwidth(0), blitheight(0),
44      start_viewscreen(0),
37   sdl_window_info(running_machine *a_machine, sdl_monitor_info *a_monitor,
38         int index, const sdl_window_config *config)
39   : next(NULL), m_minwidth(0), m_minheight(0),
40      startmaximized(0),
41      rendered_event(0), target(0), primlist(NULL), dxdata(NULL),
42      width(0), height(0), blitwidth(0), blitheight(0),
43      start_viewscreen(0),
4544#if (SDLMAME_SDL2)
46      sdl_window(NULL),
47      resize_width(0),
48      resize_height(0),
49      last_resize(0),
45      sdl_window(NULL),
46      resize_width(0),
47      resize_height(0),
48      last_resize(0),
5049#else
51      screen_width(0), screen_height(0),
50      screen_width(0), screen_height(0),
5251#endif
53      m_machine(a_machine), m_monitor(a_monitor), m_fullscreen(0), m_index(0)
54    {
55        m_maxwidth = config->width;
56        m_maxheight = config->height;
57        depth = config->depth;
58        refresh = config->refresh;
59        m_index = index;
52      m_machine(a_machine), m_monitor(a_monitor), m_fullscreen(0), m_index(0)
53   {
54      m_maxwidth = config->width;
55      m_maxheight = config->height;
56      depth = config->depth;
57      refresh = config->refresh;
58      m_index = index;
6059
61        //FIXME: these should be per_window in config-> or even better a bit set
62        m_fullscreen = !video_config.windowed;
63        prescale = video_config.prescale;
60      //FIXME: these should be per_window in config-> or even better a bit set
61      m_fullscreen = !video_config.windowed;
62      prescale = video_config.prescale;
6463
65        if (!m_fullscreen)
66        {
67            windowed_width = config->width;
68            windowed_height = config->height;
69        }
70    }
64      if (!m_fullscreen)
65      {
66         windowed_width = config->width;
67         windowed_height = config->height;
68      }
69   }
7170
72    void video_window_update(running_machine &machine);
73    void blit_surface_size(int window_width, int window_height);
74    void toggle_full_screen(running_machine &machine);
75    void modify_prescale(running_machine &machine, int dir);
76    void window_resize(INT32 width, INT32 height);
77    void window_clear();
71   void video_window_update(running_machine &machine);
72   void blit_surface_size(int window_width, int window_height);
73   void toggle_full_screen(running_machine &machine);
74   void modify_prescale(running_machine &machine, int dir);
75   void window_resize(INT32 width, INT32 height);
76   void window_clear();
7877
79    void video_window_destroy(running_machine &machine);
80    void pick_best_mode(int *fswidth, int *fsheight);
81    void get_min_bounds(int *window_width, int *window_height, int constrain);
82    void get_max_bounds(int *window_width, int *window_height, int constrain);
78   void video_window_destroy(running_machine &machine);
79   void pick_best_mode(int *fswidth, int *fsheight);
80   void get_min_bounds(int *window_width, int *window_height, int constrain);
81   void get_max_bounds(int *window_width, int *window_height, int constrain);
8382
84    // Pointer to next window
83   // Pointer to next window
8584   sdl_window_info *   next;
8685
8786   running_machine &machine() const { assert(m_machine != NULL); return *m_machine; }
8887   sdl_monitor_info *monitor() const { return m_monitor; }
89    int fullscreen() const { return m_fullscreen; }
90    int index() const { return m_index; }
88   int fullscreen() const { return m_fullscreen; }
89   int index() const { return m_index; }
9190
92    void set_fullscreen(int afullscreen) { m_fullscreen = afullscreen; }
91   void set_fullscreen(int afullscreen) { m_fullscreen = afullscreen; }
9392
9493   // Draw Callbacks
9594   int (*create)(sdl_window_info *window, int width, int height);
r242631r242632
149148private:
150149   void constrain_to_aspect_ratio(int *window_width, int *window_height, int adjustment);
151150
152    // Pointer to machine
153    running_machine *   m_machine;
154    // monitor info
155    sdl_monitor_info *  m_monitor;
156    int                 m_fullscreen;
157    int                 m_index;
151   // Pointer to machine
152   running_machine *   m_machine;
153   // monitor info
154   sdl_monitor_info *  m_monitor;
155   int                 m_fullscreen;
156   int                 m_index;
158157
159158};
160159
trunk/src/version.c
r242631r242632
88
99***************************************************************************/
1010
11#define BARE_BUILD_VERSION "0.156"
11#define BARE_BUILD_VERSION "0.157"
1212
1313extern const char bare_build_version[];
1414extern const char build_version[];


Previous 199869 Revisions Next


© 1997-2024 The MAME Team