Previous 199869 Revisions Next

r45045 Saturday 20th February, 2016 at 15:15:39 UTC by Felipe CorrĂȘa da Silva Sanches
[h8 cpu] fix a typo in the array length of the register names string
[/trunk]makefile
[3rdparty/rapidjson].gitignore .gitmodules .travis.yml CHANGELOG.md CMakeLists.txt RapidJSON.pc.in RapidJSONConfig.cmake.in RapidJSONConfigVersion.cmake.in appveyor.yml library.json license.txt rapidjson.autopkg readme.md readme.zh-cn.md travis-doxygen.sh
[3rdparty/rapidjson/CMakeModules]FindGTestSrc.cmake
[3rdparty/rapidjson/bin/data]glossary.json menu.json readme.txt sample.json webapp.json widget.json
[3rdparty/rapidjson/bin/draft-04]schema
[3rdparty/rapidjson/bin/encodings]utf16be.json utf16bebom.json utf16le.json utf16lebom.json utf32be.json utf32bebom.json utf32le.json utf32lebom.json utf8.json utf8bom.json
[3rdparty/rapidjson/bin/jsonchecker]fail1.json fail10.json fail11.json fail12.json fail13.json fail14.json fail15.json fail16.json fail17.json fail18.json fail19.json fail2.json fail20.json fail21.json fail22.json fail23.json fail24.json fail25.json fail26.json fail27.json fail28.json fail29.json fail3.json fail30.json fail31.json fail32.json fail33.json fail4.json fail5.json fail6.json fail7.json fail8.json fail9.json pass1.json pass2.json pass3.json readme.txt
[3rdparty/rapidjson/bin/jsonschema].gitignore .travis.yml LICENSE README.md tox.ini
[3rdparty/rapidjson/bin/jsonschema/bin]jsonschema_suite
[3rdparty/rapidjson/bin/jsonschema/remotes].DS_Store integer.json subSchemas.json
[3rdparty/rapidjson/bin/jsonschema/remotes/folder]folderInteger.json
[3rdparty/rapidjson/bin/jsonschema/tests].DS_Store
[3rdparty/rapidjson/bin/jsonschema/tests/draft3]additionalItems.json additionalProperties.json default.json dependencies.json disallow.json divisibleBy.json enum.json extends.json items.json maxItems.json maxLength.json maximum.json minItems.json minLength.json minimum.json pattern.json patternProperties.json properties.json ref.json refRemote.json required.json type.json uniqueItems.json
[3rdparty/rapidjson/bin/jsonschema/tests/draft3/optional]bignum.json format.json jsregex.json zeroTerminatedFloats.json
[3rdparty/rapidjson/bin/jsonschema/tests/draft4].DS_Store additionalItems.json additionalProperties.json allOf.json anyOf.json default.json definitions.json dependencies.json enum.json items.json maxItems.json maxLength.json maxProperties.json maximum.json minItems.json minLength.json minProperties.json minimum.json multipleOf.json not.json oneOf.json pattern.json patternProperties.json properties.json ref.json refRemote.json required.json type.json uniqueItems.json
[3rdparty/rapidjson/bin/jsonschema/tests/draft4/optional]bignum.json format.json zeroTerminatedFloats.json
[3rdparty/rapidjson/bin/types]booleans.json floats.json guids.json integers.json mixed.json nulls.json paragraphs.json readme.txt
[3rdparty/rapidjson/doc]CMakeLists.txt Doxyfile.in Doxyfile.zh-cn.in dom.md dom.zh-cn.md encoding.md encoding.zh-cn.md faq.md faq.zh-cn.md features.md features.zh-cn.md internals.md performance.md performance.zh-cn.md pointer.md pointer.zh-cn.md sax.md sax.zh-cn.md schema.md schema.zh-cn.md stream.md stream.zh-cn.md tutorial.md tutorial.zh-cn.md
[3rdparty/rapidjson/doc/diagram]architecture.dot architecture.png insituparsing.dot insituparsing.png iterative-parser-states-diagram.dot iterative-parser-states-diagram.png makefile move1.dot move1.png move2.dot move2.png move3.dot move3.png normalparsing.dot normalparsing.png simpledom.dot simpledom.png tutorial.dot tutorial.png utilityclass.dot utilityclass.png
[3rdparty/rapidjson/doc/logo]rapidjson.png rapidjson.svg
[3rdparty/rapidjson/doc/misc]DoxygenLayout.xml doxygenextra.css footer.html header.html
[3rdparty/rapidjson/example]CMakeLists.txt
[3rdparty/rapidjson/example/capitalize]capitalize.cpp
[3rdparty/rapidjson/example/condense]condense.cpp
[3rdparty/rapidjson/example/jsonx]jsonx.cpp
[3rdparty/rapidjson/example/messagereader]messagereader.cpp
[3rdparty/rapidjson/example/pretty]pretty.cpp
[3rdparty/rapidjson/example/prettyauto]prettyauto.cpp
[3rdparty/rapidjson/example/schemavalidator]schemavalidator.cpp
[3rdparty/rapidjson/example/serialize]serialize.cpp
[3rdparty/rapidjson/example/simpledom]simpledom.cpp
[3rdparty/rapidjson/example/simplereader]simplereader.cpp
[3rdparty/rapidjson/example/simplewriter]simplewriter.cpp
[3rdparty/rapidjson/example/tutorial]tutorial.cpp
[3rdparty/rapidjson/include/rapidjson]allocators.h document.h encodedstream.h encodings.h filereadstream.h filewritestream.h fwd.h istreamwrapper.h memorybuffer.h memorystream.h ostreamwrapper.h pointer.h prettywriter.h rapidjson.h reader.h schema.h stream.h stringbuffer.h writer.h
[3rdparty/rapidjson/include/rapidjson/error]en.h error.h
[3rdparty/rapidjson/include/rapidjson/internal]biginteger.h diyfp.h dtoa.h ieee754.h itoa.h meta.h pow10.h regex.h stack.h strfunc.h strtod.h swap.h
[3rdparty/rapidjson/include/rapidjson/msinttypes]inttypes.h stdint.h
[3rdparty/rapidjson/test]CMakeLists.txt
[3rdparty/rapidjson/test/perftest]CMakeLists.txt misctest.cpp perftest.cpp perftest.h platformtest.cpp rapidjsontest.cpp schematest.cpp
[3rdparty/rapidjson/test/unittest]CMakeLists.txt allocatorstest.cpp bigintegertest.cpp documenttest.cpp dtoatest.cpp encodedstreamtest.cpp encodingstest.cpp filestreamtest.cpp fwdtest.cpp istreamwrappertest.cpp itoatest.cpp jsoncheckertest.cpp namespacetest.cpp ostreamwrappertest.cpp pointertest.cpp prettywritertest.cpp readertest.cpp regextest.cpp schematest.cpp simdtest.cpp strfunctest.cpp stringbuffertest.cpp strtodtest.cpp unittest.cpp unittest.h valuetest.cpp writertest.cpp
[hash]c128_cart.xml c64_cart.xml
[scripts/src]machine.lua
[scripts/src/osd]modules.lua windows.lua
[scripts/target/mame]mess.lua
[src/devices/cpu/h8]h8.cpp
[src/devices/cpu/hphybrid]hphybrid.cpp
[src/devices/cpu/i386]i386.cpp i386.h i386op32.inc i386ops.h i386ops.inc i386priv.h
[src/devices/machine]com8116.cpp com8116.h corvushd.cpp hp_taco.cpp hp_taco.h
[src/emu/ui]auditmenu.cpp barcode.cpp cheatopt.cpp ctrlmenu.cpp custmenu.cpp dirmenu.cpp filesel.cpp mainmenu.cpp menu.cpp menu.h selgame.cpp selsoft.cpp simpleselgame.cpp swlist.cpp ui.h utils.cpp utils.h
[src/mame]arcade.lst mess.lst
[src/mame/drivers]1943.cpp 8080bw.cpp at.cpp blmbycar.cpp elecbowl.cpp fidel68k.cpp fidelz80.cpp galaxy.cpp glass.cpp goldstar.cpp hh_cop400.cpp hh_hmcs40.cpp hh_melps4.cpp hh_pic16.cpp hh_tms1k.cpp hh_ucom4.cpp hp9845.cpp kurukuru.cpp mbdtower.cpp mitchell.cpp pc9801.cpp sigmab52.cpp ticalc1x.cpp
[src/mame/includes]blmbycar.h fidelz80.h glass.h hh_tms1k.h hh_ucom4.h xbox.h
[src/mame/layout]cnfball2.lay cnsector.lay lostreas.lay mathmagi.lay zodiac.lay
[src/mame/machine]xbox.cpp
[src/mame/video]blmbycar.cpp chihiro.cpp glass.cpp
[src/osd/modules/render]drawbgfx.cpp drawbgfx.h drawdd.cpp*
[src/osd/sdl]video.h
[src/osd/windows]video.cpp video.h window.cpp winmain.cpp

trunk/hash/c128_cart.xml
r253556r253557
1212
1313-->
1414   <software name="c128diag">
15      <description>C-128 Diagnostic (v1.1)</description>
15      <description>C128 Diagnostic (v1.1)</description>
1616      <year>1987</year>
1717      <publisher>Commodore</publisher>
1818
r253556r253557
2121         <feature name="exrom" value="1" />
2222
2323         <dataarea name="roml" size="0x2000">
24            <rom name="c128diag.bin" size="0x2000" crc="584f6750" sha1="b3cfd8508b887e9c7e72ed2b0c44fe63e6b44ac4" offset="0" />
24            <rom name="c128diag.bin" size="0x2000" crc="584f6750" sha1="b3cfd8508b887e9c7e72ed2b0c44fe63e6b44ac4" offset="0x0000" />
2525         </dataarea>
2626      </part>
2727   </software>
2828
2929   <software name="c128diaga" cloneof="c128diag">
30      <description>C-128 Diagnostic (v1.4)</description>
30      <description>C128 Diagnostic</description>
3131      <year>198?</year>
3232      <publisher>Commodore</publisher>
3333
r253556r253557
4141      </part>
4242   </software>
4343
44   <software name="c128diagb" cloneof="c128diag">
45      <description>C128/C128D Diagnostic (Rev 785260)</description>
46      <year>198?</year>
47      <publisher>Commodore</publisher>
48
49      <part name="cart" interface="c64_cart">
50         <feature name="game" value="1" />
51         <feature name="exrom" value="1" />
52
53         <dataarea name="roml" size="0x4000">
54            <rom name="c128_785260.bin" size="0x2000" crc="d4a4e162" sha1="2c861c89be4e556982435d076b012362545f03ca" offset="0" />
55         </dataarea>
56      </part>
57   </software>
58
5944   <software name="c128diagdcr" cloneof="c128diag">
60      <description>C-128DCR Integral Diag 1.0</description>
45      <description>C128DCR Diagnostic</description>
6146      <year>198?</year>
6247      <publisher>Commodore</publisher>
6348
r253556r253557
8267         <feature name="exrom" value="1" />
8368
8469         <dataarea name="roml" size="0x2000">
85            <rom name="c128diag_588121.bin" size="0x2000" crc="b11107be" sha1="c7149ed420d95faa1ab2ecb4a536f5e6effd45e3" offset="0" />
70            <rom name="c128diag.bin" size="0x2000" crc="b11107be" sha1="c7149ed420d95faa1ab2ecb4a536f5e6effd45e3" offset="0" />
8671         </dataarea>
8772      </part>
8873   </software>
8974
90   <software name="c128dg40a" cloneof="c128dg40">
91      <description>C128/40 Diagnostic (Rev 789010)</description>
92      <year>198?</year>
93      <publisher>Commodore</publisher>
94      <sharedfeat name="compatibility" value="NTSC,PAL"/>
95
96      <part name="cart" interface="c64_cart">
97         <feature name="game" value="1" />
98         <feature name="exrom" value="1" />
99
100         <dataarea name="roml" size="0x2000">
101            <rom name="c128diag_789010.bin" size="0x2000" crc="3b5fcdbd" sha1="da8851745b90dfafe4e05b2bf4e8e224b553170a" offset="0" />
102         </dataarea>
103      </part>
104   </software>
105
10675   <software name="comal128" supported="no">
10776      <description>COMAL 80</description>
10877      <year>1985</year>
r253556r253557
132101         <feature name="exrom" value="1" />
133102
134103         <dataarea name="roml" size="0x2000">
135            <rom name="mach_128_v1a.bin" size="0x2000" crc="f91ed380" sha1="6f04d73fcde8b28903075e3adcd2d7ff49d2518a" offset="0" />
104            <rom name="mach_128_v1a.bin" size="0x2000" crc="f91ed380" sha1="6f04d73fcde8b28903075e3adcd2d7ff49d2518a" offset="0x0000" />
136105         </dataarea>
137106      </part>
138107
r253556r253557
154123         <feature name="exrom" value="1" />
155124
156125         <dataarea name="roml" size="0x2000">
157            <rom name="mach_128_v2a.bin" size="0x2000" crc="fc60d92e" sha1="7f487134d314b4c5158954ad057e01c0da32a468" offset="0" />
126            <rom name="mach_128_v2a.bin" size="0x2000" crc="fc60d92e" sha1="7f487134d314b4c5158954ad057e01c0da32a468" offset="0x0000" />
158127         </dataarea>
159128      </part>
160129
trunk/hash/c64_cart.xml
r253556r253557
47724772   </software>
47734773
47744774   <software name="c64diag">
4775      <description>C-64 Diagnostic (Rev 586220)</description>
4775      <description>C-64 Diagnostic r.586220</description>
47764776      <year>19??</year>
47774777      <publisher>&lt;unknown&gt;</publisher>
47784778      <part name="cart" interface="c64_cart">
r253556r253557
48444844      <description>C64 Diagnostic</description>
48454845      <year>19??</year>
48464846      <publisher>Commodore</publisher>
4847      <info name="serial" value="324528-02" />
48484847      <part name="cart" interface="c64_cart">
48494848         <feature name="exrom" value="0" />
48504849         <feature name="game" value="1" />
r253556r253557
48544853      </part>
48554854   </software>
48564855
4857   <software name="c64dia41">
4858      <description>C-64 Diagnostic (Rev 4.1.0)</description>
4859      <year>19??</year>
4860      <publisher>Commodore</publisher>
4861      <part name="cart" interface="c64_cart">
4862         <feature name="exrom" value="0" />
4863         <feature name="game" value="1" />
4864         <dataarea name="roml" size="0x2000">
4865            <rom name="commodorediagrev410.bin" size="0x2000" crc="9d1a9181" sha1="5800219da86c00e583f7100e91febe528208ec46" offset="0x0000" />
4866         </dataarea>
4867      </part>
4868   </software>
4869
48704856   <software name="calcres">
48714857      <description>Calc Result</description>
48724858      <year>1983</year>
trunk/makefile
r253556r253557
13741374
13751375shaders:
13761376   $(SILENT) $(MAKE) -C $(SRC)/osd/modules/render/bgfx rebuild
1377   
1378.PHONY: translation
1379
1380translation:
1381   $(SILENT) echo Generating mame.po
1382   $(SILENT) find src/emu/ui -iname "*.cpp" | xargs xgettext --from-code=ASCII -k_ --default-domain=mame
trunk/scripts/src/machine.lua
r253556r253557
773773
774774---------------------------------------------------
775775--
776--@src/devices/machine/hp_taco.h,MACHINES["HP_TACO"] = true
777---------------------------------------------------
778
779if (MACHINES["HP_TACO"]~=null) then
780   files {
781      MAME_DIR .. "src/devices/machine/hp_taco.cpp",
782      MAME_DIR .. "src/devices/machine/hp_taco.h",
783   }
784end
785
786---------------------------------------------------
787--
788776--@src/devices/machine/i2cmem.h,MACHINES["I2CMEM"] = true
789777---------------------------------------------------
790778
trunk/scripts/src/osd/modules.lua
r253556r253557
107107   includedirs {
108108      MAME_DIR .. "3rdparty/bgfx/include",
109109      MAME_DIR .. "3rdparty/bx/include",
110      MAME_DIR .. "3rdparty/rapidjson/include",
111110   }
112111
113112   if _OPTIONS["NO_USE_MIDI"]=="1" then
trunk/scripts/src/osd/windows.lua
r253556r253557
159159      MAME_DIR .. "src/osd/modules/render/d3d/d3dcomm.h",
160160      MAME_DIR .. "src/osd/modules/render/d3d/d3dhlsl.h",
161161      MAME_DIR .. "src/osd/modules/render/d3d/d3dintf.h",
162      MAME_DIR .. "src/osd/modules/render/drawdd.cpp",
162163      MAME_DIR .. "src/osd/modules/render/drawgdi.cpp",
163164      MAME_DIR .. "src/osd/modules/render/drawnone.cpp",
164165      MAME_DIR .. "src/osd/windows/input.cpp",
trunk/scripts/target/mame/mess.lua
r253556r253557
398398MACHINES["F3853"] = true
399399MACHINES["HD63450"] = true
400400MACHINES["HD64610"] = true
401MACHINES["HP_TACO"] = true
402401MACHINES["I2CMEM"] = true
403402MACHINES["I80130"] = true
404403MACHINES["I8089"] = true
trunk/src/devices/cpu/h8/h8.cpp
r253556r253557
281281      "e0", "e1", "e2", "e3", "e4", "e5", "e6", "e7",
282282   };
283283
284   static const char *const r32_names[88] = {
284   static const char *const r32_names[8] = {
285285      "er0", "er1", "er2", "er3", "er4", "er5", "er6", "sp",
286286   };
287287
trunk/src/devices/cpu/hphybrid/hphybrid.cpp
r253556r253557
673673                  return RIO(CURRENT_PA , addr_wo_bsc - HP_REG_R4_ADDR);
674674
675675            case HP_REG_IV_ADDR:
676                                        return m_reg_IV;
676                  // Correct?
677                  if (!BIT(m_flags , HPHYBRID_IRH_SVC_BIT) && !BIT(m_flags , HPHYBRID_IRL_SVC_BIT)) {
678                        return m_reg_IV;
679                  } else {
680                        return m_reg_IV | CURRENT_PA;
681                  }
677682
678683            case HP_REG_PA_ADDR:
679684                  return CURRENT_PA;
r253556r253557
10161021
10171022            // Do a double-indirect JSM IV,I instruction
10181023            WM(AEC_CASE_C , ++m_reg_R , m_reg_P);
1019            m_reg_P = RM(AEC_CASE_I , m_reg_IV + CURRENT_PA);
1024            m_reg_P = RM(AEC_CASE_I , RM(HP_REG_IV_ADDR));
10201025            m_reg_I = fetch();
10211026}
10221027
trunk/src/devices/cpu/i386/i386.cpp
r253556r253557
976976               //logerror("IRQ (%08x): Interrupt during V8086 task\n",m_pc);
977977               if(type & 0x08)
978978               {
979                  PUSH32SEG(m_sreg[GS].selector & 0xffff);
980                  PUSH32SEG(m_sreg[FS].selector & 0xffff);
981                  PUSH32SEG(m_sreg[DS].selector & 0xffff);
982                  PUSH32SEG(m_sreg[ES].selector & 0xffff);
979                  PUSH32(m_sreg[GS].selector & 0xffff);
980                  PUSH32(m_sreg[FS].selector & 0xffff);
981                  PUSH32(m_sreg[DS].selector & 0xffff);
982                  PUSH32(m_sreg[ES].selector & 0xffff);
983983               }
984984               else
985985               {
r253556r253557
10011001            if(type & 0x08)
10021002            {
10031003               // 32-bit gate
1004               PUSH32SEG(oldSS);
1004               PUSH32(oldSS);
10051005               PUSH32(oldESP);
10061006            }
10071007            else
r253556r253557
10631063         else
10641064         {
10651065            PUSH32(oldflags & 0x00ffffff );
1066            PUSH32SEG(m_sreg[CS].selector );
1066            PUSH32(m_sreg[CS].selector );
10671067            if(irq == 3 || irq == 4 || irq == 9 || irq_gate == 1)
10681068               PUSH32(m_eip );
10691069            else
r253556r253557
19351935
19361936               if(operand32 != 0)
19371937               {
1938                  PUSH32SEG(oldSS);
1938                  PUSH32(oldSS);
19391939                  PUSH32(oldESP);
19401940               }
19411941               else
r253556r253557
20692069      else
20702070      {
20712071         /* 32-bit operand size */
2072         PUSH32SEG(m_sreg[CS].selector );
2072         PUSH32(m_sreg[CS].selector );
20732073         PUSH32(m_eip );
20742074         m_sreg[CS].selector = selector;
20752075         m_performed_intersegment_jump = 1;
r253556r253557
25742574            }
25752575            if((desc.flags & 0x0080) == 0)
25762576            {
2577               logerror("IRET: (%08x) Return CS segment is not present.\n", m_pc);
2577               logerror("IRET: Return CS segment is not present.\n");
25782578               FAULT(FAULT_NP,newCS & ~0x03)
25792579            }
25802580            if(newEIP > desc.limit)
r253556r253557
37563756   // Family 3 (386), Model 0 (DX), Stepping 8 (D1)
37573757   REG32(EAX) = 0;
37583758   REG32(EDX) = (3 << 8) | (0 << 4) | (8);
3759   m_cpu_version = REG32(EDX);
37603759
37613760   m_CPL = 0;
37623761
r253556r253557
38303829   WRITE32(REG32(ESI), smram_state+SMRAM_ESI);
38313830   WRITE32(REG32(EDI), smram_state+SMRAM_EDI);
38323831   WRITE32(m_eip, smram_state+SMRAM_EIP);
3833   WRITE32(old_flags, smram_state+SMRAM_EFLAGS);
3832   WRITE32(old_flags, smram_state+SMRAM_EAX);
38343833   WRITE32(m_cr[3], smram_state+SMRAM_CR3);
38353834   WRITE32(old_cr0, smram_state+SMRAM_CR0);
38363835
r253556r253557
40474046   // Family 4 (486), Model 0/1 (DX), Stepping 3
40484047   REG32(EAX) = 0;
40494048   REG32(EDX) = (4 << 8) | (0 << 4) | (3);
4050   m_cpu_version = REG32(EDX);
40514049
40524050   CHANGE_PC(m_eip);
40534051}
trunk/src/devices/cpu/i386/i386.h
r253556r253557
333333   inline UINT32 DEC32(UINT32 dst);
334334   inline void PUSH16(UINT16 value);
335335   inline void PUSH32(UINT32 value);
336   inline void PUSH32SEG(UINT32 value);
337336   inline void PUSH8(UINT8 value);
338337   inline UINT8 POP8();
339338   inline UINT16 POP16();
trunk/src/devices/cpu/i386/i386op32.inc
r253556r253557
475475   }
476476   else
477477   {
478      PUSH32SEG(m_sreg[CS].selector );
478      PUSH32(m_sreg[CS].selector );
479479      PUSH32(m_eip );
480480      m_sreg[CS].selector = ptr;
481481      m_performed_intersegment_jump = 1;
r253556r253557
17171717   else
17181718      offset = (REG16(SP) - 4) & 0xffff;
17191719   if(i386_limit_check(SS,offset) == 0)
1720      PUSH32SEG(m_sreg[CS].selector );
1720      PUSH32(m_sreg[CS].selector );
17211721   else
17221722      FAULT(FAULT_SS,0)
17231723   CYCLES(CYCLES_PUSH_SREG);
r253556r253557
17311731   else
17321732      offset = (REG16(SP) - 4) & 0xffff;
17331733   if(i386_limit_check(SS,offset) == 0)
1734      PUSH32SEG(m_sreg[DS].selector );
1734      PUSH32(m_sreg[DS].selector );
17351735   else
17361736      FAULT(FAULT_SS,0)
17371737   CYCLES(CYCLES_PUSH_SREG);
r253556r253557
17451745   else
17461746      offset = (REG16(SP) - 4) & 0xffff;
17471747   if(i386_limit_check(SS,offset) == 0)
1748      PUSH32SEG(m_sreg[ES].selector );
1748      PUSH32(m_sreg[ES].selector );
17491749   else
17501750      FAULT(FAULT_SS,0)
17511751   CYCLES(CYCLES_PUSH_SREG);
r253556r253557
17591759   else
17601760      offset = (REG16(SP) - 4) & 0xffff;
17611761   if(i386_limit_check(SS,offset) == 0)
1762      PUSH32SEG(m_sreg[FS].selector );
1762      PUSH32(m_sreg[FS].selector );
17631763   else
17641764      FAULT(FAULT_SS,0)
17651765   CYCLES(CYCLES_PUSH_SREG);
r253556r253557
17731773   else
17741774      offset = (REG16(SP) - 4) & 0xffff;
17751775   if(i386_limit_check(SS,offset) == 0)
1776      PUSH32SEG(m_sreg[GS].selector );
1776      PUSH32(m_sreg[GS].selector );
17771777   else
17781778      FAULT(FAULT_SS,0)
17791779   CYCLES(CYCLES_PUSH_SREG);
r253556r253557
17871787   else
17881788      offset = (REG16(SP) - 4) & 0xffff;
17891789   if(i386_limit_check(SS,offset) == 0)
1790      PUSH32SEG(m_sreg[SS].selector );
1790      PUSH32(m_sreg[SS].selector );
17911791   else
17921792      FAULT(FAULT_SS,0)
17931793   CYCLES(CYCLES_PUSH_SREG);
r253556r253557
28452845               }
28462846               else
28472847               {
2848                  PUSH32SEG(m_sreg[CS].selector );
2848                  PUSH32(m_sreg[CS].selector );
28492849                  PUSH32(m_eip );
28502850                  m_sreg[CS].selector = selector;
28512851                  m_performed_intersegment_jump = 1;
trunk/src/devices/cpu/i386/i386ops.h
r253556r253557
297297   { 0x03,     OP_2BYTE|OP_I386,           &i386_device::i386_lsl_r16_rm16,           &i386_device::i386_lsl_r32_rm32,       false},
298298   { 0x06,     OP_2BYTE|OP_I386,           &i386_device::i386_clts,                   &i386_device::i386_clts,               false},
299299   { 0x07,     OP_2BYTE|OP_I386,           &i386_device::i386_loadall,                &i386_device::i386_loadall,            false},
300   { 0x07,     OP_2BYTE|OP_I486,           &i386_device::i386_invalid,                &i386_device::i386_invalid,            false},
301300   { 0x08,     OP_2BYTE|OP_I486,           &i386_device::i486_invd,                   &i386_device::i486_invd,               false},
302301   { 0x09,     OP_2BYTE|OP_I486,           &i386_device::i486_wbinvd,                 &i386_device::i486_wbinvd,             false},
303302   { 0x0B,     OP_2BYTE|OP_PENTIUM,        &i386_device::pentium_ud2,                 &i386_device::pentium_ud2,             false},
trunk/src/devices/cpu/i386/i386ops.inc
r253556r253557
25042504
25052505void i386_device::i386_loadall()       // Opcode 0x0f 0x07 (0x0f 0x05 on 80286), undocumented
25062506{
2507   if(PROTECTED_MODE && (m_CPL != 0))
2508      FAULT(FAULT_GP,0)
2509   UINT32 ea = i386_translate(ES, REG32(EDI), 0);
2510   m_cr[0] = READ32(ea) & 0xfffeffff; // wp not supported on 386
2511   set_flags(READ32(ea + 0x04));
2512   m_eip = READ32(ea + 0x08);
2513   REG32(EDI) = READ32(ea + 0x0c);
2514   REG32(ESI) = READ32(ea + 0x10);
2515   REG32(EBP) = READ32(ea + 0x14);
2516   REG32(ESP) = READ32(ea + 0x18);
2517   REG32(EBX) = READ32(ea + 0x1c);
2518   REG32(EDX) = READ32(ea + 0x20);
2519   REG32(ECX) = READ32(ea + 0x24);
2520   REG32(EAX) = READ32(ea + 0x28);
2521   m_dr[6] = READ32(ea + 0x2c);
2522   m_dr[7] = READ32(ea + 0x30);
2523   m_task.segment = READ16(ea + 0x34);
2524   m_ldtr.segment = READ16(ea + 0x38);
2525   m_sreg[GS].selector = READ16(ea + 0x3c);
2526   m_sreg[FS].selector = READ16(ea + 0x40);
2527   m_sreg[DS].selector = READ16(ea + 0x44);
2528   m_sreg[SS].selector = READ16(ea + 0x48);
2529   m_sreg[CS].selector = READ16(ea + 0x4c);
2530   m_sreg[ES].selector = READ16(ea + 0x50);
2531   m_task.flags = READ32(ea + 0x54) >> 8;
2532   m_task.base = READ32(ea + 0x58);
2533   m_task.limit = READ32(ea + 0x5c);
2534   m_idtr.base = READ32(ea + 0x64);
2535   m_idtr.limit = READ32(ea + 0x68);
2536   m_gdtr.base = READ32(ea + 0x70);
2537   m_gdtr.limit = READ32(ea + 0x74);
2538   m_ldtr.flags = READ32(ea + 0x78) >> 8;
2539   m_ldtr.base = READ32(ea + 0x7c);
2540   m_ldtr.limit = READ32(ea + 0x80);
2541   m_sreg[GS].flags = READ32(ea + 0x84) >> 8;
2542   m_sreg[GS].base = READ32(ea + 0x88);
2543   m_sreg[GS].limit = READ32(ea + 0x8c);
2544   m_sreg[FS].flags = READ32(ea + 0x90) >> 8;
2545   m_sreg[FS].base = READ32(ea + 0x94);
2546   m_sreg[FS].limit = READ32(ea + 0x98);
2547   m_sreg[DS].flags = READ32(ea + 0x9c) >> 8;
2548   m_sreg[DS].base = READ32(ea + 0xa0);
2549   m_sreg[DS].limit = READ32(ea + 0xa4);
2550   m_sreg[SS].flags = READ32(ea + 0xa8) >> 8;
2551   m_sreg[SS].base = READ32(ea + 0xac);
2552   m_sreg[SS].limit = READ32(ea + 0xb0);
2553   m_sreg[CS].flags = READ32(ea + 0xb4) >> 8;
2554   m_sreg[CS].base = READ32(ea + 0xb8);
2555   m_sreg[CS].limit = READ32(ea + 0xbc);
2556   m_sreg[ES].flags = READ32(ea + 0xc0) >> 8;
2557   m_sreg[ES].base = READ32(ea + 0xc4);
2558   m_sreg[ES].limit = READ32(ea + 0xc8);
2559   m_CPL = (m_sreg[SS].flags >> 5) & 3; // cpl == dpl of ss
2560
2561   for(int i = 0; i < GS; i++)
2562   {
2563      m_sreg[i].valid = (m_sreg[i].flags & 0x80) ? true : false;
2564      m_sreg[i].d = (m_sreg[i].flags & 0x4000) ? 1 : 0;
2565   }
2566   CHANGE_PC(m_eip);
2507   fatalerror("i386: LOADALL unimplemented at %08X\n", m_pc - 1);
25672508}
25682509
25692510void i386_device::i386_invalid()
trunk/src/devices/cpu/i386/i386priv.h
r253556r253557
10001000      REG16(SP) = new_esp;
10011001   }
10021002}
1003
1004void i386_device::PUSH32SEG(UINT32 value)
1005{
1006   UINT32 ea, new_esp;
1007   if( STACK_32BIT ) {
1008      new_esp = REG32(ESP) - 4;
1009      ea = i386_translate(SS, new_esp, 1);
1010      ((m_cpu_version & 0xf00) == 0x300) ? WRITE16(ea, value) : WRITE32(ea, value ); // 486 also?
1011      REG32(ESP) = new_esp;
1012   } else {
1013      new_esp = (REG16(SP) - 4) & 0xffff;
1014      ea = i386_translate(SS, new_esp, 1);
1015      ((m_cpu_version & 0xf00) == 0x300) ? WRITE16(ea, value) : WRITE32(ea, value );
1016      REG16(SP) = new_esp;
1017   }
1018}
1019
10201003void i386_device::PUSH8(UINT8 value)
10211004{
10221005   if( m_operand_size ) {
trunk/src/devices/machine/com8116.cpp
r253556r253557
2525// device type definition
2626const device_type COM8116 = &device_creator<com8116_device>;
2727
28// Parts with T after the number do not have an internal oscillator and require an external clock source
29// The SMC/COM 5xxx parts are all dual 5v/12v parts, while the 8xxx parts are 5v only
3028
31// SMC/COM5016(T) with no dash, aka 'STD' part on the datasheet
32// Also COM8116(T)/8126(T)/8136(T)/8146(T) and Synertek sy2661-3 and GI AY-5-8116(T)-000 and GI AY-5-8136(T)-000 and WD WD-1943-00 (aka WD8136-00)
33// SMC/COM8156(T) is the same chip but clocked twice as fast and 32x clocks per baud instead of 16x
34// baud rates are 50, 75, 110, 134.5, 150, 300, 600, 1200, 1800, 2000, 2400, 3600, 4800, 7200, 9600, 19200
3529const int com8116_device::divisors_16X_5_0688MHz[] =
3630   { 6336, 4224, 2880, 2355, 2112, 1056, 528, 264, 176, 158, 132, 88, 66, 44, 33, 16 };
3731
38// SMC/COM8116-003
39// from http://www.vintagecomputer.net/fjkraan/comp/divcomp/doc/SMC_BaudGen.pdf page 283 (pdf page 20)
40// baud rates are 50, 75, 110, 134.5, 150, 200, 300, 600, 1200, 1800, 2000, 2400, 3600, 4800, 9600, 19200
41const int com8116_device::divisors_16X_6_01835MHz[] =
42   { 7523, 5015, 3420, 2797, 2508, 1881, 1254, 627, 313, 209, 188, 157, 104, 78, 39, 20 };
43
44// SMC/COM5016(T)-5 and WD WD-1943-05; Synertek SY2661-1 and 2 are NOT the same as this despite using same clock speed, see below
45// SMC/COM8156(T)-5 is the same chip but clocked twice as fast and 32x clocks per baud instead of 16x
46// baud rates are 50, 75, 110, 134.5, 150, 300, 600, 1200, 1800, 2000, 2400, 3600, 4800, 7200, 9600, 19200
4732const int com8116_device::divisors_16X_4_9152MHz[] =
4833   { 6144, 4096, 2793, 2284, 2048, 1024, 512, 256, 171, 154, 128, 85, 64, 43, 32, 16 };
4934
50// SMC/COM5016(T)-6 and WD WD-1943-06
51// baud rates are 50, 75, 110, 134.5, 150, 200, 300, 600, 1200, 1800, 2400, 3600, 4800, 7200, 9600, 19200
5235const int com8116_device::divisors_32X_5_0688MHz[] =
5336   { 3168, 2112, 1440, 1177, 1056, 792, 528, 264, 132, 88, 66, 44, 33, 22, 16, 8 };
5437
55// SMC/COM5016(T)-013 (from http://bitsavers.informatik.uni-stuttgart.de/pdf/dec/terminal/vt100/EK-VT100-TM-003_VT100_Technical_Manual_Jul82.pdf page 4-27 (pdf page 78))
56// and from http://www.vintagecomputer.net/fjkraan/comp/divcomp/doc/SMC_BaudGen.pdf page 283 (pdf page 20)
57// SMC/COM5106-013A is the same chip clocked twice as fast, but with 32x clocks per baud instead of 16x
58// baud rates are 50, 75, 110, 134.5, 150, 200, 300, 600, 1200, 1800, 2000, 2400, 3600, 4800, 9600, 19200
59const int com8116_device::divisors_16X_2_7648MHz[] =
60   { 3456, 2304, 1571, 1285, 1152, 864, 576, 288, 144, 96, 86, 72, 48, 36, 18, 9 };
6138
62// SMC/COM5026(T)-030 (non-standard serial rates, from http://bitsavers.informatik.uni-stuttgart.de/pdf/standardMicrosystems/_dataBooks/1979_StandardMicrosystems.pdf page 135)
63const int com8116_device::divisors_16X_5_0688MHz_030[] =
64   { 731, 733, 735, 737, 741, 743, 745, 751, 6970, 5569, 5433, 4752, 4269, 1920, 1584, 301 };
6539
66// SMC/COM5036(T)-080 (from http://bitsavers.informatik.uni-stuttgart.de/pdf/standardMicrosystems/_dataBooks/1979_StandardMicrosystems.pdf page 135)
67const int com8116_device::divisors_16X_4_6080MHz[] =
68   { 5760, 3840, 2618, 2141, 1920, 960, 480, 240, 160, 144, 120, 80, 60, 40, 30, 15 };
69
70// COM8046 combines the -6 and STD tables into one device as a 32-entry table
71
72// Synertek SY2661-1 (from http://bitsavers.informatik.uni-stuttgart.de/pdf/synertek/_dataBooks/Synertek_1981-1982_Data_Catalog.pdf page 3-40 (pdf page 139))
73// baud rates are 50, 75, 110, 134.5, 150, 200, 300, 600, 1050, 1200, 1800, 2000, 2400, 4800, 9600, 19200
74const int com8116_device::divisors_16X_4_9152MHz_SY2661_1[] =
75   { 6144, 4096, 2793, 2284, 2048, 1536, 1024, 512, 292, 256, 171, 154, 128, 64, 32, 16 };
76
77// Synertek SY2661-2 (from http://bitsavers.informatik.uni-stuttgart.de/pdf/synertek/_dataBooks/Synertek_1981-1982_Data_Catalog.pdf page 3-40 (pdf page 139))
78// baud rates are 45.5, 50, 75, 110, 134.5, 150, 300, 600, 1200, 1800, 2000, 2400, 4800, 9600, 19200, 38400
79const int com8116_device::divisors_16X_4_9152MHz_SY2661_2[] =
80   { 6752, 6144, 4096, 2793, 2284, 2048, 1024, 512, 256, 171, 154, 128, 64, 32, 16, 8 };
81
8240//**************************************************************************
8341//  LIVE DEVICE
8442//**************************************************************************
trunk/src/devices/machine/com8116.h
r253556r253557
6363   DECLARE_WRITE8_MEMBER( stt_w );
6464
6565   static const int divisors_16X_5_0688MHz[];
66   static const int divisors_16X_6_01835MHz[];
6766   static const int divisors_16X_4_9152MHz[];
6867   static const int divisors_32X_5_0688MHz[];
69   static const int divisors_16X_2_7648MHz[];
70   static const int divisors_16X_5_0688MHz_030[];
71   static const int divisors_16X_4_6080MHz[];
72   static const int divisors_16X_4_9152MHz_SY2661_1[];
73   static const int divisors_16X_4_9152MHz_SY2661_2[];
7468
7569protected:
7670   // device-level overrides
trunk/src/devices/machine/corvushd.cpp
r253556r253557
874874//      Status of command
875875//
876876UINT8 corvus_hdc_t::corvus_write_firmware_block(UINT8 head, UINT8 sector, UINT8 *buffer) {
877   UINT16  relative_sector;    // Relative sector on drive for Physical Write
877   UINT16  relative_sector;    // Relative sector on drive for Physical Read
878878   UINT8   status;
879879
880880   relative_sector = head * m_sectors_per_track + sector;
trunk/src/devices/machine/hp_taco.cpp
r253556r253557
1// license:BSD-3-Clause
2// copyright-holders:F. Ulivi
3/*********************************************************************
4
5    hp_taco.cpp
6
7    HP TApe COntroller (5006-3012)
8
9*********************************************************************/
10
11// This device has been reverse engineered entirely through documents & study of HP software.
12// I had no access to the real device to experiment.
13// Available documentation on the internal working of TACO chip is close to nothing. The best
14// I could find is [1] (see below) where all that's described is a (too) brief summary of registers and little else.
15// In other words, no description of the commands that can be issued to TACO chips.
16// So, my main source of information was the careful study of HP software, especially the 9845 system test ROM (09845-66520).
17// The second half of this ROM holds a comprehensive set of tape drive tests.
18// The main shortcomings of my approach are:
19// * I could indentify only those TACO commands that are actually used by the software. I managed
20//   to identify 17 out of 32 possible commands. The purpose of the rest of commands is anyone's guess.
21// * I could only guess the behavior of TACO chips in corner cases (especially behavior in various error/abnormal
22//   conditions)
23//
24// Documentation I used:
25// [1]  HP, manual 64940-90905, may 80 rev. - Model 64940A tape control & drive service manual
26// [2]  US patent 4,075,679 describing HP9825 system (this system had a discrete implementation of tape controller). The
27//      firmware listing was quite useful in identifying sequences of commands (for example how to find a specific sector etc.).
28// [3]  http://www.hp9845.net site
29// [4]  April 1978 issue of HP Journal. There is a one-page summary of TACO chip on page 20.
30
31// This is an overview of the TACO/CPU interface.
32//
33// Reg. | R/W | Content
34// =====================
35// R4   | R/W | Data register: words read/written to/from tape pass through this register
36// R5   | R/W | Command and status register (see below)
37// R6   | R/W | Tachometer register. Writing it sets a pulse counter that counts up on either tachometer pulses or IRGs, depending
38//      |     | on command. When the counter rolls over from 0xffff to 0 it typically ends the command. It's not clear to me
39//      |     | what value could be read from this register, if it's just the same value that was written last time or the internal
40//      |     | counter or something else entirely.
41// R7   | R   | Checksum register. Reading it clears it.
42// R7   | W   | Timing register. It controls somehow the encoding and decoding of bits. For now I completely ignore it because its
43//      |     | content it's totally unknown to me. It seems safe to do so, anyway. I can see that it's always set to 0x661d before
44//      |     | writing to tape and to 0x0635 before reading.
45//
46// Format of TACO command/status register (R5)
47// Bit    R/W Content
48// ===============
49// 15     RW  Tape direction (1 = forward)
50// 14..10 RW  Command (see the "enum" below)
51//  9     RW  ? Drive ON according to [1], the actual use seems to be selection of gap length
52//  8     RW  ? Size of gaps according to [1], N/U in my opinion
53//  7     RW  Speed of tape (1 = 90 ips, 0 = 22 ips)
54//  6     RW  Option bit for various commands
55//  5     R   Current track (1 = B)
56//  4     R   Gap detected (1)
57//  3     R   Write protection (1)
58//  2     R   Servo failure (1)
59//  1     R   Cartridge out (1)
60//  0     R   Hole detected (1)
61
62// Here's a summary of the on-tape format of HP9845 systems.
63// * A tape has two independent tracks (A & B).
64// * Each track holds 426 sectors.
65// * Each sector has an header and 256 bytes of payload (see below)
66// * Sectors are separated by gaps of uniform magnetization called IRGs (Inter-Record Gaps)
67// * The basic unit of data I/O are 16-bit words
68// * Bits are encoded by different distances between magnetic flux reversals
69// * The structure of tracks is:
70//   - Begin of tape holes
71//   - The deadzone: 350x 0xffff words
72//   - 1" of IRG
73//   - Sector #0 (track A) or #426 (track B)
74//   - 1" of IRG (2.5" on track A)
75//   - Sector #1 (track A) or #427 (track B)
76//   - 1" of IRG
77//   - Sector #2 (track A) or #428 (track B)
78//   - ...and so on up to sector #425/#851
79//   - 6" of final gap
80//   - Non-recorded tape
81//   - End of tape holes
82// * Sector #0 is not used
83// * Sectors #1 and #2 hold the first copy of tape directory
84// * Sectors #3 and #4 hold the second/backup copy of tape directory
85// * User data are stored starting from sector #5
86// * There is no "fragmentation" map (like file allocation table in FAT filesystem): a file
87//   spanning more than 1 sector always occupy a single block of contiguous sectors.
88//
89// A sector is structured like this:
90// Word 0:      Invisible preamble word (always 0). Preamble comes from 9825, don't know if it's
91//              actually there in TACO encoding. I assumed it is.
92// Word 1:      Format/sector in use and other unidentified bits.
93// Word 2:      Sector number
94// Word 3:      Sector length and other bits
95// Word 4:      Checksum (sum of words 1..3)
96// Words 5..132:        Payload
97// Word 133:    Checksum (sum of words 5..132)
98//
99// Physical encoding of words is borrowed from 9825 as I wasn't able
100// to gather any info on the actual encoding of TACO chips.
101// This is how 9825 encodes words on tape:
102// - the unit of encoding are 16-bit words
103// - each word is encoded from MSB to LSB
104// - each word has an extra invisible "1" encoded at the end
105// - tape is read/written at slow speed only (21.98 ips)
106// - a 0 is encoded with a distance between flux reversals of 1/35200 s
107//   (giving a maximum density of about 1600 reversals per inch)
108// - a 1 is encoded with a distance that's 1.75 times that of a 0
109//
110// This driver is based on the following model of the actual TACO/tape system:
111// * Tape immediately reaches working speed (no spin-up time)
112// * Inversion of tape direction and change of speed are immediate as well
113// * Time & distance to stop the tape are modeled, though. Firmware is upset by
114//   a tape with null braking time/distance.
115// * Speed of tape is exceptionally accurate. Real tape was controlled by a closed loop
116//   with something like 1% accuracy on speed.
117// * Storage is modeled by one "map" data structure per track. Each map maps the tape position
118//   to the 16-bit word stored at that position. Gaps are modeled by lack of data in the map.
119//   There is no model of the physical encoding of bits (except to compute how long each word
120//   is on tape).
121// * Read threshold is ignored. Real tapes could be read with either a low or high threshold.
122// * "Flag" bit is used as a busy/ready signal in real TACO. Here I assumed the device is
123//   always ready, so Flag is always active.
124// * I tried to fill the (many) gaps on chip behavior with "sensible" solutions. I could only
125//   validate my solutions by running the original firmware in MAME, though (no real hw at hand).
126//
127// TODOs/issues:
128// * Some code cleanup
129// * Handling of tape holes seems to be wrong: test "C" of test ROM only works partially
130// * Find out what is read from register R6
131// * Handle device_image_interface::call_display to show state of tape
132// * Find more info on TACO chips (does anyone with a working 9845 or access to internal HP docs want to
133//   help me here, please?)
134//
135#include "emu.h"
136#include "hp_taco.h"
137
138// Debugging
139#define VERBOSE 1
140#define LOG(x)  do { if (VERBOSE) logerror x; } while (0)
141#define VERBOSE_0 0
142#define LOG_0(x)  do { if (VERBOSE_0) logerror x; } while (0)
143
144// Macros to clear/set single bits
145#define BIT_MASK(n) (1U << (n))
146#define BIT_CLR(w , n)  ((w) &= ~BIT_MASK(n))
147#define BIT_SET(w , n)  ((w) |= BIT_MASK(n))
148
149// Timers
150enum {
151        TAPE_TMR_ID,
152        HOLE_TMR_ID
153};
154
155// Constants
156#define CMD_REG_MASK    0xffc0  // Command register mask
157#define STATUS_REG_MASK 0x003f  // Status register mask
158#define TACH_TICKS_PER_INCH     968     // Tachometer pulses per inch of tape movement
159#define TAPE_POS_FRACT  1024    // 10 bits of fractional part in tape_pos_t
160#define ONE_INCH_POS    (TACH_TICKS_PER_INCH * TAPE_POS_FRACT)  // Value in tape_pos_t representing 1 inch of tape
161#define TACH_FREQ_SLOW  21276   // Tachometer pulse frequency for slow speed (21.98 ips)
162#define TACH_FREQ_FAST  87196   // Tachometer pulse frequency for fast speed (90.08 ips)
163#define TAPE_LENGTH     ((140 * 12 + 72 * 2) * ONE_INCH_POS)    // Tape length: 140 ft of usable tape + 72" of punched tape at either end
164#define TAPE_INIT_POS   (80 * ONE_INCH_POS)     // Initial tape position: 80" from beginning (just past the punched part)
165#define ZERO_BIT_LEN    619     // Length of 0 bits at slow tape speed: 1/(35200 Hz)
166#define ONE_BIT_LEN     1083    // Length of 1 bits at slow tape speed: 1.75 times ZERO_BIT_LEN
167#define QUICK_CMD_USEC  25      // usec for "quick" command execution
168#define FAST_BRAKE_MSEC 73      // Braking time from fast speed to stop (2 ips) in msec (deceleration is 1200 in/s^2)
169#define SLOW_BRAKE_MSEC 17      // Braking time from slow speed to stop in msec
170#define FAST_BRAKE_DIST 3350450 // Braking distance at fast speed (~3.38 in)
171#define SLOW_BRAKE_DIST 197883  // Braking distance at slow speed (~0.2 in)
172#define PREAMBLE_WORD   0       // Value of preamble word
173#define END_GAP_LENGTH  (6 * ONE_INCH_POS)      // Length of final gap: 6"
174#define MIN_IRG_LENGTH  ((tape_pos_t)(0.2 * ONE_INCH_POS))      // Minimum length of IRGs: 0.2" (from 9825, not sure about value in TACO)
175#define NULL_TAPE_POS   ((tape_pos_t)-1)        // Special value for invalid/unknown tape position
176#define NO_DATA_GAP     (17 * ONE_BIT_LEN)      // Minimum gap size to detect end of data: length of longest word (0xffff)
177#define FILE_MAGIC      0x4f434154      // Magic value at start of image file: "TACO"
178
179// Parts of command register
180#define CMD_CODE(reg) \
181        (((reg) >> 10) & 0x1f)
182#define DIR_FWD(reg) \
183        (BIT(reg , 15))
184#define SPEED_FAST(reg) \
185        (BIT(reg , 7))
186#define CMD_OPT(reg) \
187        (BIT(reg , 6))
188#define UNKNOWN_B9(reg) \
189        (BIT(reg , 9))
190#define DIR_FWD_MASK    BIT_MASK(15)    // Direction = forward
191#define SPEED_FAST_MASK BIT_MASK(7)     // Speed = fast
192
193// Commands
194enum {
195        CMD_INDTA_INGAP,        // 00: scan for data first then for gap
196        CMD_UNK_01,             // 01: unknown
197        CMD_FINAL_GAP,          // 02: write final gap
198        CMD_INIT_WRITE,         // 03: write words for tape formatting
199        CMD_STOP,               // 04: stop
200        CMD_UNK_05,             // 05: unknown
201        CMD_SET_TRACK,          // 06: set A/B track
202        CMD_UNK_07,             // 07: unknown
203        CMD_UNK_08,             // 08: unknown
204        CMD_UNK_09,             // 09: unknown
205        CMD_MOVE,               // 0a: move tape
206        CMD_UNK_0b,             // 0b: unknown
207        CMD_INGAP_MOVE,         // 0c: scan for gap then move a bit further (used to gain some margin when inverting tape movement)
208        CMD_UNK_0d,             // 0d: unknown
209        CMD_CLEAR,              // 0e: clear errors/unlatch status bits
210        CMD_UNK_0f,             // 0f: unknown
211        CMD_NOT_INDTA,          // 10: scan for end of data
212        CMD_UNK_11,             // 11: unknown
213        CMD_UNK_12,             // 12: unknown
214        CMD_UNK_13,             // 13: unknown
215        CMD_UNK_14,             // 14: unknown
216        CMD_UNK_15,             // 15: unknown
217        CMD_WRITE_IRG,          // 16: write inter-record gap
218        CMD_UNK_17,             // 17: unknown
219        CMD_SCAN_RECORDS,       // 18: scan records (count IRGs)
220        CMD_RECORD_WRITE,       // 19: write record words
221        CMD_MOVE_INDTA,         // 1a: move then scan for data
222        CMD_UNK_1b,             // 1b: unknown (for now it seems harmless to handle it as NOP)
223        CMD_DELTA_MOVE_HOLE,    // 1c: move tape a given distance, intr at end or first hole found (whichever comes first)
224        CMD_START_READ,         // 1d: start record reading
225        CMD_DELTA_MOVE_IRG,     // 1e: move tape a given distance, detect gaps in parallel
226        CMD_END_READ            // 1f: stop reading
227};
228
229// Bits of status register
230#define STATUS_HOLE_BIT         0       // Hole detected
231#define STATUS_CART_OUT_BIT     1       // Cartridge out
232#define STATUS_SFAIL_BIT        2       // Servo failure
233#define STATUS_WPR_BIT          3       // Write protection
234#define STATUS_GAP_BIT          4       // Gap detected
235#define STATUS_TRACKB_BIT       5       // Track B selected
236#define STATUS_CART_OUT_MASK    BIT_MASK(STATUS_CART_OUT_BIT)   // Cartridge out
237#define STATUS_WPR_MASK         BIT_MASK(STATUS_WPR_BIT)        // Write protection
238#define STATUS_ERR_MASK         (STATUS_CART_OUT_MASK)  // Mask of errors in status reg.
239
240// *** Position of tape holes ***
241// At beginning of tape:
242// *START*
243// |<-----24"----->|<---12"--->|<---12"--->|<-----24"----->|
244//               O   O       O   O       O   O             O
245//               |<->|       |<->|       |<->|
246//               0.218"      0.218"      0.218"
247// At end of tape:
248//                                                     *END*
249// |<-----24"----->|<---12"--->|<---12"--->|<-----24"----->|
250// O               O           O           O
251//
252static const hp_taco_device::tape_pos_t tape_holes[] = {
253        (hp_taco_device::tape_pos_t)(23.891 * ONE_INCH_POS),    // 24 - 0.218 / 2
254        (hp_taco_device::tape_pos_t)(24.109 * ONE_INCH_POS),    // 24 + 0.218 / 2
255        (hp_taco_device::tape_pos_t)(35.891 * ONE_INCH_POS),    // 36 - 0.218 / 2
256        (hp_taco_device::tape_pos_t)(36.109 * ONE_INCH_POS),    // 36 + 0.218 / 2
257        (hp_taco_device::tape_pos_t)(47.891 * ONE_INCH_POS),    // 48 - 0.218 / 2
258        (hp_taco_device::tape_pos_t)(48.109 * ONE_INCH_POS),    // 48 + 0.218 / 2
259        72 * ONE_INCH_POS,      // 72
260        1752 * ONE_INCH_POS,    // 1752
261        1776 * ONE_INCH_POS,    // 1776
262        1788 * ONE_INCH_POS,    // 1788
263        1800 * ONE_INCH_POS     // 1800
264};
265
266// Device type definition
267const device_type HP_TACO = &device_creator<hp_taco_device>;
268
269// Constructors
270hp_taco_device::hp_taco_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname)
271        : device_t(mconfig, type, name, tag, owner, clock, shortname, __FILE__),
272          device_image_interface(mconfig , *this),
273          m_irq_handler(*this),
274          m_flg_handler(*this),
275          m_sts_handler(*this),
276          m_tape_pos(TAPE_INIT_POS),
277          m_image_dirty(false)
278{
279        clear_state();
280}
281
282hp_taco_device::hp_taco_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
283        : device_t(mconfig, HP_TACO, "HP TACO", tag, owner, clock, "TACO", __FILE__),
284          device_image_interface(mconfig , *this),
285          m_irq_handler(*this),
286          m_flg_handler(*this),
287          m_sts_handler(*this),
288          m_tape_pos(TAPE_INIT_POS),
289          m_image_dirty(false)
290{
291        clear_state();
292}
293
294WRITE16_MEMBER(hp_taco_device::reg_w)
295{
296        LOG_0(("wr R%u = %04x\n", 4 + offset , data));
297
298        // Any I/O activity clears IRQ
299        irq_w(false);
300
301        switch (offset) {
302        case 0:
303                // Data register
304                m_data_reg = data;
305                m_data_reg_full = true;
306                break;
307
308        case 1:
309                // Command register
310                start_cmd_exec(data & CMD_REG_MASK);
311                break;
312
313        case 2:
314                // Tachometer register
315                m_tach_reg = data;
316                break;
317
318        case 3:
319                // Timing register
320                m_timing_reg = data;
321                break;
322        }
323}
324
325READ16_MEMBER(hp_taco_device::reg_r)
326{
327        UINT16 res = 0;
328
329        // Any I/O activity clears IRQ
330        irq_w(false);
331
332        switch (offset) {
333        case 0:
334                // Data register
335                res = m_data_reg;
336                break;
337
338        case 1:
339                // Command & status register
340                res = (m_cmd_reg & CMD_REG_MASK) | (m_status_reg & STATUS_REG_MASK);
341                break;
342
343        case 2:
344                // Tachometer register
345                res = m_tach_reg;
346                break;
347
348        case 3:
349                // Checksum register: it clears when read
350                res = m_checksum_reg;
351                m_checksum_reg = 0;
352                break;
353        }
354
355        LOG_0(("rd R%u = %04x\n", 4 + offset , res));
356
357        return res;
358}
359
360READ_LINE_MEMBER(hp_taco_device::flg_r)
361{
362        return m_flg;
363}
364
365READ_LINE_MEMBER(hp_taco_device::sts_r)
366{
367        return m_sts;
368}
369
370// device_config_complete
371void hp_taco_device::device_config_complete()
372{
373        LOG(("device_config_complete"));
374   update_names();
375}
376
377// device_start
378void hp_taco_device::device_start()
379{
380        LOG(("device_start"));
381        m_irq_handler.resolve_safe();
382        m_flg_handler.resolve_safe();
383        m_sts_handler.resolve_safe();
384
385        save_item(NAME(m_data_reg));
386        save_item(NAME(m_data_reg_full));
387        save_item(NAME(m_cmd_reg));
388        save_item(NAME(m_cmd_state));
389        save_item(NAME(m_status_reg));
390        save_item(NAME(m_tach_reg));
391        save_item(NAME(m_checksum_reg));
392        save_item(NAME(m_timing_reg));
393        save_item(NAME(m_irq));
394        save_item(NAME(m_flg));
395        save_item(NAME(m_sts));
396        save_item(NAME(m_tape_pos));
397        save_item(NAME(m_start_time));
398        save_item(NAME(m_tape_fwd));
399        save_item(NAME(m_tape_fast));
400        save_item(NAME(m_image_dirty));
401        save_item(NAME(m_tape_wr));
402        save_item(NAME(m_rw_pos));
403        save_item(NAME(m_next_word));
404        save_item(NAME(m_rd_it_valid));
405        save_item(NAME(m_gap_detect_start));
406
407        m_tape_timer = timer_alloc(TAPE_TMR_ID);
408        m_hole_timer = timer_alloc(HOLE_TMR_ID);
409}
410
411// device_stop
412void hp_taco_device::device_stop()
413{
414}
415
416// device_reset
417void hp_taco_device::device_reset()
418{
419        LOG(("device_reset"));
420        clear_state();
421
422        m_irq = false;
423        m_flg = true;
424
425        m_irq_handler(false);
426        m_flg_handler(true);
427        set_error(false);
428}
429
430void hp_taco_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
431{
432        if (CMD_CODE(m_cmd_reg) != CMD_STOP) {
433                update_tape_pos();
434        }
435
436        switch (id) {
437        case TAPE_TMR_ID:
438                LOG_0(("Tape tmr @%g\n" , machine().time().as_double()));
439
440                tape_pos_t length;
441
442                switch (CMD_CODE(m_cmd_reg)) {
443                case CMD_INDTA_INGAP:
444                        if (m_cmd_state == 0) {
445                                m_cmd_state = 1;
446                                tape_pos_t target = m_tape_pos;
447                                if (next_n_gap(target, 1, MIN_IRG_LENGTH)) {
448                                        m_tape_timer->adjust(time_to_target(target));
449                                }
450                                return;
451                        }
452                        break;
453
454                case CMD_RECORD_WRITE:
455                        if (m_cmd_state == 0) {
456                                if (m_rd_it->second == PREAMBLE_WORD) {
457                                        LOG_0(("Got preamble\n"));
458                                        m_cmd_state = 1;
459                                        // m_rw_pos already at correct position
460                                        m_tape_timer->adjust(fetch_next_wr_word());
461                                        break;
462                                } else {
463                                        adv_res_t res = adv_it(m_rd_it);
464                                        if (res != ADV_NO_MORE_DATA) {
465                                                m_tape_timer->adjust(time_to_rd_next_word(m_rw_pos));
466                                        }
467                                        // No IRQ
468                                        return;
469                                }
470                        }
471                        // Intentional fall-through
472                case CMD_INIT_WRITE:
473                        write_word(m_rw_pos , m_next_word , length);
474                        pos_offset(m_rw_pos , length);
475                        // Just to be sure..
476                        m_tape_pos = m_rw_pos;
477                        m_tape_timer->adjust(fetch_next_wr_word());
478                        break;
479
480                case CMD_STOP:
481                        move_tape_pos(m_tape_fast ? FAST_BRAKE_DIST : SLOW_BRAKE_DIST);
482                        stop_tape();
483                        break;
484
485                case CMD_INGAP_MOVE:
486                        if (m_cmd_state == 0) {
487                                m_cmd_state = 1;
488                                m_tape_timer->adjust(time_to_tach_pulses());
489                                return;
490                        }
491                        break;
492
493                case CMD_FINAL_GAP:
494                case CMD_WRITE_IRG:
495                        write_gap(m_rw_pos , m_tape_pos);
496                        m_hole_timer->reset();
497                        break;
498
499                case CMD_SCAN_RECORDS:
500                        if (m_cmd_state == 0) {
501                                m_cmd_state = 1;
502                                tape_pos_t target = m_tape_pos;
503                                if (next_n_gap(target, 0x10000U - m_tach_reg, MIN_IRG_LENGTH)) {
504                                        LOG_0(("%u gaps @%d\n" , 0x10000U - m_tach_reg, target));
505                                        m_tape_timer->adjust(time_to_target(target));
506                                }
507                                return;
508                        } else {
509                                m_hole_timer->reset();
510                        }
511                        break;
512
513                case CMD_MOVE_INDTA:
514                        if (m_cmd_state == 0) {
515                                if (next_data(m_rd_it , m_tape_pos , true)) {
516                                        m_cmd_state = 1;
517                                        m_tape_timer->adjust(time_to_target(farthest_end(m_rd_it)));
518                                }
519                                // No IRQ
520                                return;
521                        }
522                        // m_cmd_state == 1 -> IRQ & cmd end
523                        break;
524
525                case CMD_DELTA_MOVE_HOLE:
526                case CMD_DELTA_MOVE_IRG:
527                        // Interrupt at end of movement
528                        m_hole_timer->reset();
529                        break;
530
531                case CMD_START_READ:
532                        {
533                                bool set_intr = true;
534                                // Just to be sure..
535                                m_tape_pos = m_rw_pos;
536                                if (m_cmd_state == 0) {
537                                        set_intr = false;
538                                        if (m_rd_it->second == PREAMBLE_WORD) {
539                                                m_cmd_state = 1;
540                                        }
541                                        LOG_0(("Got preamble\n"));
542                                } else {
543                                        m_data_reg = m_rd_it->second;
544                                        m_checksum_reg += m_data_reg;
545                                        LOG_0(("RD %04x\n" , m_data_reg));
546                                }
547                                adv_res_t res = adv_it(m_rd_it);
548                                LOG_0(("adv_it %d\n" , res));
549                                if (res == ADV_NO_MORE_DATA) {
550                                        m_rd_it_valid = false;
551                                } else {
552                                        if (res == ADV_DISCONT_DATA) {
553                                                // Hit a gap, restart preamble search
554                                                m_cmd_state = 0;
555                                        }
556                                        m_tape_timer->adjust(time_to_rd_next_word(m_rw_pos));
557                                }
558                                if (!set_intr) {
559                                        return;
560                                }
561                        }
562                        break;
563
564                case CMD_END_READ:
565                        {
566                                m_tape_pos = m_rw_pos;
567                                // Note: checksum is not updated
568                                m_data_reg = m_rd_it->second;
569                                LOG_0(("Final RD %04x\n" , m_data_reg));
570                                adv_res_t res = adv_it(m_rd_it);
571                                if (res == ADV_NO_MORE_DATA) {
572                                        m_rd_it_valid = false;
573                                }
574                                m_hole_timer->reset();
575                        }
576                        break;
577
578                default:
579                        // Other commands: just raise irq
580                        break;
581                }
582                irq_w(true);
583                break;
584
585        case HOLE_TMR_ID:
586                LOG_0(("Hole tmr @%g\n" , machine().time().as_double()));
587
588                BIT_SET(m_status_reg , STATUS_HOLE_BIT);
589
590                switch (CMD_CODE(m_cmd_reg)) {
591                case CMD_FINAL_GAP:
592                case CMD_WRITE_IRG:
593                        write_gap(m_rw_pos , m_tape_pos);
594                        m_rw_pos = m_tape_pos;
595                        break;
596
597                case CMD_SCAN_RECORDS:
598                case CMD_DELTA_MOVE_HOLE:
599                        // Cmds 18 & 1c are terminated at first hole
600                        m_tape_timer->reset();
601                        irq_w(true);
602                        // No reloading of hole timer
603                        return;
604
605                case CMD_DELTA_MOVE_IRG:
606                        // TODO: update r6
607                        m_hole_timer->adjust(time_to_next_hole());
608                        // No IRQ at holes
609                        return;
610
611                case CMD_START_READ:
612                case CMD_END_READ:
613                        set_error(true);
614                        break;
615
616                default:
617                        // Other cmds: default processing (update tape pos, set IRQ, schedule timer for next hole)
618                        break;
619                }
620
621                irq_w(true);
622                m_hole_timer->adjust(time_to_next_hole());
623                break;
624
625        default:
626                break;
627        }
628}
629
630void hp_taco_device::clear_state(void)
631{
632        m_data_reg = 0;
633        m_data_reg_full = false;
634        m_cmd_reg = 0;
635        m_status_reg = 0;
636        m_tach_reg = 0;
637        m_checksum_reg = 0;
638        m_timing_reg = 0;
639        m_cmd_state = 0;
640        // m_tape_pos is not reset, tape stays where it is
641        m_start_time = attotime::never;
642        m_tape_fwd = false;
643        m_tape_fast = false;
644        // m_image_dirty is not touched
645        m_tape_wr = false;
646        m_rw_pos = 0;
647        m_next_word = 0;
648        m_rd_it_valid = false;
649        m_gap_detect_start = NULL_TAPE_POS;
650
651        set_tape_present(false);
652        set_tape_present(is_loaded());
653}
654
655void hp_taco_device::irq_w(bool state)
656{
657        if (state != m_irq) {
658                m_irq = state;
659                m_irq_handler(state);
660                LOG_0(("IRQ = %d\n" , state));
661        }
662}
663
664void hp_taco_device::set_error(bool state)
665{
666        m_sts = !state;
667        m_sts_handler(m_sts);
668        LOG_0(("error = %d\n" , state));
669}
670
671unsigned hp_taco_device::speed_to_tick_freq(void) const
672{
673        return m_tape_fast ? TACH_FREQ_FAST * TAPE_POS_FRACT : TACH_FREQ_SLOW * TAPE_POS_FRACT;
674}
675
676bool hp_taco_device::pos_offset(tape_pos_t& pos , tape_pos_t offset) const
677{
678        if (offset == 0) {
679                return true;
680        }
681
682        if (!m_tape_fwd) {
683                offset = -offset;
684        }
685
686        pos += offset;
687
688        // In real life tape would unspool..
689        if (pos > TAPE_LENGTH) {
690                pos = TAPE_LENGTH;
691                return false;
692        } else if (pos < 0) {
693                pos = 0;
694                return false;
695        } else {
696                return true;
697        }
698}
699
700void hp_taco_device::move_tape_pos(tape_pos_t delta_pos)
701{
702        tape_pos_t tape_start_pos = m_tape_pos;
703        if (!pos_offset(m_tape_pos , delta_pos)) {
704                LOG(("Tape unspooled!\n"));
705        }
706        m_start_time = machine().time();
707        LOG_0(("Tape pos = %u\n" , m_tape_pos));
708        if (any_hole(tape_start_pos , m_tape_pos)) {
709                // Crossed one or more holes
710                BIT_SET(m_status_reg , STATUS_HOLE_BIT);
711        }
712}
713
714void hp_taco_device::update_tape_pos(void)
715{
716        if (m_start_time.is_never()) {
717                // Tape not moving
718                return;
719        }
720
721        attotime delta_time(machine().time() - m_start_time);
722        LOG_0(("delta_time = %g\n" , delta_time.as_double()));
723        // How many tachometer ticks has the tape moved?
724        tape_pos_t delta_tach = (tape_pos_t)(delta_time.as_ticks(speed_to_tick_freq()));
725        LOG_0(("delta_tach = %u\n" , delta_tach));
726
727        move_tape_pos(delta_tach);
728
729        // Gap detection
730        bool gap_detected = false;
731        if (m_gap_detect_start != NULL_TAPE_POS && abs(m_gap_detect_start - m_tape_pos) >= MIN_IRG_LENGTH) {
732                tape_pos_t tmp = m_tape_pos;
733                pos_offset(tmp , -MIN_IRG_LENGTH);
734                gap_detected = just_gap(tmp , m_tape_pos);
735        }
736        if (gap_detected) {
737                BIT_SET(m_status_reg, STATUS_GAP_BIT);
738        } else {
739                BIT_CLR(m_status_reg, STATUS_GAP_BIT);
740        }
741}
742
743void hp_taco_device::ensure_a_lt_b(tape_pos_t& a , tape_pos_t& b)
744{
745        if (a > b) {
746                // Ensure A always comes before B
747                tape_pos_t tmp;
748                tmp = a;
749                a = b;
750                b = tmp;
751        }
752}
753
754// Is there any hole in a given section of tape?
755bool hp_taco_device::any_hole(tape_pos_t tape_pos_a , tape_pos_t tape_pos_b)
756{
757        ensure_a_lt_b(tape_pos_a , tape_pos_b);
758
759        for (tape_pos_t hole : tape_holes) {
760                if (tape_pos_a < hole && tape_pos_b >= hole) {
761                        return true;
762                }
763        }
764
765        return false;
766}
767
768// Position of next hole tape will reach in a given direction
769hp_taco_device::tape_pos_t hp_taco_device::next_hole(void) const
770{
771        if (m_tape_fwd) {
772                for (tape_pos_t hole : tape_holes) {
773                        if (hole > m_tape_pos) {
774                                LOG_0(("next hole fwd @%u = %u\n" , m_tape_pos , hole));
775                                return hole;
776                        }
777                }
778                // No more holes: will hit end of tape
779                return TAPE_LENGTH;
780        } else {
781                for (int i = (sizeof(tape_holes) / sizeof(tape_holes[ 0 ])) - 1; i >= 0; i--) {
782                        if (tape_holes[ i ] < m_tape_pos) {
783                                LOG_0(("next hole rev @%u = %u\n" , m_tape_pos , tape_holes[ i ]));
784                                return tape_holes[ i ];
785                        }
786                }
787                // No more holes: will hit start of tape
788                return 0;
789        }
790}
791
792attotime hp_taco_device::time_to_distance(tape_pos_t distance) const
793{
794        // +1 for rounding
795        return attotime::from_ticks(distance + 1 , speed_to_tick_freq());
796}
797
798attotime hp_taco_device::time_to_target(tape_pos_t target) const
799{
800        return time_to_distance(abs(target - m_tape_pos));
801}
802
803bool hp_taco_device::start_tape_cmd(UINT16 cmd_reg , UINT16 must_be_1 , UINT16 must_be_0)
804{
805        m_cmd_reg = cmd_reg;
806
807        UINT16 to_be_tested = (m_cmd_reg & CMD_REG_MASK) | (m_status_reg & STATUS_REG_MASK);
808        // Bits in STATUS_ERR_MASK must always be 0
809        must_be_0 |= STATUS_ERR_MASK;
810
811        // It's not an error if the error state is already set (sts false)
812        if (((to_be_tested & (must_be_1 | must_be_0)) ^ must_be_1) != 0) {
813                set_error(true);
814                return false;
815        } else {
816                bool prev_tape_wr = m_tape_wr;
817                bool prev_tape_fwd = m_tape_fwd;
818                bool prev_tape_fast = m_tape_fast;
819                bool not_moving = m_start_time.is_never();
820
821                m_start_time = machine().time();
822                m_tape_wr = (must_be_0 & STATUS_WPR_MASK) != 0;
823                m_tape_fwd = DIR_FWD(m_cmd_reg);
824                m_tape_fast = SPEED_FAST(m_cmd_reg);
825                // TODO: remove?
826                BIT_CLR(m_status_reg, STATUS_HOLE_BIT);
827
828                if (m_tape_wr) {
829                        // Write command: disable gap detector
830                        m_gap_detect_start = NULL_TAPE_POS;
831                        BIT_CLR(m_status_reg, STATUS_GAP_BIT);
832                        m_image_dirty = true;
833                } else if (not_moving || prev_tape_wr != m_tape_wr || prev_tape_fwd != m_tape_fwd || prev_tape_fast != m_tape_fast) {
834                        // Tape started right now, switched from writing to reading, direction changed or speed changed: (re)start gap detector
835                        m_gap_detect_start = m_tape_pos;
836                        BIT_CLR(m_status_reg, STATUS_GAP_BIT);
837                }
838                return true;
839        }
840}
841
842void hp_taco_device::stop_tape(void)
843{
844        m_start_time = attotime::never;
845        m_gap_detect_start = NULL_TAPE_POS;
846}
847
848hp_taco_device::tape_track_t& hp_taco_device::current_track(void)
849{
850        return m_tracks[ BIT(m_status_reg , STATUS_TRACKB_BIT) ];
851}
852
853// Return physical length of a 16-bit word on tape
854hp_taco_device::tape_pos_t hp_taco_device::word_length(tape_word_t w)
855{
856        unsigned zeros , ones;
857
858        // pop count of w
859        ones = (w & 0x5555) + ((w >> 1) & 0x5555);
860        ones = (ones & 0x3333) + ((ones >> 2) & 0x3333);
861        ones = (ones & 0x0f0f) + ((ones >> 4) & 0x0f0f);
862        ones = (ones & 0x00ff) + ((ones >> 8) & 0x00ff);
863
864        zeros = 16 - ones;
865
866        return zeros * ZERO_BIT_LEN + (ones + 1) * ONE_BIT_LEN;
867}
868
869hp_taco_device::tape_pos_t hp_taco_device::word_end_pos(const tape_track_t::iterator& it)
870{
871    return it->first + word_length(it->second);
872}
873
874void hp_taco_device::adjust_it(tape_track_t& track , tape_track_t::iterator& it , tape_pos_t pos)
875{
876        if (it != track.begin()) {
877                it--;
878                if (word_end_pos(it) <= pos) {
879                        it++;
880                }
881        }
882}
883
884// Write a word on current tape track
885void hp_taco_device::write_word(tape_pos_t start , tape_word_t word , tape_pos_t& length)
886{
887        tape_track_t& track = current_track();
888        tape_track_t::iterator it_low = track.lower_bound(start);
889        adjust_it(track , it_low , start);
890        length = word_length(word);
891        tape_pos_t end_pos = start + length;
892        tape_track_t::iterator it_high = track.lower_bound(end_pos);
893
894        track.erase(it_low , it_high);
895
896        track.insert(it_high , std::make_pair(start, word));
897        LOG_0(("WR %04x @ T%u:%u\n" , word , BIT(m_status_reg , STATUS_TRACKB_BIT) , start));
898}
899
900// Write a gap on current track
901void hp_taco_device::write_gap(tape_pos_t a , tape_pos_t b)
902{
903        ensure_a_lt_b(a , b);
904        tape_track_t& track = current_track();
905        tape_track_t::iterator it_low = track.lower_bound(a);
906        adjust_it(track , it_low , a);
907        tape_track_t::iterator it_high = track.lower_bound(b);
908
909        track.erase(it_low, it_high);
910
911        LOG_0(("GAP on T%u:[%u,%u)\n" , BIT(m_status_reg , STATUS_TRACKB_BIT) , a , b));
912}
913
914bool hp_taco_device::just_gap(tape_pos_t a , tape_pos_t b)
915{
916        ensure_a_lt_b(a , b);
917        tape_track_t& track = current_track();
918        tape_track_t::iterator it_low = track.lower_bound(a);
919        tape_track_t::iterator it_high = track.lower_bound(b);
920
921        adjust_it(track, it_low, a);
922
923        return it_low == it_high;
924}
925
926hp_taco_device::tape_pos_t hp_taco_device::farthest_end(const tape_track_t::iterator& it) const
927{
928        if (m_tape_fwd) {
929                return word_end_pos(it);
930        } else {
931                return it->first;
932        }
933}
934
935bool hp_taco_device::next_data(tape_track_t::iterator& it , tape_pos_t pos , bool inclusive)
936{
937        tape_track_t& track = current_track();
938        it = track.lower_bound(pos);
939        if (m_tape_fwd) {
940                if (inclusive) {
941                        adjust_it(track, it, pos);
942                }
943                return it != track.end();
944        } else {
945                // Never more than 2 iterations
946                do {
947                        if (it == track.begin()) {
948                                it = track.end();
949                                return false;
950                        }
951                        it--;
952                } while (!inclusive && word_end_pos(it) > pos);
953                return true;
954        }
955}
956
957hp_taco_device::adv_res_t hp_taco_device::adv_it(tape_track_t::iterator& it)
958{
959        tape_track_t& track = current_track();
960        if (m_tape_fwd) {
961                tape_pos_t prev_pos = word_end_pos(it);
962                it++;
963                if (it == track.end()) {
964                        return ADV_NO_MORE_DATA;
965                } else {
966                        adv_res_t res = prev_pos == it->first ? ADV_CONT_DATA : ADV_DISCONT_DATA;
967                        return res;
968                }
969        } else {
970                if (it == track.begin()) {
971                        it = track.end();
972                        return ADV_NO_MORE_DATA;
973                } else {
974                        tape_pos_t prev_pos = it->first;
975                        it--;
976                        return prev_pos == word_end_pos(it) ? ADV_CONT_DATA : ADV_DISCONT_DATA;
977                }
978        }
979}
980
981attotime hp_taco_device::fetch_next_wr_word(void)
982{
983        if (m_data_reg_full) {
984                m_next_word = m_data_reg;
985                m_data_reg_full = false;
986                LOG_0(("next %04x (DR)\n" , m_next_word));
987        } else {
988                // When data register is empty, write checksum word
989                m_next_word = m_checksum_reg;
990                LOG_0(("next %04x (CS)\n" , m_next_word));
991        }
992        // Update checksum with new word
993        m_checksum_reg += m_next_word;
994
995        return time_to_distance(word_length(m_next_word));
996}
997
998attotime hp_taco_device::time_to_rd_next_word(tape_pos_t& word_rd_pos)
999{
1000        if (m_rd_it_valid) {
1001                word_rd_pos = farthest_end(m_rd_it);
1002                return time_to_target(word_rd_pos);
1003        } else {
1004                return attotime::never;
1005        }
1006}
1007
1008/**
1009 * Scan for next "n_gaps" gaps
1010 *
1011 * @param[in,out] pos Start position on input, start of gap on output
1012 * @param it Pointer to data word where scan is to start
1013 * @param n_gaps Number of gaps to scan
1014 * @param min_gap Minimum gap size
1015 *
1016 * @return true if n_gaps gaps are found
1017 */
1018bool hp_taco_device::next_n_gap(tape_pos_t& pos , tape_track_t::iterator it , unsigned n_gaps , tape_pos_t min_gap)
1019{
1020        tape_track_t& track = current_track();
1021        bool done = false;
1022        tape_track_t::iterator prev_it;
1023
1024        if (m_tape_fwd) {
1025                tape_pos_t next_pos;
1026
1027                while (1) {
1028                        if (it == track.end()) {
1029                                next_pos = TAPE_LENGTH;
1030                                done = true;
1031                        } else {
1032                                next_pos = it->first;
1033                        }
1034                        if (((next_pos - pos) >= min_gap && --n_gaps == 0) || done) {
1035                                break;
1036                        }
1037                        adv_res_t adv_res;
1038                        do {
1039                                prev_it = it;
1040                                adv_res = adv_it(it);
1041                        } while (adv_res == ADV_CONT_DATA);
1042                        pos = word_end_pos(prev_it);
1043                }
1044        } else {
1045                tape_pos_t next_pos;
1046
1047                while (1) {
1048                        if (it == track.end()) {
1049                                next_pos = 0;
1050                                done = true;
1051                        } else {
1052                                next_pos = word_end_pos(it);
1053                        }
1054                        if (((pos - next_pos) >= min_gap && --n_gaps == 0) || done) {
1055                                break;
1056                        }
1057                        adv_res_t adv_res;
1058                        do {
1059                                prev_it = it;
1060                                adv_res = adv_it(it);
1061                        } while (adv_res == ADV_CONT_DATA);
1062                        pos = prev_it->first;
1063                }
1064        }
1065
1066        // Set "pos" where minimum gap size is met
1067        pos_offset(pos , min_gap);
1068
1069        return n_gaps == 0;
1070}
1071
1072bool hp_taco_device::next_n_gap(tape_pos_t& pos , unsigned n_gaps , tape_pos_t min_gap)
1073{
1074        tape_track_t::iterator it;
1075        // First align with next data
1076        next_data(it, pos, true);
1077        // Then scan for n_gaps
1078        return next_n_gap(pos, it, n_gaps, min_gap);
1079}
1080
1081void hp_taco_device::clear_tape(void)
1082{
1083        for (unsigned track_n = 0; track_n < 2; track_n++) {
1084                m_tracks[ track_n ].clear();
1085        }
1086}
1087
1088void hp_taco_device::dump_sequence(tape_track_t::const_iterator it_start , unsigned n_words)
1089{
1090        if (n_words) {
1091                UINT32 tmp32;
1092                UINT16 tmp16;
1093
1094                tmp32 = n_words;
1095                fwrite(&tmp32 , sizeof(tmp32));
1096                tmp32 = it_start->first;
1097                fwrite(&tmp32 , sizeof(tmp32));
1098
1099                for (unsigned i = 0; i < n_words; i++) {
1100                        tmp16 = it_start->second;
1101                        fwrite(&tmp16 , sizeof(tmp16));
1102                        it_start++;
1103                }
1104        }
1105}
1106
1107void hp_taco_device::save_tape(void)
1108{
1109        UINT32 tmp32;
1110
1111        fseek(0, SEEK_SET);
1112
1113        tmp32 = FILE_MAGIC;
1114        fwrite(&tmp32 , sizeof(tmp32));
1115
1116        for (unsigned track_n = 0; track_n < 2; track_n++) {
1117                const tape_track_t& track = m_tracks[ track_n ];
1118                tape_pos_t next_pos = (tape_pos_t)-1;
1119                unsigned n_words = 0;
1120                tape_track_t::const_iterator it_start;
1121                for (tape_track_t::const_iterator it = track.cbegin(); it != track.cend(); it++) {
1122                        if (it->first != next_pos) {
1123                                dump_sequence(it_start , n_words);
1124                                it_start = it;
1125                                n_words = 0;
1126                        }
1127                        next_pos = it->first + word_length(it->second);
1128                        n_words++;
1129                }
1130                dump_sequence(it_start , n_words);
1131                // End of track
1132                tmp32 = (UINT32)-1;
1133                fwrite(&tmp32 , sizeof(tmp32));
1134        }
1135}
1136
1137bool hp_taco_device::load_track(tape_track_t& track)
1138{
1139        UINT32 tmp32;
1140
1141        track.clear();
1142
1143        while (1) {
1144                if (fread(&tmp32 , sizeof(tmp32)) != sizeof(tmp32)) {
1145                        return false;
1146                }
1147
1148                if (tmp32 == (UINT32)-1) {
1149                        return true;
1150                }
1151
1152                unsigned n_words = tmp32;
1153
1154                if (fread(&tmp32 , sizeof(tmp32)) != sizeof(tmp32)) {
1155                        return false;
1156                }
1157
1158                tape_pos_t pos = (tape_pos_t)tmp32;
1159
1160                for (unsigned i = 0; i < n_words; i++) {
1161                        UINT16 tmp16;
1162
1163                        if (fread(&tmp16 , sizeof(tmp16)) != sizeof(tmp16)) {
1164                                return false;
1165                        }
1166
1167                        track.insert(std::make_pair(pos , tmp16));
1168                        pos += word_length(tmp16);
1169                }
1170        }
1171}
1172
1173bool hp_taco_device::load_tape(void)
1174{
1175        UINT32 magic;
1176
1177        if (fread(&magic , sizeof(magic)) != sizeof(magic) ||
1178            magic != FILE_MAGIC) {
1179                return false;
1180        }
1181
1182        for (unsigned track_n = 0; track_n < 2; track_n++) {
1183                if (!load_track(m_tracks[ track_n ])) {
1184                        LOG(("load_tape failed"));
1185                        clear_tape();
1186                        return false;
1187                }
1188        }
1189
1190        LOG(("load_tape done\n"));
1191        return true;
1192}
1193
1194void hp_taco_device::set_tape_present(bool present)
1195{
1196        if (present) {
1197                if (is_readonly()) {
1198                        BIT_SET(m_status_reg, STATUS_WPR_BIT);
1199                } else {
1200                        BIT_CLR(m_status_reg, STATUS_WPR_BIT);
1201                }
1202                // STATUS_CART_OUT_BIT is reset by CMD_CLEAR
1203        } else {
1204                BIT_SET(m_status_reg, STATUS_CART_OUT_BIT);
1205                BIT_SET(m_status_reg, STATUS_WPR_BIT);
1206        }
1207}
1208
1209attotime hp_taco_device::time_to_next_hole(void) const
1210{
1211        return time_to_target(next_hole());
1212}
1213
1214attotime hp_taco_device::time_to_tach_pulses(void) const
1215{
1216        return time_to_distance((tape_pos_t)(0x10000U - m_tach_reg) * TAPE_POS_FRACT);
1217}
1218
1219void hp_taco_device::start_cmd_exec(UINT16 new_cmd_reg)
1220{
1221        LOG(("Cmd = %02x\n" , CMD_CODE(new_cmd_reg)));
1222
1223        update_tape_pos();
1224
1225        attotime cmd_duration = attotime::never;
1226        attotime time_to_hole = attotime::never;
1227
1228        unsigned new_cmd_code = CMD_CODE(new_cmd_reg);
1229
1230        if (new_cmd_code != CMD_START_READ &&
1231            new_cmd_code != CMD_END_READ &&
1232            new_cmd_code != CMD_CLEAR) {
1233                m_rd_it_valid = false;
1234        }
1235
1236        switch (new_cmd_code) {
1237        case CMD_INDTA_INGAP:
1238                // Errors: CART OUT,FAST SPEED
1239                if (start_tape_cmd(new_cmd_reg , 0 , SPEED_FAST_MASK)) {
1240                        m_cmd_state = 0;
1241                        if (next_data(m_rd_it , m_tape_pos , true)) {
1242                                cmd_duration = time_to_target(farthest_end(m_rd_it));
1243                        }
1244                }
1245                break;
1246
1247        case CMD_FINAL_GAP:
1248                // Errors: WP,CART OUT
1249                if (start_tape_cmd(new_cmd_reg , 0 , STATUS_WPR_MASK)) {
1250                        m_rw_pos = m_tape_pos;
1251                        cmd_duration = time_to_distance(END_GAP_LENGTH);
1252                        time_to_hole = time_to_next_hole();
1253                }
1254                break;
1255
1256        case CMD_CLEAR:
1257                set_error(false);
1258                BIT_CLR(m_status_reg, STATUS_HOLE_BIT);
1259                BIT_CLR(m_status_reg, STATUS_CART_OUT_BIT);
1260                BIT_CLR(m_status_reg, STATUS_WPR_BIT);
1261                set_tape_present(is_loaded());
1262                // This is a special command: it doesn't raise IRQ at completion and it
1263                // doesn't replace current command
1264                return;
1265
1266        case CMD_NOT_INDTA:
1267                // Errors: CART OUT,FAST SPEED
1268                if (start_tape_cmd(new_cmd_reg , 0 , SPEED_FAST_MASK)) {
1269                        tape_pos_t target = m_tape_pos;
1270                        if (next_n_gap(target, 1, NO_DATA_GAP)) {
1271                                LOG_0(("End of data @%d\n" , target));
1272                                cmd_duration = time_to_target(target);
1273                        }
1274                        // Holes detected?
1275                }
1276                break;
1277
1278        case CMD_INIT_WRITE:
1279                // Errors: WP,CART OUT,fast speed,reverse
1280                if (start_tape_cmd(new_cmd_reg , DIR_FWD_MASK , STATUS_WPR_MASK | SPEED_FAST_MASK)) {
1281                        m_next_word = PREAMBLE_WORD;
1282                        m_rw_pos = m_tape_pos;
1283                        cmd_duration = time_to_distance(word_length(m_next_word));
1284                }
1285                break;
1286
1287        case CMD_STOP:
1288                if (CMD_CODE(m_cmd_reg) != CMD_STOP) {
1289                        if (m_start_time.is_never()) {
1290                                // Tape is already stopped
1291                                cmd_duration = attotime::from_usec(QUICK_CMD_USEC);
1292                        } else {
1293                                // Start braking timer
1294                                cmd_duration = attotime::from_msec(m_tape_fast ? FAST_BRAKE_MSEC : SLOW_BRAKE_MSEC);
1295                        }
1296                        m_cmd_reg = new_cmd_reg;
1297                } else {
1298                        // TODO: check if ok
1299                        return;
1300                }
1301                break;
1302
1303        case CMD_SET_TRACK:
1304                // Don't know if this command really starts the tape or not (probably it doesn't)
1305                if (start_tape_cmd(new_cmd_reg , 0 , 0)) {
1306                        // When b9 is 0, set track A/B
1307                        // When b9 is 1, ignore command (in TACO chip it has an unknown purpose)
1308                        if (!UNKNOWN_B9(new_cmd_reg)) {
1309                                if (CMD_OPT(new_cmd_reg)) {
1310                                        BIT_SET(m_status_reg, STATUS_TRACKB_BIT);
1311                                } else {
1312                                        BIT_CLR(m_status_reg, STATUS_TRACKB_BIT);
1313                                }
1314                        }
1315                        cmd_duration = attotime::from_usec(QUICK_CMD_USEC);
1316                }
1317                break;
1318
1319        case CMD_MOVE:
1320                if (start_tape_cmd(new_cmd_reg , 0 , 0)) {
1321                        time_to_hole = time_to_next_hole();
1322                }
1323                break;
1324
1325        case CMD_INGAP_MOVE:
1326                // Errors: CART OUT,FAST SPEED
1327                if (start_tape_cmd(new_cmd_reg , 0 , SPEED_FAST_MASK)) {
1328                        m_cmd_state = 0;
1329                        tape_pos_t target = m_tape_pos;
1330                        if (next_n_gap(target, 1, MIN_IRG_LENGTH)) {
1331                                LOG_0(("IRG @%d\n" , target));
1332                                cmd_duration = time_to_target(target);
1333                        }
1334                        // Holes detected?
1335                }
1336                break;
1337
1338        case CMD_WRITE_IRG:
1339                // Errors: WP,CART OUT
1340                if (start_tape_cmd(new_cmd_reg , 0 , STATUS_WPR_MASK)) {
1341                        m_rw_pos = m_tape_pos;
1342                        cmd_duration = time_to_tach_pulses();
1343                        time_to_hole = time_to_next_hole();
1344                }
1345                break;
1346
1347        case CMD_SCAN_RECORDS:
1348                // Errors: CART OUT
1349                if (start_tape_cmd(new_cmd_reg , 0 , 0)) {
1350                        m_cmd_state = 0;
1351                        if (next_data(m_rd_it , m_tape_pos , true)) {
1352                                cmd_duration = time_to_target(farthest_end(m_rd_it));
1353                        }
1354                        time_to_hole = time_to_next_hole();
1355                }
1356                break;
1357
1358        case CMD_RECORD_WRITE:
1359                // Errors: WP,CART OUT,fast speed,reverse
1360                if (start_tape_cmd(new_cmd_reg , DIR_FWD_MASK , STATUS_WPR_MASK | SPEED_FAST_MASK)) {
1361                        // Search for preamble first
1362                        m_cmd_state = 0;
1363                        m_rd_it_valid = next_data(m_rd_it , m_tape_pos , false);
1364                        cmd_duration = time_to_rd_next_word(m_rw_pos);
1365                        // Holes detected?
1366                }
1367                break;
1368
1369        case CMD_MOVE_INDTA:
1370                // Errors: CART OUT,FAST SPEED
1371                if (start_tape_cmd(new_cmd_reg , 0 , SPEED_FAST_MASK)) {
1372                        m_cmd_state = 0;
1373                        cmd_duration = time_to_tach_pulses();
1374                        // Holes detected?
1375                }
1376                break;
1377
1378        case CMD_UNK_1b:
1379                if (start_tape_cmd(new_cmd_reg , 0 , 0)) {
1380                        // Unknown purpose, but make it a NOP (it's used in "T" test of test ROM)
1381                        cmd_duration = attotime::from_usec(QUICK_CMD_USEC);
1382                }
1383                break;
1384
1385        case CMD_DELTA_MOVE_HOLE:
1386        case CMD_DELTA_MOVE_IRG:
1387                if (start_tape_cmd(new_cmd_reg , 0 , 0)) {
1388                        cmd_duration = time_to_tach_pulses();
1389                        time_to_hole = time_to_next_hole();
1390                }
1391                break;
1392
1393        case CMD_START_READ:
1394                // Yes, you can read tape backwards: test "C" does that!
1395                // Because of this DIR_FWD_MASK is not in the "must be 1" mask.
1396                if (start_tape_cmd(new_cmd_reg , 0 , SPEED_FAST_MASK)) {
1397                        // TODO: check anche m_rw_pos sforato
1398                        if (!m_rd_it_valid) {
1399                                // Search for preamble first
1400                                m_cmd_state = 0;
1401                                m_rd_it_valid = next_data(m_rd_it , m_tape_pos , false);
1402                        }
1403
1404                        cmd_duration = time_to_rd_next_word(m_rw_pos);
1405                        time_to_hole = time_to_next_hole();
1406                }
1407                break;
1408
1409        case CMD_END_READ:
1410                // This command only makes sense after CMD_START_READ
1411                if (CMD_CODE(m_cmd_reg) == CMD_START_READ && m_cmd_state == 1 &&
1412                    start_tape_cmd(new_cmd_reg , 0 , SPEED_FAST_MASK)) {
1413                        LOG_0(("END_READ %d\n" , m_rd_it_valid));
1414                        cmd_duration = time_to_rd_next_word(m_rw_pos);
1415                        time_to_hole = time_to_next_hole();
1416                }
1417                break;
1418
1419        default:
1420                LOG(("Unrecognized command\n"));
1421                break;
1422        }
1423
1424        m_tape_timer->adjust(cmd_duration);
1425        m_hole_timer->adjust(time_to_hole);
1426}
1427
1428bool hp_taco_device::call_load()
1429{
1430        LOG(("call_load %d\n" , has_been_created()));
1431        if (has_been_created()) {
1432                clear_tape();
1433                save_tape();
1434        } else if (!load_tape()) {
1435                seterror(IMAGE_ERROR_INVALIDIMAGE , "Wrong format");
1436                set_tape_present(false);
1437                return IMAGE_INIT_FAIL;
1438        }
1439
1440        m_image_dirty = false;
1441
1442        set_tape_present(true);
1443   return IMAGE_INIT_PASS;
1444}
1445
1446bool hp_taco_device::call_create(int format_type, option_resolution *format_options)
1447{
1448        LOG(("call_create %d\n" , has_been_created()));
1449        return call_load();
1450}
1451
1452void hp_taco_device::call_unload()
1453{
1454        LOG(("call_unload dirty=%d\n" , m_image_dirty));
1455        if (m_image_dirty) {
1456                save_tape();
1457                m_image_dirty = false;
1458        }
1459
1460        clear_tape();
1461        set_tape_present(false);
1462}
1463
1464const char *hp_taco_device::file_extensions() const
1465{
1466        return "hti";
1467}
trunk/src/devices/machine/hp_taco.h
r253556r253557
1// license:BSD-3-Clause
2// copyright-holders:F. Ulivi
3/*********************************************************************
4
5    hp_taco.h
6
7    HP TApe COntroller (5006-3012)
8
9*********************************************************************/
10
11#ifndef __HP_TACO_H__
12#define __HP_TACO_H__
13
14#include <map>
15
16#define MCFG_TACO_IRQ_HANDLER(_devcb) \
17        devcb = &hp_taco_device::set_irq_handler(*device , DEVCB_##_devcb);
18
19#define MCFG_TACO_FLG_HANDLER(_devcb) \
20        devcb = &hp_taco_device::set_flg_handler(*device , DEVCB_##_devcb);
21
22#define MCFG_TACO_STS_HANDLER(_devcb) \
23        devcb = &hp_taco_device::set_sts_handler(*device , DEVCB_##_devcb);
24
25class hp_taco_device : public device_t ,
26                       public device_image_interface
27{
28public:
29        // construction/destruction
30        hp_taco_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname);
31        hp_taco_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
32
33        // static configuration helpers
34        template<class _Object> static devcb_base &set_irq_handler(device_t &device, _Object object) { return downcast<hp_taco_device &>(device).m_irq_handler.set_callback(object); }
35        template<class _Object> static devcb_base &set_flg_handler(device_t &device, _Object object) { return downcast<hp_taco_device &>(device).m_flg_handler.set_callback(object); }
36        template<class _Object> static devcb_base &set_sts_handler(device_t &device, _Object object) { return downcast<hp_taco_device &>(device).m_sts_handler.set_callback(object); }
37
38        // Register read/write
39        DECLARE_WRITE16_MEMBER(reg_w);
40        DECLARE_READ16_MEMBER(reg_r);
41
42        // Flag & status read
43        DECLARE_READ_LINE_MEMBER(flg_r);
44        DECLARE_READ_LINE_MEMBER(sts_r);
45
46        // device_image_interface overrides
47   virtual bool call_load() override;
48   virtual bool call_create(int format_type, option_resolution *format_options) override;
49   virtual void call_unload() override;
50   virtual iodevice_t image_type() const override { return IO_MAGTAPE; }
51   virtual bool is_readable() const override { return true; }
52   virtual bool is_writeable() const override { return true; }
53   virtual bool is_creatable() const override { return true; }
54   virtual bool must_be_loaded() const override { return false; }
55   virtual bool is_reset_on_load() const override { return false; }
56   virtual const char *file_extensions() const override;
57   virtual const option_guide *create_option_guide() const override { return nullptr; }
58
59        // Tape position, 1 unit = 1 inch / (968 * 1024)
60        typedef INT32 tape_pos_t;
61
62        // Words stored on tape
63        typedef UINT16 tape_word_t;
64
65protected:
66        // device-level overrides
67   virtual void device_config_complete() override;
68        virtual void device_start() override;
69        virtual void device_stop() override;
70        virtual void device_reset() override;
71        virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
72
73private:
74        // Storage of tracks: mapping from a tape position to word stored there
75        typedef std::map<tape_pos_t , tape_word_t> tape_track_t;
76
77        devcb_write_line m_irq_handler;
78        devcb_write_line m_flg_handler;
79        devcb_write_line m_sts_handler;
80
81        // Registers
82        UINT16 m_data_reg;
83        bool m_data_reg_full;
84        UINT16 m_cmd_reg;
85        UINT16 m_status_reg;
86        UINT16 m_tach_reg;
87        UINT16 m_checksum_reg;
88        UINT16 m_timing_reg;
89
90        // State
91        bool m_irq;
92        bool m_flg;
93        bool m_sts;
94        UINT8 m_cmd_state;
95
96        // Tape position & motion
97        tape_pos_t m_tape_pos;
98        attotime m_start_time;  // Tape moving if != never
99        bool m_tape_fwd;
100        bool m_tape_fast;
101
102        // Timers
103        emu_timer *m_tape_timer;
104        emu_timer *m_hole_timer;
105
106        // Content of tape tracks
107        tape_track_t m_tracks[ 2 ];
108        bool m_image_dirty;
109
110        // Reading & writing
111        bool m_tape_wr;
112        tape_pos_t m_rw_pos;
113        UINT16 m_next_word;
114        tape_track_t::iterator m_rd_it;
115        bool m_rd_it_valid;
116
117        // Gap detection
118        tape_pos_t m_gap_detect_start;
119
120        typedef enum {
121                ADV_NO_MORE_DATA,
122                ADV_CONT_DATA,
123                ADV_DISCONT_DATA
124        } adv_res_t;
125
126        void clear_state(void);
127        void irq_w(bool state);
128        void set_error(bool state);
129        unsigned speed_to_tick_freq(void) const;
130        bool pos_offset(tape_pos_t& pos , tape_pos_t offset) const;
131        void move_tape_pos(tape_pos_t delta_pos);
132        void update_tape_pos(void);
133        static void ensure_a_lt_b(tape_pos_t& a , tape_pos_t& b);
134        static bool any_hole(tape_pos_t tape_pos_a , tape_pos_t tape_pos_b);
135        tape_pos_t next_hole(void) const;
136        attotime time_to_distance(tape_pos_t distance) const;
137        attotime time_to_target(tape_pos_t target) const;
138        bool start_tape_cmd(UINT16 cmd_reg , UINT16 must_be_1 , UINT16 must_be_0);
139        void start_tape(UINT16 cmd_reg);
140        void stop_tape(void);
141        tape_track_t& current_track(void);
142        static tape_pos_t word_length(tape_word_t w);
143        static tape_pos_t word_end_pos(const tape_track_t::iterator& it);
144        static void adjust_it(tape_track_t& track , tape_track_t::iterator& it , tape_pos_t pos);
145        void write_word(tape_pos_t start , tape_word_t word , tape_pos_t& length);
146        void write_gap(tape_pos_t a , tape_pos_t b);
147        bool just_gap(tape_pos_t a , tape_pos_t b);
148        tape_pos_t farthest_end(const tape_track_t::iterator& it) const;
149        bool next_data(tape_track_t::iterator& it , tape_pos_t pos , bool inclusive);
150        adv_res_t adv_it(tape_track_t::iterator& it);
151        attotime fetch_next_wr_word(void);
152        attotime time_to_rd_next_word(tape_pos_t& word_rd_pos);
153        bool next_n_gap(tape_pos_t& pos , tape_track_t::iterator it , unsigned n_gaps , tape_pos_t min_gap);
154        bool next_n_gap(tape_pos_t& pos , unsigned n_gaps , tape_pos_t min_gap);
155        void clear_tape(void);
156        void dump_sequence(tape_track_t::const_iterator it_start , unsigned n_words);
157        void save_tape(void);
158        bool load_track(tape_track_t& track);
159        bool load_tape(void);
160        void set_tape_present(bool present);
161        attotime time_to_next_hole(void) const;
162        attotime time_to_tach_pulses(void) const;
163        void start_cmd_exec(UINT16 new_cmd_reg);
164};
165
166// device type definition
167extern const device_type HP_TACO;
168
169#endif /* __HP_TACO_H__ */
trunk/src/emu/ui/auditmenu.cpp
r253556r253557
108108
109109   if (m_first)
110110   {
111      machine().ui().draw_text_box(container, _("Audit in progress..."), JUSTIFY_CENTER, 0.5f, 0.5f, UI_GREEN_COLOR);
111      machine().ui().draw_text_box(container, "Audit in progress...", JUSTIFY_CENTER, 0.5f, 0.5f, UI_GREEN_COLOR);
112112      m_first = false;
113113      return;
114114   }
trunk/src/emu/ui/barcode.cpp
r253556r253557
6969         new_barcode = m_barcode_buffer;
7070      }
7171
72      item_append(_("New Barcode:"), new_barcode, 0, ITEMREF_NEW_BARCODE);
72      item_append("New Barcode:", new_barcode, 0, ITEMREF_NEW_BARCODE);
7373
7474      // finish up the menu
7575      item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr);
76      item_append(_("Enter Code"), nullptr, 0, ITEMREF_ENTER_BARCODE);
76      item_append("Enter Code", nullptr, 0, ITEMREF_ENTER_BARCODE);
7777
7878      customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER;
7979   }
r253556r253557
115115               std::string tmp_file(m_barcode_buffer);
116116               //printf("code %s\n", m_barcode_buffer);
117117               if (!current_device()->is_valid(tmp_file.length()))
118                  machine().ui().popup_time(5, _("Barcode length invalid!"));
118                  machine().ui().popup_time(5, "Barcode length invalid!");
119119               else
120120               {
121121                  current_device()->write_code(tmp_file.c_str(), tmp_file.length());
trunk/src/emu/ui/cheatopt.cpp
r253556r253557
7575            case IPT_UI_DOWN:
7676               string = curcheat->comment();
7777               if (string != nullptr && string[0] != 0)
78                  machine().popmessage(_("Cheat Comment:\n%s"), string);
78                  machine().popmessage("Cheat Comment:\n%s", string);
7979               break;
8080         }
8181      }
r253556r253557
8888
8989         /* display the reloaded cheats */
9090         reset(UI_MENU_RESET_REMEMBER_REF);
91         machine().popmessage(_("All cheats reloaded"));
91         machine().popmessage("All cheats reloaded");
9292      }
9393
9494      /* handle autofire menu */
r253556r253557
119119   std::string subtext;
120120
121121   // add the autofire menu
122   item_append(_("Autofire Settings"), nullptr, 0, (void *)ITEMREF_CHEATS_AUTOFIRE_SETTINGS);
122   item_append("Autofire Settings", nullptr, 0, (void *)ITEMREF_CHEATS_AUTOFIRE_SETTINGS);
123123
124124   /* add a separator */
125125   item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr);
r253556r253557
137137      item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr);
138138
139139      /* add a reset all option */
140      item_append(_("Reset All"), nullptr, 0, (void *)ITEMREF_CHEATS_RESET_ALL);
140      item_append("Reset All", nullptr, 0, (void *)ITEMREF_CHEATS_RESET_ALL);
141141
142142      /* add a reload all cheats option */
143      item_append(_("Reload All"), nullptr, 0, (void *)ITEMREF_CHEATS_RELOAD_ALL);
143      item_append("Reload All", nullptr, 0, (void *)ITEMREF_CHEATS_RELOAD_ALL);
144144   }
145145}
146146
r253556r253557
256256
257257   /* add autofire toggle item */
258258   bool autofire_toggle = machine().ioport().get_autofire_toggle();
259   item_append(_("Autofire Status"), (autofire_toggle ? _("Disabled") : _("Enabled")),
259   item_append("Autofire Status", (autofire_toggle ? "Disabled" : "Enabled"),
260260         (autofire_toggle ? MENU_FLAG_RIGHT_ARROW : MENU_FLAG_LEFT_ARROW), (void *)ITEMREF_AUTOFIRE_STATUS);
261261
262262   /* iterate over the input ports and add autofire toggle items */
r253556r253557
282282            if (!autofire_toggle)
283283            {
284284               // item is enabled and can be switched to values on/off
285               item_append(field->name(), (settings.autofire ? _("On") : _("Off")),
285               item_append(field->name(), (settings.autofire ? "On" : "Off"),
286286                     (settings.autofire ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW), (void *)field);
287287            }
288288            else
289289            {
290290               // item is disabled
291               item_append(field->name(), (settings.autofire ? _("On") : _("Off")),
291               item_append(field->name(), (settings.autofire ? "On" : "Off"),
292292                     MENU_FLAG_DISABLE | MENU_FLAG_INVERT, nullptr);
293293            }
294294         }
r253556r253557
299299   if (menu_items==0)
300300   {
301301      item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr);
302      item_append(_("No buttons found on this machine!"), nullptr, MENU_FLAG_DISABLE, nullptr);
302      item_append("No buttons found on this machine!", nullptr, MENU_FLAG_DISABLE, nullptr);
303303   }
304304
305305   /* add a separator */
r253556r253557
310310   snprintf(temp_text, ARRAY_LENGTH(temp_text), "%d = %.2f Hz", value, (float)refresh/value);
311311   if (!autofire_toggle)
312312   {
313      item_append(_("Autofire Delay"), temp_text, MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW, (void *)ITEMREF_AUTOFIRE_DELAY);
313      item_append("Autofire Delay", temp_text, MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW, (void *)ITEMREF_AUTOFIRE_DELAY);
314314   }
315315   else
316316   {
317      item_append(_("Autofire Delay"), temp_text, MENU_FLAG_DISABLE | MENU_FLAG_INVERT, nullptr);
317      item_append("Autofire Delay", temp_text, MENU_FLAG_DISABLE | MENU_FLAG_INVERT, nullptr);
318318   }
319319
320320   /* add a separator */
trunk/src/emu/ui/ctrlmenu.cpp
r253556r253557
103103   float width, maxwidth = origx2 - origx1;
104104   ui_manager &mui = machine().ui();
105105
106   mui.draw_text_full(container, _("Device Mapping"), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE,
106   mui.draw_text_full(container, "Device Mapping", 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE,
107107                                 DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr);
108108   width += 2 * UI_BOX_LR_BORDER;
109109   maxwidth = MAX(maxwidth, width);
r253556r253557
123123   y1 += UI_BOX_TB_BORDER;
124124
125125   // draw the text within it
126   mui.draw_text_full(container, _("Device Mapping"), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE,
126   mui.draw_text_full(container, "Device Mapping", x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE,
127127                                 DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
128128
129129}
trunk/src/emu/ui/custmenu.cpp
r253556r253557
153153{
154154   // add main filter
155155   UINT32 arrow_flags = get_arrow_flags((int)FILTER_ALL, (int)FILTER_UNAVAILABLE, custfltr::main);
156   item_append(_("Main filter"), main_filters::text[custfltr::main], arrow_flags, (void *)(FPTR)MAIN_FILTER);
156   item_append("Main filter", main_filters::text[custfltr::main], arrow_flags, (void *)(FPTR)MAIN_FILTER);
157157
158158   // add other filters
159159   for (int x = 1; x <= custfltr::numother; x++)
r253556r253557
162162
163163      // add filter items
164164      arrow_flags = get_arrow_flags((int)FILTER_UNAVAILABLE + 1, (int)FILTER_LAST - 1, custfltr::other[x]);
165      item_append(_("Other filter"), main_filters::text[custfltr::other[x]], arrow_flags, (void *)(FPTR)(OTHER_FILTER + x));
165      item_append("Other filter", main_filters::text[custfltr::other[x]], arrow_flags, (void *)(FPTR)(OTHER_FILTER + x));
166166
167167      if (m_added)
168168         selected = item.size() - 2;
r253556r253557
189189   item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr);
190190
191191   if (custfltr::numother > 0)
192      item_append(_("Remove last filter"), nullptr, 0, (void *)(FPTR)REMOVE_FILTER);
192      item_append("Remove last filter", nullptr, 0, (void *)(FPTR)REMOVE_FILTER);
193193
194194   if (custfltr::numother < MAX_CUST_FILTER - 2)
195      item_append(_("Add filter"), nullptr, 0, (void *)(FPTR)ADD_FILTER);
195      item_append("Add filter", nullptr, 0, (void *)(FPTR)ADD_FILTER);
196196
197197   item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr);
198198   customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER;
r253556r253557
207207   ui_manager &mui = machine().ui();
208208
209209   // get the size of the text
210   mui.draw_text_full(container, _("Select custom filters:"), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER,
210   mui.draw_text_full(container, "Select custom filters:", 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER,
211211                                 DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr);
212212   width += (2.0f * UI_BOX_LR_BORDER) + 0.01f;
213213   float maxwidth = MAX(width, origx2 - origx1);
r253556r253557
227227   y1 += UI_BOX_TB_BORDER;
228228
229229   // draw the text within it
230   mui.draw_text_full(container, _("Select custom filters:"), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER,
230   mui.draw_text_full(container, "Select custom filters:", x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER,
231231                                 DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
232232}
233233
r253556r253557
438438{
439439   // add main filter
440440   UINT32 arrow_flags = get_arrow_flags((int)UI_SW_ALL, (int)UI_SW_UNAVAILABLE, sw_custfltr::main);
441   item_append(_("Main filter"), sw_filters::text[sw_custfltr::main], arrow_flags, (void *)(FPTR)MAIN_FILTER);
441   item_append("Main filter", sw_filters::text[sw_custfltr::main], arrow_flags, (void *)(FPTR)MAIN_FILTER);
442442
443443   // add other filters
444444   for (int x = 1; x <= sw_custfltr::numother; x++)
r253556r253557
447447
448448      // add filter items
449449      arrow_flags = get_arrow_flags((int)UI_SW_UNAVAILABLE + 1, (int)UI_SW_LAST - 1, sw_custfltr::other[x]);
450      item_append(_("Other filter"), sw_filters::text[sw_custfltr::other[x]], arrow_flags, (void *)(FPTR)(OTHER_FILTER + x));
450      item_append("Other filter", sw_filters::text[sw_custfltr::other[x]], arrow_flags, (void *)(FPTR)(OTHER_FILTER + x));
451451
452452      if (m_added)
453453         selected = item.size() - 2;
r253556r253557
501501   item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr);
502502
503503   if (sw_custfltr::numother > 0)
504      item_append(_("Remove last filter"), nullptr, 0, (void *)(FPTR)REMOVE_FILTER);
504      item_append("Remove last filter", nullptr, 0, (void *)(FPTR)REMOVE_FILTER);
505505
506506   if (sw_custfltr::numother < MAX_CUST_FILTER - 2)
507      item_append(_("Add filter"), nullptr, 0, (void *)(FPTR)ADD_FILTER);
507      item_append("Add filter", nullptr, 0, (void *)(FPTR)ADD_FILTER);
508508
509509   item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr);
510510
r253556r253557
520520   ui_manager &mui = machine().ui();
521521
522522   // get the size of the text
523   mui.draw_text_full(container, _("Select custom filters:"), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER,
523   mui.draw_text_full(container, "Select custom filters:", 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER,
524524                                 DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr);
525525   width += (2.0f * UI_BOX_LR_BORDER) + 0.01f;
526526   float maxwidth = MAX(width, origx2 - origx1);
r253556r253557
540540   y1 += UI_BOX_TB_BORDER;
541541
542542   // draw the text within it
543   mui.draw_text_full(container, _("Select custom filters:"), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER,
543   mui.draw_text_full(container, "Select custom filters:", x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER,
544544                                 DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
545545}
546546
trunk/src/emu/ui/dirmenu.cpp
r253556r253557
6666   m_change = _change;
6767   m_search[0] = '\0';
6868
69   // configure the starting path
69   // configure the starting's path
7070   char *dst = nullptr;
7171   osd_get_full_path(&dst, ".");
7272   m_current_path = dst;
r253556r253557
227227                  }
228228               }
229229            }
230            top_line = selected - (visible_lines / 2);
231230         }
232231      }
233232      else if (m_event->iptkey == IPT_UI_CANCEL)
trunk/src/emu/ui/filesel.cpp
r253556r253557
749749            }
750750
751751            if (selected_entry != nullptr && selected_entry != cur_selected)
752            {
753               set_selection((void *)selected_entry);
754               top_line = selected - (visible_lines / 2);
755            }
752               set_selection((void *) selected_entry);
756753         }
757754      }
758755      else if (event->iptkey == IPT_UI_CANCEL)
trunk/src/emu/ui/mainmenu.cpp
r253556r253557
5252   std::string menu_text;
5353
5454   /* add input menu items */
55   item_append(_("Input (general)"), nullptr, 0, (void *)INPUT_GROUPS);
55   item_append("Input (general)", nullptr, 0, (void *)INPUT_GROUPS);
5656
57   strprintf(menu_text, _("Input (this %s)"), emulator_info::get_capstartgamenoun());
57   strprintf(menu_text, "Input (this %s)", emulator_info::get_capstartgamenoun());
5858   item_append(menu_text.c_str(), nullptr, 0, (void *)INPUT_SPECIFIC);
5959
6060   /* add optional input-related menus */
6161   if (machine().ioport().has_analog())
62      item_append(_("Analog Controls"), nullptr, 0, (void *)ANALOG);
62      item_append("Analog Controls", nullptr, 0, (void *)ANALOG);
6363   if (machine().ioport().has_dips())
64      item_append(_("Dip Switches"), nullptr, 0, (void *)SETTINGS_DIP_SWITCHES);
64      item_append("Dip Switches", nullptr, 0, (void *)SETTINGS_DIP_SWITCHES);
6565   if (machine().ioport().has_configs())
6666   {
67      strprintf(menu_text, _("%s Configuration"), emulator_info::get_capstartgamenoun());
67      strprintf(menu_text, "%s Configuration", emulator_info::get_capstartgamenoun());
6868      item_append(menu_text.c_str(), nullptr, 0, (void *)SETTINGS_DRIVER_CONFIG);
6969   }
7070
7171   /* add bookkeeping menu */
72   item_append(_("Bookkeeping Info"), nullptr, 0, (void *)BOOKKEEPING);
72   item_append("Bookkeeping Info", nullptr, 0, (void *)BOOKKEEPING);
7373
7474   /* add game info menu */
75   strprintf(menu_text, _("%s Information"), emulator_info::get_capstartgamenoun());
75   strprintf(menu_text, "%s Information", emulator_info::get_capstartgamenoun());
7676   item_append(menu_text.c_str(), nullptr, 0, (void *)GAME_INFO);
7777
7878   image_interface_iterator imgiter(machine().root_device());
7979   if (imgiter.first() != nullptr)
8080   {
8181      /* add image info menu */
82      item_append(_("Image Information"), nullptr, 0, (void *)IMAGE_MENU_IMAGE_INFO);
82      item_append("Image Information", nullptr, 0, (void *)IMAGE_MENU_IMAGE_INFO);
8383
8484      /* add file manager menu */
85      item_append(_("File Manager"), nullptr, 0, (void *)IMAGE_MENU_FILE_MANAGER);
85      item_append("File Manager", nullptr, 0, (void *)IMAGE_MENU_FILE_MANAGER);
8686
8787      /* add tape control menu */
8888      cassette_device_iterator cassiter(machine().root_device());
8989      if (cassiter.first() != nullptr)
90         item_append(_("Tape Control"), nullptr, 0, (void *)TAPE_CONTROL);
90         item_append("Tape Control", nullptr, 0, (void *)TAPE_CONTROL);
9191   }
9292
9393      pty_interface_iterator ptyiter(machine().root_device());
9494      if (ptyiter.first() != nullptr) {
95         item_append(_("Pseudo terminals"), nullptr, 0, (void *)PTY_INFO);
95         item_append("Pseudo terminals", nullptr, 0, (void *)PTY_INFO);
9696      }
9797   if (machine().ioport().has_bioses())
98      item_append(_("Bios Selection"), nullptr, 0, (void *)BIOS_SELECTION);
98      item_append("Bios Selection", nullptr, 0, (void *)BIOS_SELECTION);
9999
100100   slot_interface_iterator slotiter(machine().root_device());
101101   if (slotiter.first() != nullptr)
102102   {
103103      /* add slot info menu */
104      item_append(_("Slot Devices"), nullptr, 0, (void *)SLOT_DEVICES);
104      item_append("Slot Devices", nullptr, 0, (void *)SLOT_DEVICES);
105105   }
106106
107107   barcode_reader_device_iterator bcriter(machine().root_device());
108108   if (bcriter.first() != nullptr)
109109   {
110110      /* add slot info menu */
111      item_append(_("Barcode Reader"), nullptr, 0, (void *)BARCODE_READ);
111      item_append("Barcode Reader", nullptr, 0, (void *)BARCODE_READ);
112112   }
113113
114114   network_interface_iterator netiter(machine().root_device());
115115   if (netiter.first() != nullptr)
116116   {
117117      /* add image info menu */
118      item_append(_("Network Devices"), nullptr, 0, (void*)NETWORK_DEVICES);
118      item_append("Network Devices", nullptr, 0, (void*)NETWORK_DEVICES);
119119   }
120120
121121   /* add keyboard mode menu */
122122   if (machine().ioport().has_keyboard() && machine().ioport().natkeyboard().can_post())
123      item_append(_("Keyboard Mode"), nullptr, 0, (void *)KEYBOARD_MODE);
123      item_append("Keyboard Mode", nullptr, 0, (void *)KEYBOARD_MODE);
124124
125125   /* add sliders menu */
126   item_append(_("Slider Controls"), nullptr, 0, (void *)SLIDERS);
126   item_append("Slider Controls", nullptr, 0, (void *)SLIDERS);
127127
128128   /* add video options menu */
129   item_append(_("Video Options"), nullptr, 0, (machine().render().target_by_index(1) != nullptr) ? (void *)VIDEO_TARGETS : (void *)VIDEO_OPTIONS);
129   item_append("Video Options", nullptr, 0, (machine().render().target_by_index(1) != nullptr) ? (void *)VIDEO_TARGETS : (void *)VIDEO_OPTIONS);
130130
131131   /* add crosshair options menu */
132132   if (machine().crosshair().get_usage())
133      item_append(_("Crosshair Options"), nullptr, 0, (void *)CROSSHAIR);
133      item_append("Crosshair Options", nullptr, 0, (void *)CROSSHAIR);
134134
135135   /* add cheat menu */
136136   if (machine().options().cheat())
137      item_append(_("Cheat"), nullptr, 0, (void *)CHEAT);
137      item_append("Cheat", nullptr, 0, (void *)CHEAT);
138138
139139   // add dats menu
140140   if (machine().ui().options().enabled_dats() && machine().datfile().has_data(&machine().system()))
141      item_append(_("External DAT View"), nullptr, 0, (void *)EXTERNAL_DATS);
141      item_append("External DAT View", nullptr, 0, (void *)EXTERNAL_DATS);
142142
143143   item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr);
144144
145145   /* add favorite menu */
146146    if (!machine().favorite().isgame_favorite())
147      item_append(_("Add To Favorites"), nullptr, 0, (void *)ADD_FAVORITE);
147      item_append("Add To Favorites", nullptr, 0, (void *)ADD_FAVORITE);
148148   else
149      item_append(_("Remove From Favorites"), nullptr, 0, (void *)REMOVE_FAVORITE);
149      item_append("Remove From Favorites", nullptr, 0, (void *)REMOVE_FAVORITE);
150150
151151   item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr);
152152
153//   menu_text.assign(_("Quit from ")).append(emulator_info::get_capstartgamenoun());
153//   menu_text.assign("Quit from ").append(emulator_info::get_capstartgamenoun());
154154//   item_append(menu_text.c_str(), nullptr, 0, (void *)QUIT_GAME);
155155
156156   /* add reset and exit menus */
157   strprintf(menu_text, _("Select New %s"), emulator_info::get_capstartgamenoun());
157   strprintf(menu_text, "Select New %s", emulator_info::get_capstartgamenoun());
158158   item_append(menu_text.c_str(), nullptr, 0, (void *)SELECT_GAME);
159159}
160160
trunk/src/emu/ui/menu.cpp
r253556r253557
13091309   star_texture = mrender.texture_alloc();
13101310   star_texture->set_bitmap(*star_bitmap, star_bitmap->cliprect(), TEXFORMAT_ARGB32);
13111311
1312   // allocate icons
1312   // allocates icons bitmap and texture
13131313   for (int i = 0; i < MAX_ICONS_RENDER; i++)
13141314   {
13151315      icons_bitmap[i] = auto_alloc(machine, bitmap_argb32);
r253556r253557
13901390      container->add_quad(0.0f, 0.0f, 1.0f, 1.0f, ARGB_WHITE, bgrnd_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
13911391
13921392   hover = item.size() + 1;
1393   visible_items = (is_swlist) ? item.size() - 2 : item.size() - 2 - skip_main_items;
1394   float extra_height = (is_swlist) ? 2.0f * line_height : (2.0f + skip_main_items) * line_height;
1393   visible_items = (is_swlist) ? item.size() - 2 : item.size() - 5;
1394   float extra_height = (is_swlist) ? 2.0f * line_height : 5.0f * line_height;
13951395   float visible_extra_menu_height = customtop + custombottom + extra_height;
13961396
13971397   // locate mouse
r253556r253557
15181518         int item_invert = pitem.flags & MENU_FLAG_INVERT;
15191519         float space = 0.0f;
15201520
1521         if (ui_globals::has_icons && !is_swlist)
1521         if (!is_swlist)
15221522         {
15231523            if (is_favorites)
15241524            {
r253556r253557
21812181   // if it fails, use the default image
21822182   if (!tmp_bitmap->valid())
21832183   {
2184      //tmp_bitmap->reset();
21842185      tmp_bitmap->allocate(256, 256);
21852186      for (int x = 0; x < 256; x++)
21862187         for (int y = 0; y < 256; y++)
r253556r253557
22252226      }
22262227
22272228      bitmap_argb32 *dest_bitmap;
2229      dest_bitmap = auto_alloc(machine(), bitmap_argb32);
22282230
22292231      // resample if necessary
22302232      if (dest_xPixel != tmp_bitmap->width() || dest_yPixel != tmp_bitmap->height())
22312233      {
2232         dest_bitmap = auto_alloc(machine(), bitmap_argb32);
22332234         dest_bitmap->allocate(dest_xPixel, dest_yPixel);
22342235         render_color color = { 1.0f, 1.0f, 1.0f, 1.0f };
22352236         render_resample_argb_bitmap_hq(*dest_bitmap, *tmp_bitmap, color, true);
r253556r253557
22372238      else
22382239         dest_bitmap = tmp_bitmap;
22392240
2241      //snapx_bitmap->reset();
22402242      snapx_bitmap->allocate(panel_width_pixel, panel_height_pixel);
22412243      int x1 = (0.5f * panel_width_pixel) - (0.5f * dest_xPixel);
22422244      int y1 = (0.5f * panel_height_pixel) - (0.5f * dest_yPixel);
r253556r253557
23152317   static const game_driver *olddriver[MAX_ICONS_RENDER] = { nullptr };
23162318   float x1 = x0 + machine().ui().get_line_height() * container->manager().ui_aspect(container);
23172319   float y1 = y0 + machine().ui().get_line_height();
2318   const game_driver *driver = (const game_driver *)selectedref;
2320   const game_driver *driver = ((FPTR)selectedref > 2) ? (const game_driver *)selectedref : nullptr;
23192321
2322   if (driver == nullptr)
2323      return;
2324
23202325   if (olddriver[linenum] != driver || ui_globals::redraw_icon)
23212326   {
23222327      olddriver[linenum] = driver;
r253556r253557
23972402
23982403         icons_texture[linenum]->set_bitmap(*icons_bitmap[linenum], icons_bitmap[linenum]->cliprect(), TEXFORMAT_ARGB32);
23992404      }
2400      else {
2401         if (icons_bitmap[linenum] != nullptr)
2402         {
2403            icons_bitmap[linenum]->reset();
2404         }
2405      }
2405      else
2406         icons_bitmap[linenum]->reset();
2407
24062408      auto_free(machine(), tmp);
24072409   }
24082410
2409   if (icons_bitmap[linenum] != nullptr && icons_bitmap[linenum]->valid())
2411   if (icons_bitmap[linenum]->valid())
24102412      container->add_quad(x0, y0, x1, y1, ARGB_WHITE, icons_texture[linenum], PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_PACKABLE);
24112413}
24122414
trunk/src/emu/ui/menu.h
r253556r253557
232232   int l_sw_hover;
233233   int l_hover;
234234   int totallines;
235   int skip_main_items;
236235
237236   // draw right box
238237   float draw_right_box_title(float x1, float y1, float x2, float y2);
trunk/src/emu/ui/selgame.cpp
r253556r253557
167167   // load drivers cache
168168   init_sorted_list();
169169
170   // check if there are available icons
171   ui_globals::has_icons = false;
172   file_enumerator path(moptions.icons_directory());
173   const osd_directory_entry *dir;
174   while ((dir = path.next()) != nullptr)
175   {
176      std::string src(dir->name);
177      if (src.find(".ico") != std::string::npos || src.find("icons") != std::string::npos)
178      {
179         ui_globals::has_icons = true;
180         break;
181      }
182   }
183
184170   // build drivers list
185171   if (!load_available_machines())
186172      build_available_list();
r253556r253557
615601      }
616602   }
617603
604   // add special items
618605   item_append(MENU_SEPARATOR_ITEM, nullptr, MENU_FLAG_UI, nullptr);
606   item_append("Configure Options", nullptr, MENU_FLAG_UI, (void *)(FPTR)1);
607   item_append("Configure Directories", nullptr, MENU_FLAG_UI, (void *)(FPTR)2);
608   item_append("Save Configuration", nullptr, MENU_FLAG_UI, (void *)(FPTR)3);
619609
620   // add special items
621   if (ui_menu::stack_has_special_main_menu())
622   {
623      item_append("Configure Options", nullptr, MENU_FLAG_UI, (void *)(FPTR)1);
624      item_append("Configure Directories", nullptr, MENU_FLAG_UI, (void *)(FPTR)2);
625      item_append("Save Configuration", nullptr, MENU_FLAG_UI, (void *)(FPTR)3);
626      skip_main_items = 3;
627   }
628   else
629      skip_main_items = 0;
630
631610   // configure the custom rendering
632611   customtop = 3.0f * machine().ui().get_line_height() + 5.0f * UI_BOX_TB_BORDER;
633612   custombottom = 5.0f * machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER;
r253556r253557
778757
779758   // determine the text to render below
780759   if (!isfavorite())
781      driver = ((FPTR)selectedref > skip_main_items) ? (const game_driver *)selectedref : nullptr;
760      driver = ((FPTR)selectedref > 3) ? (const game_driver *)selectedref : nullptr;
782761   else
783762   {
784      swinfo = ((FPTR)selectedref > skip_main_items) ? (ui_software_info *)selectedref : nullptr;
763      swinfo = ((FPTR)selectedref > 3) ? (ui_software_info *)selectedref : nullptr;
785764      if (swinfo && swinfo->startempty == 1)
786765         driver = swinfo->driver;
787766   }
r253556r253557
18661845
18671846   if (is_favorites)
18681847   {
1869      soft = ((FPTR)selectedref > skip_main_items) ? (ui_software_info *)selectedref : nullptr;
1848      soft = ((FPTR)selectedref > 3) ? (ui_software_info *)selectedref : nullptr;
18701849      if (soft && soft->startempty == 1)
18711850      {
18721851         driver = soft->driver;
r253556r253557
18771856   }
18781857   else
18791858   {
1880      driver = ((FPTR)selectedref > skip_main_items) ? (const game_driver *)selectedref : nullptr;
1859      driver = ((FPTR)selectedref > 3) ? (const game_driver *)selectedref : nullptr;
18811860      oldsoft = nullptr;
18821861   }
18831862
r253556r253557
21862165
21872166   if (is_favorites)
21882167   {
2189      soft = ((FPTR)selectedref > skip_main_items) ? (ui_software_info *)selectedref : nullptr;
2168      soft = ((FPTR)selectedref > 3) ? (ui_software_info *)selectedref : nullptr;
21902169      if (soft && soft->startempty == 1)
21912170      {
21922171         driver = soft->driver;
r253556r253557
21972176   }
21982177   else
21992178   {
2200      driver = ((FPTR)selectedref > skip_main_items) ? (const game_driver *)selectedref : nullptr;
2179      driver = ((FPTR)selectedref > 3) ? (const game_driver *)selectedref : nullptr;
22012180      oldsoft = nullptr;
22022181   }
22032182
trunk/src/emu/ui/selsoft.cpp
r253556r253557
603603
604604void ui_menu_select_software::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
605605{
606   ui_software_info *swinfo = (ui_software_info *)selectedref;
606   ui_software_info *swinfo = (FPTR)selectedref > 1 ? (ui_software_info *)selectedref : nullptr;
607607   const game_driver *driver = nullptr;
608608   ui_manager &mui = machine().ui();
609609   float width;
r253556r253557
14211421   std::vector<int> xstart;
14221422   std::vector<int> xend;
14231423   float text_size = machine().ui().options().infos_size();
1424   ui_software_info *soft = (ui_software_info *)selectedref;
1424   ui_software_info *soft = ((FPTR)selectedref > 2) ? (ui_software_info *)selectedref : nullptr;
14251425   static ui_software_info *oldsoft = nullptr;
14261426   static int old_sw_view = -1;
14271427
r253556r253557
15261526   static ui_software_info *oldsoft = nullptr;
15271527   static const game_driver *olddriver = nullptr;
15281528   const game_driver *driver = nullptr;
1529   ui_software_info *soft = (ui_software_info *)selectedref;
1529   ui_software_info *soft = ((FPTR)selectedref > 2) ? (ui_software_info *)selectedref : nullptr;
15301530
15311531   if (soft && soft->startempty == 1)
15321532   {
trunk/src/emu/ui/simpleselgame.cpp
r253556r253557
264264      item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr);
265265      item_append("Configure Options", nullptr, 0, (void *)1);
266266      item_append("Save Configuration", nullptr, 0, (void *)2);
267      skip_main_items = 2;
268267   }
269268
270269   // configure the custom rendering
r253556r253557
317316                  DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
318317
319318   // determine the text to render below
320   driver = ((FPTR)selectedref > skip_main_items) ? (const game_driver *)selectedref : nullptr;
321   if (driver != nullptr)
319   driver = ((FPTR)selectedref > 2) ? (const game_driver *)selectedref : nullptr;
320   if ((FPTR)driver > 2)
322321   {
323322      const char *gfxstat, *soundstat;
324323
trunk/src/emu/ui/swlist.cpp
r253556r253557
355355            }
356356
357357            if (selected_entry != nullptr && selected_entry != cur_selected)
358            {
359               set_selection((void *)selected_entry);
360               top_line = selected - (visible_lines / 2);
361            }
358               set_selection((void *) selected_entry);
362359         }
363360      }
364361      else if (event->iptkey == IPT_UI_CANCEL)
trunk/src/emu/ui/ui.h
r253556r253557
8585
8686#define SLIDER_NOCHANGE     0x12345678
8787
88/***************************************************************************
89    FOR FUTURE LOCALIZATION
90***************************************************************************/
91#define _(param)   param
9288
89
9390/***************************************************************************
9491    TYPE DEFINITIONS
9592***************************************************************************/
trunk/src/emu/ui/utils.cpp
r253556r253557
4848int ui_globals::visible_main_lines = 0;
4949int ui_globals::visible_sw_lines = 0;
5050UINT16 ui_globals::panels_status = 0;
51bool ui_globals::has_icons = false;
5251
5352// Custom filter
5453UINT16 custfltr::main = 0;
trunk/src/emu/ui/utils.h
r253556r253557
208208   static bool         switch_image, redraw_icon, default_image, reset;
209209   static int          visible_main_lines, visible_sw_lines;
210210   static UINT16       panels_status;
211   static bool         has_icons;
212211};
213212
214213#define main_struct(name) \
trunk/src/mame/arcade.lst
r253556r253557
41864186qtono1          // 25/12/1990 (QUIZ 3) (c) 1991 Capcom (Japan)
41874187            //  4/1991 Ashita Tenki ni Naare (golf)
41884188qsangoku        // 07/06/1991 (QUIZ 4) (c) 1991 Capcom (Japan)
4189block           // 19/12/1991 (c) 1991 Capcom (World) (Joystick version)
4190blockr1         // 06/11/1991 (c) 1991 Capcom (World) (Joystick version)
4191blockr2         // 10/09/1991 (c) 1991 Capcom (World)
4189block           // 10/09/1991 (c) 1991 Capcom (World)
41924190blockj          // 10/09/1991 (c) 1991 Capcom (Japan)
4191blockjoy        // 06/11/1991 (c) 1991 Capcom (World) (Joystick version, bad dump?)
41934192blockbl         // bootleg
41944193
41954194// Incredible Technologies games
r253556r253557
1093910938
1094010939// Success
1094110940tonton          // (c) 199? Success / Taiyo Jidoki.
10942kurukuru        // (c) 1990 Success / Taiyo Jidoki.
10941kurukuru        // (c) 199? Success / Taiyo Jidoki.
1094310942ppj             // (c) 199? Success / Taiyo Jidoki.
1094410943othello         // (c) 1984 Success.
1094510944sothello        // (c) 1986 Success / Fujiwara.
trunk/src/mame/drivers/1943.cpp
r253556r253557
825825GAME( 1987, 1943ja,   1943,  1943,   1943, _1943_state,  1943, ROT270,  "Capcom",  "1943: Midway Kaisen (Japan)", MACHINE_SUPPORTS_SAVE )
826826GAME( 1987, 1943b,    1943,  1943,   1943, _1943_state,  1943b,ROT270,  "bootleg", "1943: Battle of Midway (bootleg, hack of Japan set)", MACHINE_SUPPORTS_SAVE )
827827GAME( 1987, 1943bj,   1943,  1943,   1943, _1943_state,  1943b,ROT270,  "bootleg", "1943: Midway Kaisen (bootleg)", MACHINE_SUPPORTS_SAVE )
828GAME( 1987, 1943kai,  0,     1943,   1943, _1943_state,  1943, ROT270,  "Capcom",  "1943 Kai: Midway Kaisen (Japan)", MACHINE_SUPPORTS_SAVE )
828GAME( 1987, 1943kai,  0,     1943,   1943, _1943_state,  1943, ROT270,  "Capcom",  "1943 Kai: Midway Kaisen (Japan)", MACHINE_SUPPORTS_SAVE )
No newline at end of file
trunk/src/mame/drivers/8080bw.cpp
r253556r253557
47934793
47944794GAME( 1980, spclaser,   0,        invadpt2,  spclaser,  driver_device, 0, ROT270, "Taito", "Space Laser", MACHINE_WRONG_COLORS | MACHINE_SUPPORTS_SAVE )
47954795GAME( 1980, intruder,   spclaser, invadpt2,  spclaser,  driver_device, 0, ROT270, "Taito (Game Plan license)", "Intruder", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND )
4796GAME( 1980, laser,      spclaser, invadpt2,  spclaser,  driver_device, 0, ROT270, "bootleg (Leisure Time Electronics)", "Astro Laser (bootleg of Space Laser)", MACHINE_WRONG_COLORS | MACHINE_SUPPORTS_SAVE )
4796GAME( 1980, laser,      spclaser, invadpt2,  spclaser,  driver_device, 0, ROT270, "bootleg (Leisure Time Electronics Inc.)", "Astro Laser (bootleg of Space Laser)", MACHINE_WRONG_COLORS | MACHINE_SUPPORTS_SAVE )
47974797GAME( 1979, spcewarl,   spclaser, invadpt2,  spclaser,  driver_device, 0, ROT270, "Leijac Corporation", "Space War (Leijac Corporation)", MACHINE_WRONG_COLORS | MACHINE_SUPPORTS_SAVE ) // Taito's version is actually a spin-off of this?
47984798
47994799GAME( 1979, lrescue,    0,        lrescue,   lrescue,   driver_device, 0, ROT270, "Taito", "Lunar Rescue", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND )
trunk/src/mame/drivers/at.cpp
r253556r253557
1717#include "softlist.h"
1818
1919static ADDRESS_MAP_START( at16_map, AS_PROGRAM, 16, at_state )
20   ADDRESS_MAP_UNMAP_HIGH
2120   AM_RANGE(0x000000, 0x09ffff) AM_RAMBANK("bank10")
2221   AM_RANGE(0x0c0000, 0x0c7fff) AM_ROM
2322   AM_RANGE(0x0c8000, 0x0cffff) AM_ROM
r253556r253557
2726ADDRESS_MAP_END
2827
2928static ADDRESS_MAP_START( ps2m30286_map, AS_PROGRAM, 16, at_state)
30   AM_RANGE(0x000000, 0x09ffff) AM_RAMBANK("bank10")
29      AM_RANGE(0x000000, 0x09ffff) AM_RAMBANK("bank10")
3130   AM_RANGE(0x0c0000, 0x0c7fff) AM_ROM
3231   AM_RANGE(0x0c8000, 0x0cffff) AM_ROM
3332   AM_RANGE(0x0d0000, 0x0dffff) AM_RAM
r253556r253557
4342ADDRESS_MAP_END
4443
4544static ADDRESS_MAP_START( at386_map, AS_PROGRAM, 32, at_state )
46   ADDRESS_MAP_UNMAP_HIGH
4745   AM_RANGE(0x00000000, 0x0009ffff) AM_RAMBANK("bank10")
4846   AM_RANGE(0x000a0000, 0x000bffff) AM_NOP
4947   AM_RANGE(0x000c0000, 0x000c7fff) AM_ROM
trunk/src/mame/drivers/blmbycar.cpp
r253556r253557
4141
4242/* The top 64k of samples are banked (16 banks total) */
4343
44WRITE16_MEMBER(blmbycar_state::okibank_w)
44WRITE16_MEMBER(blmbycar_state::blmbycar_okibank_w)
4545{
4646   if (ACCESSING_BITS_0_7)
4747   {
48      membank("okibank")->set_entry(data & 0x0f);
48      UINT8 *RAM = memregion("oki")->base();
49      memcpy(&RAM[0x30000], &RAM[0x40000 + 0x10000 * (data & 0xf)], 0x10000);
4950   }
5051}
5152
r253556r253557
9798
9899***************************************************************************/
99100
100static ADDRESS_MAP_START( common_map, AS_PROGRAM, 16, blmbycar_state )
101static ADDRESS_MAP_START( blmbycar_map, AS_PROGRAM, 16, blmbycar_state )
101102   AM_RANGE(0x000000, 0x0fffff) AM_ROM
102103   AM_RANGE(0xfec000, 0xfeffff) AM_RAM
103104   AM_RANGE(0x100000, 0x103fff) AM_WRITEONLY                                               // ???
104   AM_RANGE(0x104000, 0x105fff) AM_RAM_WRITE(vram_1_w) AM_SHARE("vram_1") // Layer 1
105   AM_RANGE(0x106000, 0x107fff) AM_RAM_WRITE(vram_0_w) AM_SHARE("vram_0") // Layer 0
105   AM_RANGE(0x104000, 0x105fff) AM_RAM_WRITE(blmbycar_vram_1_w) AM_SHARE("vram_1") // Layer 1
106   AM_RANGE(0x106000, 0x107fff) AM_RAM_WRITE(blmbycar_vram_0_w) AM_SHARE("vram_0") // Layer 0
106107   AM_RANGE(0x108000, 0x10bfff) AM_WRITEONLY                                               // ???
107108   AM_RANGE(0x10c000, 0x10c003) AM_WRITEONLY AM_SHARE("scroll_1")              // Scroll 1
108109   AM_RANGE(0x10c004, 0x10c007) AM_WRITEONLY AM_SHARE("scroll_0")              // Scroll 0
r253556r253557
112113   AM_RANGE(0x444000, 0x445fff) AM_WRITEONLY AM_SHARE("spriteram")// Sprites (size?)
113114   AM_RANGE(0x700000, 0x700001) AM_READ_PORT("DSW")
114115   AM_RANGE(0x700002, 0x700003) AM_READ_PORT("P1_P2")
115   AM_RANGE(0x70000c, 0x70000d) AM_WRITE(okibank_w)                               // Sound
116   AM_RANGE(0x70000e, 0x70000f) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)  // Sound
117ADDRESS_MAP_END
118
119static ADDRESS_MAP_START( blmbycar_map, AS_PROGRAM, 16, blmbycar_state )
120   AM_IMPORT_FROM(common_map)
121
122116   AM_RANGE(0x700004, 0x700005) AM_READ(blmbycar_opt_wheel_r)                              // Wheel (optical)
123117   AM_RANGE(0x700006, 0x700007) AM_READ_PORT("UNK")
124118   AM_RANGE(0x700008, 0x700009) AM_READ(blmbycar_pot_wheel_r)                              // Wheel (potentiometer)
125119   AM_RANGE(0x70000a, 0x70000b) AM_WRITENOP                                                // ? Wheel
120   AM_RANGE(0x70000c, 0x70000d) AM_WRITE(blmbycar_okibank_w)                               // Sound
121   AM_RANGE(0x70000e, 0x70000f) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)  // Sound
126122   AM_RANGE(0x70006a, 0x70006b) AM_WRITE(blmbycar_pot_wheel_reset_w)                       // Wheel (potentiometer)
127123   AM_RANGE(0x70007a, 0x70007b) AM_WRITE(blmbycar_pot_wheel_shift_w)                       //
128124ADDRESS_MAP_END
r253556r253557
134130}
135131
136132static ADDRESS_MAP_START( watrball_map, AS_PROGRAM, 16, blmbycar_state )
137   AM_IMPORT_FROM(common_map)
138
133   AM_RANGE(0x000000, 0x0fffff) AM_ROM
134   AM_RANGE(0xfec000, 0xfeffff) AM_RAM
135   AM_RANGE(0x100000, 0x103fff) AM_WRITEONLY                                               // ???
136   AM_RANGE(0x104000, 0x105fff) AM_RAM_WRITE(blmbycar_vram_1_w) AM_SHARE("vram_1") // Layer 1
137   AM_RANGE(0x106000, 0x107fff) AM_RAM_WRITE(blmbycar_vram_0_w) AM_SHARE("vram_0") // Layer 0
138   AM_RANGE(0x108000, 0x10bfff) AM_WRITEONLY                                               // ???
139   AM_RANGE(0x10c000, 0x10c003) AM_WRITEONLY AM_SHARE("scroll_1")                  // Scroll 1
140   AM_RANGE(0x10c004, 0x10c007) AM_WRITEONLY AM_SHARE("scroll_0")                  // Scroll 0
141   AM_RANGE(0x200000, 0x2005ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_MIRROR(0x4000) // Palette
142   AM_RANGE(0x200600, 0x203fff) AM_RAM AM_MIRROR(0x4000)
143   AM_RANGE(0x440000, 0x441fff) AM_RAM
144   AM_RANGE(0x444000, 0x445fff) AM_WRITEONLY AM_SHARE("spriteram")// Sprites (size?)
145   AM_RANGE(0x700000, 0x700001) AM_READ_PORT("DSW")
146   AM_RANGE(0x700002, 0x700003) AM_READ_PORT("P1_P2")
139147   AM_RANGE(0x700006, 0x700007) AM_READNOP                                                 // read
140148   AM_RANGE(0x700008, 0x700009) AM_READ(waterball_unk_r)                                   // 0x0008 must toggle
141149   AM_RANGE(0x70000a, 0x70000b) AM_WRITEONLY                                               // ?? busy
150   AM_RANGE(0x70000c, 0x70000d) AM_WRITE(blmbycar_okibank_w)                               // Sound
151   AM_RANGE(0x70000e, 0x70000f) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)  //
142152ADDRESS_MAP_END
143153
144static ADDRESS_MAP_START( blmbycar_oki_map, AS_0, 8, blmbycar_state )
145   AM_RANGE(0x00000, 0x2ffff) AM_ROM
146   AM_RANGE(0x30000, 0x3ffff) AM_ROMBANK("okibank")
147ADDRESS_MAP_END
148
149154/***************************************************************************
150155
151156
r253556r253557
329334{
330335   save_item(NAME(m_pot_wheel));
331336   save_item(NAME(m_old_val));
332   
333   membank("okibank")->configure_entries(0, 16, memregion("oki")->base(), 0x10000);
334337}
335338
336339MACHINE_RESET_MEMBER(blmbycar_state,blmbycar)
r253556r253557
356359   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
357360   MCFG_SCREEN_SIZE(0x180, 0x100)
358361   MCFG_SCREEN_VISIBLE_AREA(0, 0x180-1, 0, 0x100-1)
359   MCFG_SCREEN_UPDATE_DRIVER(blmbycar_state, screen_update)
362   MCFG_SCREEN_UPDATE_DRIVER(blmbycar_state, screen_update_blmbycar)
360363   MCFG_SCREEN_PALETTE("palette")
361364
362365   MCFG_GFXDECODE_ADD("gfxdecode", "palette", blmbycar)
r253556r253557
368371   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
369372
370373   MCFG_OKIM6295_ADD("oki", XTAL_1MHz, OKIM6295_PIN7_HIGH) // clock frequency & pin 7 not verified
371   MCFG_DEVICE_ADDRESS_MAP(AS_0, blmbycar_oki_map)
372374   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0)
373375   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0)
374376MACHINE_CONFIG_END
r253556r253557
377379MACHINE_START_MEMBER(blmbycar_state,watrball)
378380{
379381   save_item(NAME(m_retvalue));
380   
381   membank("okibank")->configure_entries(0, 16, memregion("oki")->base(), 0x10000);
382382}
383383
384384MACHINE_RESET_MEMBER(blmbycar_state,watrball)
r253556r253557
386386   m_retvalue = 0;
387387}
388388
389static MACHINE_CONFIG_DERIVED( watrball, blmbycar )
389static MACHINE_CONFIG_START( watrball, blmbycar_state )
390390
391391   /* basic machine hardware */
392   MCFG_CPU_MODIFY("maincpu")
392   MCFG_CPU_ADD("maincpu", M68000, XTAL_24MHz/2)   /* 12MHz */
393393   MCFG_CPU_PROGRAM_MAP(watrball_map)
394   MCFG_CPU_VBLANK_INT_DRIVER("screen", blmbycar_state,  irq1_line_hold)
394395
395396   MCFG_MACHINE_START_OVERRIDE(blmbycar_state,watrball)
396397   MCFG_MACHINE_RESET_OVERRIDE(blmbycar_state,watrball)
397398
398399   /* video hardware */
399   MCFG_SCREEN_MODIFY("screen")
400   MCFG_SCREEN_ADD("screen", RASTER)
401   MCFG_SCREEN_REFRESH_RATE(60)
400402   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
403   MCFG_SCREEN_SIZE(0x180, 0x100)
401404   MCFG_SCREEN_VISIBLE_AREA(0, 0x180-1, 16, 0x100-1)
405   MCFG_SCREEN_UPDATE_DRIVER(blmbycar_state, screen_update_blmbycar)
406   MCFG_SCREEN_PALETTE("palette")
407
408   MCFG_GFXDECODE_ADD("gfxdecode", "palette", blmbycar)
409   MCFG_PALETTE_ADD("palette", 0x300)
410   MCFG_PALETTE_FORMAT(xxxxBBBBRRRRGGGG)
411
412   /* sound hardware */
413   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
414
415   MCFG_OKIM6295_ADD("oki", XTAL_1MHz, OKIM6295_PIN7_HIGH) // clock frequency & pin 7 not verified
416   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0)
417   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0)
402418MACHINE_CONFIG_END
403419
404420
r253556r253557
434450   ROM_LOAD( "bc_rom9",   0x100000, 0x080000, CRC(0337ab3d) SHA1(18c72cd640c7b599390dffaeb670f5832202bf06) )
435451   ROM_LOAD( "bc_rom10",  0x180000, 0x080000, CRC(5458917e) SHA1(c8dd5a391cc20a573e27a140b185893a8c04859e) )
436452
437   ROM_REGION( 0x100000, "oki", 0 )    /* 8 bit adpcm (banked) */
438   ROM_LOAD( "bc_rom1",     0x000000, 0x080000, CRC(ac6f8ba1) SHA1(69d2d47cdd331bde5a8973d29659b3f8520452e7) )
439   ROM_LOAD( "bc_rom2",     0x080000, 0x080000, CRC(a4bc31bf) SHA1(f3d60141a91449a73f6cec9f4bc5d95ca7911e19) )
453   ROM_REGION( 0x140000, "oki", 0 )    /* 8 bit adpcm (banked) */
454   ROM_LOAD( "bc_rom1",     0x040000, 0x080000, CRC(ac6f8ba1) SHA1(69d2d47cdd331bde5a8973d29659b3f8520452e7) )
455   ROM_LOAD( "bc_rom2",     0x0c0000, 0x080000, CRC(a4bc31bf) SHA1(f3d60141a91449a73f6cec9f4bc5d95ca7911e19) )
456   ROM_COPY( "oki", 0x040000, 0x000000,   0x040000 )
440457ROM_END
441458
442459ROM_START( blmbycaru )
r253556r253557
450467   ROM_LOAD( "bc_rom9",   0x100000, 0x080000, CRC(0337ab3d) SHA1(18c72cd640c7b599390dffaeb670f5832202bf06) )
451468   ROM_LOAD( "bc_rom10",  0x180000, 0x080000, CRC(5458917e) SHA1(c8dd5a391cc20a573e27a140b185893a8c04859e) )
452469
453   ROM_REGION( 0x100000, "oki", 0 )    /* 8 bit adpcm (banked) */
454   ROM_LOAD( "bc_rom1",     0x000000, 0x080000, CRC(ac6f8ba1) SHA1(69d2d47cdd331bde5a8973d29659b3f8520452e7) )
455   ROM_LOAD( "bc_rom2",     0x080000, 0x080000, CRC(a4bc31bf) SHA1(f3d60141a91449a73f6cec9f4bc5d95ca7911e19) )
470   ROM_REGION( 0x140000, "oki", 0 )    /* 8 bit adpcm (banked) */
471   ROM_LOAD( "bc_rom1",     0x040000, 0x080000, CRC(ac6f8ba1) SHA1(69d2d47cdd331bde5a8973d29659b3f8520452e7) )
472   ROM_LOAD( "bc_rom2",     0x0c0000, 0x080000, CRC(a4bc31bf) SHA1(f3d60141a91449a73f6cec9f4bc5d95ca7911e19) )
473   ROM_COPY( "oki", 0x040000, 0x000000,   0x040000 )
456474ROM_END
457475
458476/*
r253556r253557
460478Waterball by ABM (sticker on the pcb 12-3-96)
461479The pcb has some empty sockets, maybe it was used for other games since it has no markings.
462480
463The game has fonts identical to World Rally and obviously Blomby Car ;)
481The game has fonts identical to World rally and obiviously Blomby car ;)
464482
4654831x 68k
4664841x oki 6295
r253556r253557
482500   ROM_LOAD( "rom9.bin",   0x100000, 0x080000, CRC(122cc0ad) SHA1(27cdb19fa082089e47c5cdb44742cfd93aa23a00) )
483501   ROM_LOAD( "rom10.bin",  0x180000, 0x080000, CRC(22a2a706) SHA1(c7350a94a857e0007d7fc0076b44a3d62693cb6c) )
484502
485   ROM_REGION( 0x100000, "oki", 0 )    /* 8 bit adpcm (banked) */
486   ROM_LOAD( "rom1.bin",     0x000000, 0x080000, CRC(7f88dee7) SHA1(d493b961fa4631185a33faee7f61786430707209))
487//  ROM_LOAD( "rom2.bin",     0x080000, 0x080000, /* not populated for this game */ )
503   ROM_REGION( 0x140000, "oki", 0 )    /* 8 bit adpcm (banked) */
504   ROM_LOAD( "rom1.bin",     0x040000, 0x080000, CRC(7f88dee7) SHA1(d493b961fa4631185a33faee7f61786430707209))
505//  ROM_LOAD( "rom2.bin",     0x0c0000, 0x080000, /* not populated for this game */ )
506   ROM_COPY( "oki", 0x040000, 0x000000,   0x040000 )
488507ROM_END
489508
490509
trunk/src/mame/drivers/elecbowl.cpp
r253556r253557
66
77  Marx Series 300 Electronic Bowling Game
88  Main board:
9  * TMS1100NLL MP3403 DBS 7836 SINGAPORE (no decap)
9  * TMS1100NLL MP3403 DBS 7836 SINGAPORE
1010  * 4*SN75492 quad segment driver, 2*SN74259 8-line demultiplexer,
1111    2*CD4043 quad r/s input latch
1212  * 5 7seg LEDs, 15 lamps(10 lamps projected to bowling pins reflection),
r253556r253557
161161
162162***************************************************************************/
163163
164// output PLA is not decapped
164// output PLA is not dumped
165165static const UINT16 elecbowl_output_pla[0x20] =
166166{
167167   lA+lB+lC+lD+lE+lF,      // 0
r253556r253557
183183static MACHINE_CONFIG_START( elecbowl, elecbowl_state )
184184
185185   /* basic machine hardware */
186   MCFG_CPU_ADD("maincpu", TMS1100, 350000) // approximation - RC osc. R=33K, C=100pf
186   MCFG_CPU_ADD("maincpu", TMS1100, 350000) // RC osc. R=33K, C=100pf -> ~350kHz
187187   MCFG_TMS1XXX_OUTPUT_PLA(elecbowl_output_pla)
188188   MCFG_TMS1XXX_READ_K_CB(READ8(elecbowl_state, read_k))
189189   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(elecbowl_state, write_r))
r253556r253557
211211   ROM_LOAD( "mp3403.u9", 0x0000, 0x0800, CRC(9eabaa7d) SHA1(b1f54587ed7f2bbf3a5d49075c807296384c2b06) )
212212
213213   ROM_REGION( 867, "maincpu:mpla", 0 )
214   ROM_LOAD( "tms1100_common3_micro.pla", 0, 867, BAD_DUMP CRC(03574895) SHA1(04407cabfb3adee2ee5e4218612cb06c12c540f4) ) // not verified
214   ROM_LOAD( "tms1100_common1_micro.pla", 0, 867, BAD_DUMP CRC(62445fc9) SHA1(d6297f2a4bc7a870b76cc498d19dbb0ce7d69fec) ) // not verified
215215   ROM_REGION( 365, "maincpu:opla", 0 )
216216   ROM_LOAD( "tms1100_elecbowl_output.pla", 0, 365, NO_DUMP )
217217ROM_END
trunk/src/mame/drivers/fidel68k.cpp
r253556r253557
389389   MCFG_CPU_PROGRAM_MAP(eag_map)
390390   MCFG_CPU_PERIODIC_INT_DRIVER(fidel68k_state, irq2_line_hold, 600) // complete guess
391391
392   MCFG_NVRAM_ADD_1FILL("nvram")
392   MCFG_NVRAM_ADD_0FILL("nvram")
393393
394394   MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelz80base_state, display_decay_tick, attotime::from_msec(1))
395395   MCFG_DEFAULT_LAYOUT(layout_fidel_eag)
trunk/src/mame/drivers/fidelz80.cpp
r253556r253557
691691   }
692692}
693693
694void fidelz80base_state::display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety, bool update)
694void fidelz80base_state::display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety)
695695{
696696   set_display_size(maxx, maxy);
697697
r253556r253557
700700   for (int y = 0; y < maxy; y++)
701701      m_display_state[y] = (sety >> y & 1) ? ((setx & mask) | (1 << maxx)) : 0;
702702
703   if (update)
704      display_update();
703   display_update();
705704}
706705
707706
trunk/src/mame/drivers/galaxy.cpp
r253556r253557
255255
256256ROM_START (galaxy)
257257   ROM_REGION (0x10000, "maincpu", ROMREGION_ERASEFF)
258   ROM_LOAD ("galrom1.bin", 0x0000, 0x1000, CRC(dc970a32) SHA1(dfc92163654a756b70f5a446daf49d7534f4c739))
258   ROM_LOAD ("galrom1.bin", 0x0000, 0x1000, CRC(365f3e24) SHA1(ffc6bf2ec09eabdad76604a63f5dd697c30c4358))
259259   ROM_LOAD_OPTIONAL ("galrom2.bin", 0x1000, 0x1000, CRC(5dc5a100) SHA1(5d5ab4313a2d0effe7572bb129193b64cab002c1))
260260   ROM_REGION(0x0800, "gfx1",0)
261261   ROM_LOAD ("galchr.bin", 0x0000, 0x0800, CRC(5c3b5bb5) SHA1(19429a61dc5e55ddec3242a8f695e06dd7961f88))
r253556r253557
263263
264264ROM_START (galaxyp)
265265   ROM_REGION (0x10000, "maincpu", ROMREGION_ERASEFF)
266   ROM_LOAD ("galrom1.bin", 0x0000, 0x1000, CRC(dc970a32) SHA1(dfc92163654a756b70f5a446daf49d7534f4c739))
266   ROM_LOAD ("galrom1.bin", 0x0000, 0x1000, CRC(365f3e24) SHA1(ffc6bf2ec09eabdad76604a63f5dd697c30c4358))
267267   ROM_LOAD ("galrom2.bin", 0x1000, 0x1000, CRC(5dc5a100) SHA1(5d5ab4313a2d0effe7572bb129193b64cab002c1))
268268   ROM_LOAD ("galplus.bin", 0xe000, 0x1000, CRC(d4cfab14) SHA1(b507b9026844eeb757547679907394aa42055eee))
269269   ROM_REGION(0x0800, "gfx1",0)
r253556r253557
271271ROM_END
272272
273273/*    YEAR  NAME    PARENT  COMPAT  MACHINE INPUT   INIT    COMPANY FULLNAME */
274COMP(1983,  galaxy,     0,      0,  galaxy, galaxy, galaxy_state,   galaxy, "Voja Antonic / Elektronika inzenjering",          "Galaksija",      0)
275COMP(1985,  galaxyp,    galaxy, 0,  galaxyp,galaxyp, galaxy_state,galaxyp,"Nenad Dunjic",            "Galaksija plus", 0)
274COMP(1983,  galaxy,     0,      0,  galaxy, galaxy, galaxy_state,   galaxy, "Elektronika inzenjering",          "Galaksija",      0)
275COMP(1985,  galaxyp,    galaxy, 0,  galaxyp,galaxyp, galaxy_state,galaxyp,"Elektronika inzenjering",            "Galaksija plus", 0)
trunk/src/mame/drivers/glass.cpp
r253556r253557
66
77Driver by Manuel Abadia <emumanu+mame@gmail.com>
88
9The DS5002FP has up to 128KB undumped gameplay code making the game unplayable,
10except for the Promat licensed Korean version which is unprotected.
9The DS5002FP has up to 128KB undumped gameplay code making the game unplayable :_(
1110
1211***************************************************************************/
1312
r253556r253557
2120   m_cause_interrupt = 1;
2221}
2322
24INTERRUPT_GEN_MEMBER(glass_state::interrupt)
23INTERRUPT_GEN_MEMBER(glass_state::glass_interrupt)
2524{
2625   if (m_cause_interrupt)
2726   {
r253556r253557
5554
5655WRITE16_MEMBER(glass_state::OKIM6295_bankswitch_w)
5756{
57   UINT8 *RAM = memregion("oki")->base();
58
5859   if (ACCESSING_BITS_0_7)
59      membank("okibank")->set_entry(data & 0x0f);
60      memcpy(&RAM[0x30000], &RAM[0x40000 + (data & 0x0f) * 0x10000], 0x10000);
6061}
6162
62WRITE16_MEMBER(glass_state::coin_w)
63WRITE16_MEMBER(glass_state::glass_coin_w)
6364{
6465   switch (offset >> 3)
6566   {
r253556r253557
7879
7980static ADDRESS_MAP_START( glass_map, AS_PROGRAM, 16, glass_state )
8081   AM_RANGE(0x000000, 0x0fffff) AM_ROM                                                                     /* ROM */
81   AM_RANGE(0x100000, 0x101fff) AM_RAM_WRITE(vram_w) AM_SHARE("videoram")                            /* Video RAM */
82   AM_RANGE(0x100000, 0x101fff) AM_RAM_WRITE(glass_vram_w) AM_SHARE("videoram")                            /* Video RAM */
8283   AM_RANGE(0x102000, 0x102fff) AM_RAM                                                                     /* Extra Video RAM */
8384   AM_RANGE(0x108000, 0x108007) AM_WRITEONLY AM_SHARE("vregs")                                             /* Video Registers */
8485   AM_RANGE(0x108008, 0x108009) AM_WRITE(clr_int_w)                                                        /* CLR INT Video */
r253556r253557
8889   AM_RANGE(0x700002, 0x700003) AM_READ_PORT("DSW1")
8990   AM_RANGE(0x700004, 0x700005) AM_READ_PORT("P1")
9091   AM_RANGE(0x700006, 0x700007) AM_READ_PORT("P2")
91   AM_RANGE(0x700008, 0x700009) AM_WRITE(blitter_w)                                                  /* serial blitter */
92   AM_RANGE(0x700008, 0x700009) AM_WRITE(glass_blitter_w)                                                  /* serial blitter */
9293   AM_RANGE(0x70000c, 0x70000d) AM_WRITE(OKIM6295_bankswitch_w)                                            /* OKI6295 bankswitch */
9394   AM_RANGE(0x70000e, 0x70000f) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)              /* OKI6295 status register */
94   AM_RANGE(0x70000a, 0x70004b) AM_WRITE(coin_w)                                                     /* Coin Counters/Lockout */
95   AM_RANGE(0x70000a, 0x70004b) AM_WRITE(glass_coin_w)                                                     /* Coin Counters/Lockout */
9596   AM_RANGE(0xfec000, 0xfeffff) AM_RAM AM_SHARE("mainram")                                                 /* Work RAM (partially shared with DS5002FP) */
9697ADDRESS_MAP_END
9798
9899
99static ADDRESS_MAP_START( oki_map, AS_0, 8, glass_state )
100   AM_RANGE(0x00000, 0x2ffff) AM_ROM
101   AM_RANGE(0x30000, 0x3ffff) AM_ROMBANK("okibank")
102ADDRESS_MAP_END
103
104
105100static INPUT_PORTS_START( glass )
106101   PORT_START("DSW1")
107102   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:6,7,8")
r253556r253557
177172
178173void glass_state::machine_start()
179174{
180   membank("okibank")->configure_entries(0, 16, memregion("oki")->base(), 0x10000);
181
182175   save_item(NAME(m_cause_interrupt));
183176   save_item(NAME(m_current_bit));
184177   save_item(NAME(m_current_command));
r253556r253557
187180
188181void glass_state::machine_reset()
189182{
183   int i;
184
190185   m_cause_interrupt = 1;
191186   m_current_bit = 0;
192187   m_current_command = 0;
193188
194   for (int i = 0; i < 5; i++)
189   for (i = 0; i < 5; i++)
195190      m_blitter_serial_buffer[i] = 0;
196191}
197192
r253556r253557
200195   /* basic machine hardware */
201196   MCFG_CPU_ADD("maincpu", M68000, XTAL_24MHz/2)      /* 12 MHz verified on PCB */
202197   MCFG_CPU_PROGRAM_MAP(glass_map)
203   MCFG_CPU_VBLANK_INT_DRIVER("screen", glass_state,  interrupt)
198   MCFG_CPU_VBLANK_INT_DRIVER("screen", glass_state,  glass_interrupt)
204199
205200
206201   /* video hardware */
r253556r253557
209204   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
210205   MCFG_SCREEN_SIZE(32*16, 32*16)
211206   MCFG_SCREEN_VISIBLE_AREA(0, 368-1, 16, 256-1)
212   MCFG_SCREEN_UPDATE_DRIVER(glass_state, screen_update)
207   MCFG_SCREEN_UPDATE_DRIVER(glass_state, screen_update_glass)
213208   MCFG_SCREEN_PALETTE("palette")
214209
215210   MCFG_GFXDECODE_ADD("gfxdecode", "palette", glass)
r253556r253557
220215   MCFG_SPEAKER_STANDARD_MONO("mono")
221216
222217   MCFG_OKIM6295_ADD("oki", XTAL_1MHz, OKIM6295_PIN7_HIGH) /* 1MHz Resonator & pin 7 high verified on PCB */
223   MCFG_DEVICE_ADDRESS_MAP(AS_0, oki_map)
224218   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
225219MACHINE_CONFIG_END
226220
r253556r253557
242236   ROM_REGION( 0x100000, "gfx3", 0 )   /* 16 bitmaps (320x200, indexed colors) */
243237   ROM_LOAD( "h9.bin", 0x000000, 0x100000, CRC(b9492557) SHA1(3f5c0d696d65e1cd492763dfa749c813dd56a9bf) )
244238
245   ROM_REGION( 0x100000, "oki", 0 )    /* ADPCM samples - sound chip is OKIM6295 */
239   ROM_REGION( 0x140000, "oki", 0 )    /* ADPCM samples - sound chip is OKIM6295 */
246240   ROM_LOAD( "c1.bin", 0x000000, 0x100000, CRC(d9f075a2) SHA1(31a7a677861f39d512e9d1f51925c689e481159a) )
247241   /* 0x00000-0x2ffff is fixed, 0x30000-0x3ffff is bank switched from all the ROMs */
242   ROM_RELOAD(         0x040000, 0x100000 )
248243ROM_END
249244
250245ROM_START( glass10 ) /* Version 1.0 */
r253556r253557
265260   ROM_REGION( 0x100000, "gfx3", 0 )   /* 16 bitmaps (320x200, indexed colors) */
266261   ROM_LOAD( "h9.bin", 0x000000, 0x100000, CRC(b9492557) SHA1(3f5c0d696d65e1cd492763dfa749c813dd56a9bf) )
267262
268   ROM_REGION( 0x100000, "oki", 0 )    /* ADPCM samples - sound chip is OKIM6295 */
263   ROM_REGION( 0x140000, "oki", 0 )    /* ADPCM samples - sound chip is OKIM6295 */
269264   ROM_LOAD( "c1.bin", 0x000000, 0x100000, CRC(d9f075a2) SHA1(31a7a677861f39d512e9d1f51925c689e481159a) )
270265   /* 0x00000-0x2ffff is fixed, 0x30000-0x3ffff is bank switched from all the ROMs */
266   ROM_RELOAD(         0x040000, 0x100000 )
271267ROM_END
272268
273269ROM_START( glass10a ) /* Title screen shows "GLASS" and under that "Break Edition" on a real PCB */
r253556r253557
288284   ROM_REGION( 0x100000, "gfx3", 0 )   /* 16 bitmaps (320x200, indexed colors) */
289285   ROM_LOAD( "h9.bin", 0x000000, 0x100000, CRC(b9492557) SHA1(3f5c0d696d65e1cd492763dfa749c813dd56a9bf) )
290286
291   ROM_REGION( 0x100000, "oki", 0 )    /* ADPCM samples - sound chip is OKIM6295 */
287   ROM_REGION( 0x140000, "oki", 0 )    /* ADPCM samples - sound chip is OKIM6295 */
292288   ROM_LOAD( "c1.bin", 0x000000, 0x100000, CRC(d9f075a2) SHA1(31a7a677861f39d512e9d1f51925c689e481159a) )
293289   /* 0x00000-0x2ffff is fixed, 0x30000-0x3ffff is bank switched from all the ROMs */
290   ROM_RELOAD(         0x040000, 0x100000 )
294291ROM_END
295292
296293ROM_START( glasskr )
r253556r253557
308305   ROM_REGION( 0x100000, "gfx3", 0 )   /* 16 bitmaps (320x200, indexed colors) */
309306   ROM_LOAD( "glassk.h9", 0x000000, 0x100000, CRC(d499be4c) SHA1(204f754813be687e8dc00bfe7b5dbc4857ac8738) )
310307
311   ROM_REGION( 0x100000, "oki", 0 )    /* ADPCM samples - sound chip is OKIM6295 */
308   ROM_REGION( 0x140000, "oki", 0 )    /* ADPCM samples - sound chip is OKIM6295 */
312309   ROM_LOAD( "c1.bin", 0x000000, 0x100000, CRC(d9f075a2) SHA1(31a7a677861f39d512e9d1f51925c689e481159a) )
313310   /* 0x00000-0x2ffff is fixed, 0x30000-0x3ffff is bank switched from all the ROMs */
311   ROM_RELOAD(         0x040000, 0x100000 )
314312ROM_END
315313
316314/***************************************************************************
r253556r253557
319317
320318***************************************************************************/
321319
322void glass_state::ROM16_split_gfx( const char *src_reg, const char *dst_reg, int start, int length, int dest1, int dest2 )
320void glass_state::glass_ROM16_split_gfx( const char *src_reg, const char *dst_reg, int start, int length, int dest1, int dest2 )
323321{
324322   int i;
325323
r253556r253557
344342
345343 */
346344
347READ16_MEMBER( glass_state::mainram_r )
345READ16_MEMBER( glass_state::glass_mainram_r )
348346{
349347   UINT16 ret = m_mainram[offset];
350348   int pc = space.device().safe_pc();
351349
352350   if (offset == (0xfede96 - 0xfec000)>>1)
353351   {
354      // this address seems important, the game will abort with 'power failure' depending on some reads, presumably referring to the power to the battery
352      // this address seems important, the game will abort with 'power failure' depending on some reads, presumably refering to the power to the battery
355353
356354      // there are also various code segments like the one below
357355      /*
r253556r253557
378376   return ret;
379377}
380378
381WRITE16_MEMBER( glass_state::mainram_w )
379WRITE16_MEMBER( glass_state::glass_mainram_w )
382380{
383381   int pc = space.device().safe_pc();
384382
r253556r253557
438436   */
439437
440438   /* split ROM H13 */
441   ROM16_split_gfx("gfx2", "gfx1", 0x0000000, 0x0200000, 0x0000000, 0x0100000);
439   glass_ROM16_split_gfx("gfx2", "gfx1", 0x0000000, 0x0200000, 0x0000000, 0x0100000);
442440
443441   /* split ROM H11 */
444   ROM16_split_gfx("gfx2", "gfx1", 0x0200000, 0x0200000, 0x0200000, 0x0300000);
442   glass_ROM16_split_gfx("gfx2", "gfx1", 0x0200000, 0x0200000, 0x0200000, 0x0300000);
445443
446444}
447445
r253556r253557
451449   DRIVER_INIT_CALL(glass);
452450
453451   /* install custom handler over RAM for protection */
454   m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xfec000, 0xfeffff, read16_delegate(FUNC(glass_state::mainram_r), this), write16_delegate(FUNC(glass_state::mainram_w),this));
452   m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xfec000, 0xfeffff, read16_delegate(FUNC(glass_state::glass_mainram_r), this), write16_delegate(FUNC(glass_state::glass_mainram_w),this));
455453
456454}
457455
trunk/src/mame/drivers/goldstar.cpp
r253556r253557
67526752   128*8   /* every char takes 128 consecutive bytes */
67536753};
67546754
6755static const gfx_layout super9_charlayout =
6756{
6757   8,8,    /* 8*8 characters */
6758   4096,    /* 4096 characters */
6759   3,      /* 3 bits per pixel */
6760   { 2, 4, 6 }, /* the bitplanes are packed in one byte */
6761   { 0*8+0, 0*8+1, 1*8+0, 1*8+1, 2*8+0, 2*8+1, 3*8+0, 3*8+1 },
6762   { 0*32, 4*32, 2*32, 6*32, 1*32, 5*32, 3*32, 7*32 },
6763   32*8   /* every char takes 32 consecutive bytes */
6764};
67656755
6766static const gfx_layout super9_tilelayout =  // Green is OK. Red needs normal goldstar order...
6767{
6768   8,32,    /* 8*32 characters */
6769   256,    /* 256 tiles */
6770   4,      /* 4 bits per pixel */
6771   { 0, 2, 4, 6 },
6772   { 1, 0, 1*8+1, 1*8+0, 2*8+1, 2*8+0, 3*8+1, 3*8+0 },
6773   { 0*8, 4*8, 8*8, 12*8, 16*8, 20*8, 24*8, 28*8,
6774         32*8, 36*8, 40*8, 44*8, 48*8, 52*8, 56*8, 60*8,
6775         64*8, 68*8, 72*8, 76*8, 80*8, 84*8, 88*8, 92*8,
6776         96*8, 100*8, 104*8, 108*8, 112*8, 116*8, 120*8, 124*8 },
6777   128*8   /* every char takes 128 consecutive bytes */
6778};
67796756
6780
6781
67826757static GFXDECODE_START( goldstar )
67836758   GFXDECODE_ENTRY( "gfx1", 0, charlayout,   0, 16 )
67846759   GFXDECODE_ENTRY( "gfx2", 0, tilelayout, 128,  8 )
r253556r253557
68776852*/
68786853GFXDECODE_END
68796854
6880static GFXDECODE_START( super9 )
6881   GFXDECODE_ENTRY( "gfx1", 0, super9_charlayout,   0, 16 )
6882   GFXDECODE_ENTRY( "gfx2", 0, super9_tilelayout, 128,  8 )
6883GFXDECODE_END
68846855
6885
68866856static const gfx_layout tiles8x32_4bpp_layout =
68876857{
68886858   8,32,
r253556r253557
71837153   MCFG_SCREEN_UPDATE_DRIVER(goldstar_state, screen_update_goldstar)
71847154   MCFG_SCREEN_PALETTE("palette")
71857155
7186   MCFG_GFXDECODE_ADD("gfxdecode", "palette", super9)
7156   MCFG_GFXDECODE_ADD("gfxdecode", "palette", goldstar)
71877157   MCFG_PALETTE_ADD("palette", 256)
71887158   MCFG_PALETTE_FORMAT(BBGGGRRR)
71897159   MCFG_NVRAM_ADD_1FILL("nvram")
71907160
7191   MCFG_VIDEO_START_OVERRIDE(goldstar_state, goldstar)
7161   MCFG_VIDEO_START_OVERRIDE(goldstar_state,goldstar)
71927162
71937163   /* sound hardware */
71947164   MCFG_SPEAKER_STANDARD_MONO("mono")
r253556r253557
1201911989
1202011990
1202111991/* Super Cherry Master.
12022   Lacks of Dyna copyright. Maybe bootleg.
12023
12024   Not reels stop options.
12025   Tried any input on the real hardware without luck.   
11992   Dyna.
1202611993*/
1202711994ROM_START( scmaster )  // all roms unique
1202811995   ROM_REGION( 0x10000, "maincpu", 0 )
trunk/src/mame/drivers/hh_cop400.cpp
r253556r253557
6666   TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick);
6767   void display_update();
6868   void set_display_size(int maxx, int maxy);
69   void display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety, bool update = true);
69   void display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety);
7070
7171protected:
7272   virtual void machine_start() override;
r253556r253557
194194   m_display_maxy = maxy;
195195}
196196
197void hh_cop400_state::display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety, bool update)
197void hh_cop400_state::display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety)
198198{
199199   set_display_size(maxx, maxy);
200200
r253556r253557
203203   for (int y = 0; y < maxy; y++)
204204      m_display_state[y] = (sety >> y & 1) ? ((setx & mask) | (1 << maxx)) : 0;
205205
206   if (update)
207      display_update();
206   display_update();
208207}
209208
210209
211// generic input handlers
212
213210UINT8 hh_cop400_state::read_inputs(int columns)
214211{
215212   // active low
r253556r253557
235232
236233  Castle Toy Einstein
237234  * COP421 MCU labeled ~/927 COP421-NEZ/N
238  * 4 lamps, 1-bit sound
235  * 4 lamps, 1bit sound
239236
240237***************************************************************************/
241238
r253556r253557
280277
281278  Entex Space Invader
282279  * COP444L MCU labeled /B138 COPL444-HRZ/N INV II (die labeled HRZ COP 444L/A)
283  * 3 7seg LEDs, LED matrix and overlay mask, 1-bit sound
280  * 3 7seg LEDs, LED matrix and overlay mask, 1bit sound
284281
285282  The first version was on TMS1100 (see hh_tms1k.c), this is the reprogrammed
286283  second release with a gray case instead of black.
r253556r253557
396393
397394  Mattel Funtronics Jacks
398395  * COP410L MCU bonded directly to PCB (die labeled COP410L/B NGS)
399  * 8 LEDs, 1-bit sound
396  * 8 LEDs, 1bit sound
400397
401398***************************************************************************/
402399
r253556r253557
503500
504501  Mattel Funtronics Red Light Green Light
505502  * COP410L MCU bonded directly to PCB (die labeled COP410L/B NHZ)
506  * 14 LEDs, 1-bit sound
503  * 14 LEDs, 1bit sound
507504
508505  known releases:
509506  - USA: Funtronics Red Light Green Light
r253556r253557
598595
599596  Milton Bradley Plus One
600597  * COP410L MCU in 8-pin DIP, labeled ~/029 MM 57405 (die labeled COP410L/B NNE)
601  * 4 sensors(1 on each die side), 1-bit sound
598  * 4 sensors(1 on each die side), 1bit sound
602599
603600***************************************************************************/
604601
r253556r253557
642639
643640  Milton Bradley (Electronic) Lightfight
644641  * COP421L MCU labeled /B119 COP421L-HLA/N
645  * LED matrix, 1-bit sound
642  * LED matrix, 1bit sound
646643
647644  Xbox-shaped electronic game for 2 or more players, with long diagonal buttons
648645  next to each outer LED. The main object of the game is to pinpoint a light
trunk/src/mame/drivers/hh_hmcs40.cpp
r253556r253557
138138   TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick);
139139   void display_update();
140140   void set_display_size(int maxx, int maxy);
141   void display_matrix(int maxx, int maxy, UINT64 setx, UINT32 sety, bool update = true);
141   void display_matrix(int maxx, int maxy, UINT64 setx, UINT32 sety);
142142
143143protected:
144144   virtual void machine_start() override;
r253556r253557
267267   m_display_maxy = maxy;
268268}
269269
270void hh_hmcs40_state::display_matrix(int maxx, int maxy, UINT64 setx, UINT32 sety, bool update)
270void hh_hmcs40_state::display_matrix(int maxx, int maxy, UINT64 setx, UINT32 sety)
271271{
272272   set_display_size(maxx, maxy);
273273
r253556r253557
276276   for (int y = 0; y < maxy; y++)
277277      m_display_state[y] = (sety >> y & 1) ? ((setx & mask) | (U64(1) << maxx)) : 0;
278278
279   if (update)
280      display_update();
279   display_update();
281280}
282281
283282
284// generic input handlers
285
286283UINT16 hh_hmcs40_state::read_inputs(int columns)
287284{
288285   UINT16 ret = 0;
trunk/src/mame/drivers/hh_melps4.cpp
r253556r253557
5454   TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick);
5555   void display_update();
5656   void set_display_size(int maxx, int maxy);
57   void display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety, bool update = true);
57   void display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety);
5858
5959protected:
6060   virtual void machine_start() override;
r253556r253557
176176   m_display_maxy = maxy;
177177}
178178
179void hh_melps4_state::display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety, bool update)
179void hh_melps4_state::display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety)
180180{
181181   set_display_size(maxx, maxy);
182182
r253556r253557
185185   for (int y = 0; y < maxy; y++)
186186      m_display_state[y] = (sety >> y & 1) ? ((setx & mask) | (1 << maxx)) : 0;
187187
188   if (update)
189      display_update();
188   display_update();
190189}
191190
192191
trunk/src/mame/drivers/hh_pic16.cpp
r253556r253557
6666   TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick);
6767   void display_update();
6868   void set_display_size(int maxx, int maxy);
69   void display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety, bool update = true);
69   void display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety);
7070
7171protected:
7272   virtual void machine_start() override;
r253556r253557
186186   m_display_maxy = maxy;
187187}
188188
189void hh_pic16_state::display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety, bool update)
189void hh_pic16_state::display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety)
190190{
191191   set_display_size(maxx, maxy);
192192
r253556r253557
195195   for (int y = 0; y < maxy; y++)
196196      m_display_state[y] = (sety >> y & 1) ? ((setx & mask) | (1 << maxx)) : 0;
197197
198   if (update)
199      display_update();
198   display_update();
200199}
201200
202201
trunk/src/mame/drivers/hh_tms1k.cpp
r253556r253557
2222 @MP1030   TMS1100   1980, APF Mathemagician
2323 @MP1133   TMS1470   1979, Kosmos Astro
2424 @MP1180   TMS1100   1980, Tomy Power House Pinball
25 @MP1181   TMS1100   1979, Conic Football 2
25 *MP1181   TMS1100   1979, Conic Football 2
2626 @MP1204   TMS1100   1980, Entex Baseball 3 (6007)
2727 @MP1211   TMS1100   1980, Entex Space Invader
2828 @MP1218   TMS1100   1980, Entex Basketball 2 (6010)
r253556r253557
4848 @MP3404   TMS1100   1978, Parker Brothers Merlin
4949 @MP3405   TMS1100   1979, Coleco Amaze-A-Tron
5050 @MP3415   TMS1100   1978, Coleco Electronic Quarterback
51 @MP3435   TMS1100   1979, Coleco Zodiac
5251 @MP3438A  TMS1100   1979, Kenner Star Wars Electronic Battle Command
5352  MP3450A  TMS1100   1979, MicroVision cartridge: Blockbuster
5453  MP3454   TMS1100   1979, MicroVision cartridge: Star Trek Phaser Strike
r253556r253557
6665 @M34012   TMS1100   1980, Mattel Dungeons & Dragons - Computer Labyrinth Game
6766 *M34014   TMS1100   1981, Coleco Bowlatronic
6867  M34017   TMS1100   1981, MicroVision cartridge: Cosmic Hunter
69 @M34038   TMS1100   1982, Parker Brothers Lost Treasure
68 *M34038   TMS1100   1982, Parker Brothers Lost Treasure
7069  M34047   TMS1100   1982, MicroVision cartridge: Super Blockbuster
7170 *M34078A  TMS1100   1983, Milton Bradley Arcade Mania
7271 @MP6100A  TMS0980   1979, Ideal Electronic Detective
r253556r253557
114113#include "astro.lh"
115114#include "bankshot.lh"
116115#include "bigtrak.lh"
117#include "cnfball2.lh"
118116#include "cnsector.lh"
119117#include "comp4.lh"
120118#include "cqback.lh"
r253556r253557
129127#include "gpoker.lh"
130128#include "h2hbaseb.lh"
131129#include "h2hfootb.lh"
132#include "lostreas.lh"
133130#include "mathmagi.lh"
134131#include "merlin.lh" // clickable
135132#include "mmerlin.lh" // clickable
r253556r253557
141138#include "tandy12.lh" // clickable
142139#include "tbreakup.lh"
143140#include "tc4.lh"
144#include "zodiac.lh"
145141
146142#include "hh_tms1k_test.lh" // common test-layout - use external artwork
147143
r253556r253557
287283   }
288284}
289285
290void hh_tms1k_state::display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety, bool update)
286void hh_tms1k_state::display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety)
291287{
292288   set_display_size(maxx, maxy);
293289
r253556r253557
296292   for (int y = 0; y < maxy; y++)
297293      m_display_state[y] = (sety >> y & 1) ? ((setx & mask) | (1 << maxx)) : 0;
298294
299   if (update)
300      display_update();
295   display_update();
301296}
302297
298void hh_tms1k_state::display_matrix_seg(int maxx, int maxy, UINT32 setx, UINT32 sety, UINT16 segmask)
299{
300   // expects m_display_segmask to be not-0
301   for (int y = 0; y < maxy; y++)
302      m_display_segmask[y] &= segmask;
303303
304// generic input handlers
304   display_matrix(maxx, maxy, setx, sety);
305}
305306
307
306308UINT8 hh_tms1k_state::read_inputs(int columns)
307309{
308310   UINT8 ret = 0;
r253556r253557
357359/***************************************************************************
358360
359361  APF Mathemagician
360  * TMS1100 MCU, labeled MP1030 (no decap)
362  * TMS1100 MCU, labeled MP1030
361363  * 2 x DS8870N - Hex LED Digit Driver
362364  * 2 x DS8861N - MOS-to-LED 5-Segment Driver
363365  * 10-digit 7seg LED display(2 custom ones) + 4 LEDs, no sound
r253556r253557
394396
395397void mathmagi_state::prepare_display()
396398{
397   set_display_segmask(0xff, 0x7f);
398   display_matrix(7, 11, m_o, m_r);
399   // R0-R7: 7seg leds
400   for (int y = 0; y < 8; y++)
401   {
402      m_display_segmask[y] = 0x7f;
403      m_display_state[y] = (m_r >> y & 1) ? (m_o >> 1) : 0;
404   }
405
406   // R8: custom math symbols digit
407   // R9: custom equals digit
408   // R10: misc lamps
409   for (int y = 8; y < 11; y++)
410      m_display_state[y] = (m_r >> y & 1) ? m_o : 0;
411
412   set_display_size(8, 11);
413   display_update();
399414}
400415
401416WRITE16_MEMBER(mathmagi_state::write_r)
r253556r253557
403418   // R3,R5-R7,R9,R10: input mux
404419   m_inp_mux = (data >> 3 & 1) | (data >> 4 & 0xe) | (data >> 5 & 0x30);
405420
406   // R0-R7: 7seg leds
407   // R8: custom math symbols digit
408   // R9: custom equals digit
409   // R10: misc lamps
421   // +others:
410422   m_r = data;
411423   prepare_display();
412424}
413425
414426WRITE16_MEMBER(mathmagi_state::write_o)
415427{
416   // O1-O7: led/digit segment data
428   // O1-O7: digit segments A-G
417429   // O0: N/C
430   data = (data << 1 & 0xfe) | (data >> 7 & 1); // because opla is unknown
418431   m_o = data;
419   prepare_display();
420432}
421433
422434READ8_MEMBER(mathmagi_state::read_k)
r253556r253557
476488INPUT_PORTS_END
477489
478490
479// output PLA is not decapped
491// output PLA is not dumped
480492static const UINT16 mathmagi_output_pla[0x20] =
481493{
482494   lA+lB+lC+lD+lE+lF,      // 0
r253556r253557
516528static MACHINE_CONFIG_START( mathmagi, mathmagi_state )
517529
518530   /* basic machine hardware */
519   MCFG_CPU_ADD("maincpu", TMS1100, 175000) // approximation - RC osc. R=68K, C=82pf
531   MCFG_CPU_ADD("maincpu", TMS1100, 175000) // RC osc. R=68K, C=82pf -> ~175kHz
520532   MCFG_TMS1XXX_OUTPUT_PLA(mathmagi_output_pla)
521533   MCFG_TMS1XXX_READ_K_CB(READ8(mathmagi_state, read_k))
522534   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(mathmagi_state, write_r))
r253556r253557
536548
537549  Coleco Amaze-A-Tron, by Ralph Baer
538550  * TMS1100 MCU, labeled MP3405(die label too)
539  * 2-digit 7seg LED display + 2 LEDs(one red, one green), 1-bit sound
551  * 2-digit 7seg LED display + 2 LEDs(one red, one green), 1bit sound
540552  * 5x5 pressure-sensitive playing board
541553
542554  This is an electronic board game with a selection of 8 maze games,
r253556r253557
655667static MACHINE_CONFIG_START( amaztron, amaztron_state )
656668
657669   /* basic machine hardware */
658   MCFG_CPU_ADD("maincpu", TMS1100, 350000) // approximation - RC osc. R=33K?, C=100pf
670   MCFG_CPU_ADD("maincpu", TMS1100, 350000) // RC osc. R=33K?, C=100pf -> ~350kHz
659671   MCFG_TMS1XXX_READ_K_CB(READ8(amaztron_state, read_k))
660672   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(amaztron_state, write_r))
661673   MCFG_TMS1XXX_WRITE_O_CB(WRITE16(amaztron_state, write_o))
r253556r253557
675687
676688/***************************************************************************
677689
678  Coleco Zodiac - The Astrology Computer
679  * TMS1100 MP3435 (no decap)
680  * 8-digit 7seg display, 12 other LEDs, 1-bit sound
681 
682  As the name suggests, this is an astrologic calculator. Refer to the
683  (very extensive) manual on how to use it.
684
685***************************************************************************/
686
687class zodiac_state : public hh_tms1k_state
688{
689public:
690   zodiac_state(const machine_config &mconfig, device_type type, const char *tag)
691      : hh_tms1k_state(mconfig, type, tag)
692   { }
693
694   void prepare_display();
695   DECLARE_WRITE16_MEMBER(write_r);
696   DECLARE_WRITE16_MEMBER(write_o);
697   DECLARE_READ8_MEMBER(read_k);
698};
699
700// handlers
701
702void zodiac_state::prepare_display()
703{
704   set_display_segmask(0xff, 0x7f);
705   display_matrix(8, 10, m_o, m_r);
706}
707
708WRITE16_MEMBER(zodiac_state::write_r)
709{
710   // R10: speaker out
711   m_speaker->level_w(data >> 10 & 1);
712
713   // R0-R4,R8: input mux
714   m_inp_mux = (data & 0x1f) | (data >> 3 & 0x20);
715
716   // R0-R7: digit select
717   // R8,R9: led select
718   m_r = data & 0x3ff;
719   prepare_display();
720}
721
722WRITE16_MEMBER(zodiac_state::write_o)
723{
724   // O0-O7: digit segment/led data
725   m_o = data;
726   prepare_display();
727}
728
729READ8_MEMBER(zodiac_state::read_k)
730{
731   // K: multiplexed inputs
732   return read_inputs(6);
733}
734
735
736// config
737
738static INPUT_PORTS_START( zodiac )
739   PORT_START("IN.0") // R0
740   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3")
741   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2")
742   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1")
743   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0")
744
745   PORT_START("IN.1") // R1
746   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7")
747   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6")
748   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5")
749   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4")
750
751   PORT_START("IN.2") // R2
752   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_D) PORT_NAME("D")
753   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_NAME("A")
754   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9")
755   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8")
756
757   PORT_START("IN.3") // R3
758   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_P) PORT_NAME("P")
759   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_L) PORT_NAME("L")
760   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_J) PORT_NAME("J")
761   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_NAME("E")
762
763   PORT_START("IN.4") // R4
764   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("Enter")
765   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED )
766   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED )
767   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_DEL) PORT_NAME("Clear")
768
769   PORT_START("IN.5") // R8
770   PORT_CONFNAME( 0x03, 0x01, "Mode")
771   PORT_CONFSETTING(    0x01, "H" ) // Horoscope
772   PORT_CONFSETTING(    0x02, "P" ) // Preview
773   PORT_CONFSETTING(    0x00, "A" ) // Answer
774   PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED )
775INPUT_PORTS_END
776
777
778// output PLA is not decapped
779static const UINT16 zodiac_output_pla[0x20] =
780{
781   0x80,                   // empty/led 1/7
782   lC,                     // i/led 2/8
783   lE+lG,                  // r/led 3/9
784   lC+lE+lG,               // n
785   lF,                     // seg F/led 4/10
786   0,                      // ?
787   0,                      // ?
788   lC+lE+lF+lG,            // h
789   lB,                     // seg B/led 5/11
790   lD,                     // seg D/led 6/12
791   0,                      // ?
792   0,                      // ?
793   0,                      // ?
794   0,                      // ?
795   lA+lB+lE+lF+lG,         // P
796   0,                      // ?
797   lA+lB+lC+lD+lE+lF,      // 0
798   lB+lC,                  // 1
799   lA+lB+lD+lE+lG,         // 2
800   lA+lB+lC+lD+lG,         // 3
801   lB+lC+lF+lG,            // 4
802   lA+lC+lD+lF+lG,         // 5
803   lA+lC+lD+lE+lF+lG,      // 6
804   lA+lB+lC,               // 7
805   lA+lB+lC+lD+lE+lF+lG,   // 8
806   lA+lB+lC+lD+lF+lG,      // 9
807   lA+lB+lC+lE+lF+lG,      // A
808   lB+lC+lD+lE+lG,         // d
809   lA+lD+lE+lF+lG,         // E
810   lB+lC+lD+lE,            // J
811   lD+lE+lF,               // L
812   lB+lC+lD+lE+lF          // U
813};
814
815static MACHINE_CONFIG_START( zodiac, zodiac_state )
816
817   /* basic machine hardware */
818   MCFG_CPU_ADD("maincpu", TMS1100, 500000) // approximation - RC osc. R=18K, C=100pf
819   MCFG_TMS1XXX_OUTPUT_PLA(zodiac_output_pla)
820   MCFG_TMS1XXX_READ_K_CB(READ8(zodiac_state, read_k))
821   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(zodiac_state, write_r))
822   MCFG_TMS1XXX_WRITE_O_CB(WRITE16(zodiac_state, write_o))
823
824   MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1))
825   MCFG_DEFAULT_LAYOUT(layout_zodiac)
826
827   /* sound hardware */
828   MCFG_SPEAKER_STANDARD_MONO("mono")
829   MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0)
830   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
831MACHINE_CONFIG_END
832
833
834
835
836
837/***************************************************************************
838
839690  Coleco Electronic Quarterback
840691  * TMS1100NLL MP3415 (die labeled MP3415)
841  * 9-digit LED grid, 1-bit sound
692  * 9-digit LED grid, 1bit sound
842693
843694  known releases:
844695  - USA(1): Electronic Quarterback
r253556r253557
949800
950801  Coleco Head to Head Football
951802  * TMS1100NLLE (rev. E!) MP3460 (die labeled MP3460)
952  * 2*SN75492N LED display drivers, 9-digit LED grid, 1-bit sound
803  * 2*SN75492N LED display drivers, 9-digit LED grid, 1bit sound
953804
954805  known releases:
955806  - USA(1): Head to Head Football
r253556r253557
1041892static MACHINE_CONFIG_START( h2hfootb, h2hfootb_state )
1042893
1043894   /* basic machine hardware */
1044   MCFG_CPU_ADD("maincpu", TMS1100, 310000) // approximation - RC osc. R=39K, C=100pf
895   MCFG_CPU_ADD("maincpu", TMS1100, 310000) // approximation - RC osc. R=39K, C=100pf, but unknown RC curve
1045896   MCFG_TMS1XXX_READ_K_CB(READ8(h2hfootb_state, read_k))
1046897   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(h2hfootb_state, write_r))
1047898   MCFG_TMS1XXX_WRITE_O_CB(WRITE16(h2hfootb_state, write_o))
r253556r253557
1064915  Coleco Head to Head Baseball
1065916  * PCB labels Coleco rev C 73891/2
1066917  * TMS1170NLN MP1525-N2 (die labeled MP1525)
1067  * 9-digit cyan VFD display, and other LEDs behind bezel, 1-bit sound
918  * 9-digit cyan VFD display, and other LEDs behind bezel, 1bit sound
1068919
1069920  known releases:
1070921  - USA: Head to Head Baseball
r253556r253557
12031054
12041055  Coleco Total Control 4
12051056  * TMS1400NLL MP7334-N2 (die labeled MP7334)
1206  * 2x2-digit 7seg LED display + 4 LEDs, LED grid display, 1-bit sound
1057  * 2x2-digit 7seg LED display + 4 LEDs, LED grid display, 1bit sound
12071058
12081059  This is a head to head electronic tabletop LED-display sports console.
12091060  One cartridge(Football) was included with the console, the other three were
r253556r253557
13371188static MACHINE_CONFIG_START( tc4, tc4_state )
13381189
13391190   /* basic machine hardware */
1340   MCFG_CPU_ADD("maincpu", TMS1400, 450000) // approximation - RC osc. R=27.3K, C=100pf
1191   MCFG_CPU_ADD("maincpu", TMS1400, 450000) // approximation - RC osc. R=27.3K, C=100pf, but unknown RC curve
13411192   MCFG_TMS1XXX_READ_K_CB(READ8(tc4_state, read_k))
13421193   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(tc4_state, write_r))
13431194   MCFG_TMS1XXX_WRITE_O_CB(WRITE16(tc4_state, write_o))
r253556r253557
13571208
13581209/***************************************************************************
13591210
1360  Conic Electronic Football II
1361  * TMS1100 MP1181 (no decap)
1362  * 9-digit LED grid, 1-bit sound
1363 
1364  This is a clone of Coleco's Quarterback, similar at hardware-level too.
1365  It was also sold by Tandy under the same title.
1366
1367***************************************************************************/
1368
1369class cnfball2_state : public hh_tms1k_state
1370{
1371public:
1372   cnfball2_state(const machine_config &mconfig, device_type type, const char *tag)
1373      : hh_tms1k_state(mconfig, type, tag)
1374   { }
1375
1376   void prepare_display();
1377   DECLARE_WRITE16_MEMBER(write_r);
1378   DECLARE_WRITE16_MEMBER(write_o);
1379   DECLARE_READ8_MEMBER(read_k);
1380};
1381
1382// handlers
1383
1384void cnfball2_state::prepare_display()
1385{
1386   // R1 selects between segments B/C or A'/D'
1387   UINT16 seg = m_o;
1388   if (~m_r & 2)
1389      seg = (m_o << 7 & 0x300) | (m_o & 0xf9);
1390   
1391   set_display_segmask(0x1ff, 0xff);
1392   display_matrix(11, 9, seg, m_r >> 1 & 0x1ff);
1393}
1394
1395WRITE16_MEMBER(cnfball2_state::write_r)
1396{
1397   // R0: speaker out
1398   m_speaker->level_w(data & 1);
1399
1400   // R8-R10: input mux
1401   m_inp_mux = data >> 8 & 7;
1402   
1403   // R1-R10: select digit/segment
1404   m_r = data;
1405   prepare_display();
1406}
1407
1408WRITE16_MEMBER(cnfball2_state::write_o)
1409{
1410   // O0-O7: digit segments
1411   m_o = data;
1412   prepare_display();
1413}
1414
1415READ8_MEMBER(cnfball2_state::read_k)
1416{
1417   // K: multiplexed inputs
1418   return read_inputs(3);
1419}
1420
1421
1422// config
1423
1424static INPUT_PORTS_START( cnfball2 )
1425   PORT_START("IN.0") // R8
1426   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
1427   PORT_CONFNAME( 0x02, 0x00, "Factory Test" )
1428   PORT_CONFSETTING(    0x00, DEF_STR( Off ) )
1429   PORT_CONFSETTING(    0x02, DEF_STR( On ) )
1430   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_TOGGLE PORT_NAME("Play Selector") // pass/run
1431   PORT_CONFNAME( 0x08, 0x00, "Skill Level" )
1432   PORT_CONFSETTING(    0x00, "1" ) // college
1433   PORT_CONFSETTING(    0x08, "2" ) // professional
1434
1435   PORT_START("IN.1") // R9
1436   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_16WAY
1437   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_16WAY
1438   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_16WAY
1439   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_16WAY
1440
1441   PORT_START("IN.2") // R10
1442   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Kick/Pass")
1443   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 ) PORT_NAME("Score")
1444   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 ) PORT_NAME("Status")
1445   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
1446INPUT_PORTS_END
1447
1448
1449// output PLA is not decapped
1450static const UINT16 cnfball2_output_pla[0x20] =
1451{
1452   // first half was dumped electronically
1453   0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f, 0x40, 0x01, 0x08, 0x02, 0x04, 0x00,
1454
1455   // rest is unknown
1456   0, 0, 0, 0, 0, 0, 0, 0,
1457   0, 0, 0, 0, 0, 0, 0, 0
1458};
1459
1460static MACHINE_CONFIG_START( cnfball2, cnfball2_state )
1461
1462   /* basic machine hardware */
1463   MCFG_CPU_ADD("maincpu", TMS1100, 375000) // approximation - RC osc. R=47K, C=47pf
1464   MCFG_TMS1XXX_OUTPUT_PLA(cnfball2_output_pla)
1465   MCFG_TMS1XXX_READ_K_CB(READ8(cnfball2_state, read_k))
1466   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(cnfball2_state, write_r))
1467   MCFG_TMS1XXX_WRITE_O_CB(WRITE16(cnfball2_state, write_o))
1468
1469   MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1))
1470   MCFG_DEFAULT_LAYOUT(layout_cnfball2)
1471
1472   /* sound hardware */
1473   MCFG_SPEAKER_STANDARD_MONO("mono")
1474   MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0)
1475   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
1476MACHINE_CONFIG_END
1477
1478
1479
1480
1481
1482/***************************************************************************
1483
14841211  Entex (Electronic) Baseball (1)
14851212  * TMS1000NLP MP0914 (die labeled MP0914A)
1486  * 1 7seg LED, and other LEDs behind bezel, 1-bit sound
1213  * 1 7seg LED, and other LEDs behind bezel, 1bit sound
14871214
14881215  This is a handheld LED baseball game. One player controls the batter, the CPU
14891216  or other player controls the pitcher. Pitcher throw buttons are on a 'joypad'
r253556r253557
15961323static MACHINE_CONFIG_START( ebball, ebball_state )
15971324
15981325   /* basic machine hardware */
1599   MCFG_CPU_ADD("maincpu", TMS1000, 375000) // approximation - RC osc. R=43K, C=47pf
1326   MCFG_CPU_ADD("maincpu", TMS1000, 375000) // RC osc. R=43K, C=47pf -> ~375kHz
16001327   MCFG_TMS1XXX_READ_K_CB(READ8(ebball_state, read_k))
16011328   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ebball_state, write_r))
16021329   MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ebball_state, write_o))
r253556r253557
16191346  Entex (Electronic) Baseball 2
16201347  * PCBs are labeled: ZENY
16211348  * TMS1000 MCU, MP0923 (die labeled MP0923)
1622  * 3 7seg LEDs, and other LEDs behind bezel, 1-bit sound
1349  * 3 7seg LEDs, and other LEDs behind bezel, 1bit sound
16231350
16241351  The Japanese version was published by Gakken, black casing instead of white.
16251352
r253556r253557
17211448static MACHINE_CONFIG_START( ebball2, ebball2_state )
17221449
17231450   /* basic machine hardware */
1724   MCFG_CPU_ADD("maincpu", TMS1000, 350000) // approximation - RC osc. R=47K, C=47pf
1451   MCFG_CPU_ADD("maincpu", TMS1000, 350000) // RC osc. R=47K, C=47pf -> ~350kHz
17251452   MCFG_TMS1XXX_READ_K_CB(READ8(ebball2_state, read_k))
17261453   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ebball2_state, write_r))
17271454   MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ebball2_state, write_o))
r253556r253557
17451472  * PCBs are labeled: ZENY
17461473  * TMS1100NLL 6007 MP1204 (rev. E!) (die labeled MP1204)
17471474  * 2*SN75492N LED display driver
1748  * 4 7seg LEDs, and other LEDs behind bezel, 1-bit sound
1475  * 4 7seg LEDs, and other LEDs behind bezel, 1bit sound
17491476
17501477  This is another improvement over Entex Baseball, where gameplay is a bit more
17511478  varied. Like the others, the pitcher controls are on a separate joypad.
r253556r253557
19241651
19251652  Entex Space Invader
19261653  * TMS1100 MP1211 (die labeled MP1211)
1927  * 3 7seg LEDs, LED matrix and overlay mask, 1-bit sound
1654  * 3 7seg LEDs, LED matrix and overlay mask, 1bit sound
19281655
19291656  There are two versions of this game: the first release(this one) is on
19301657  TMS1100, the second more widespread release runs on a COP400. There are
r253556r253557
20381765
20391766  Entex Color Football 4
20401767  * TMS1670 6009 MP7551 (die also labeled MP7551)
2041  * 9-digit cyan VFD display, 60 red and green LEDs behind bezel, 1-bit sound
1768  * 9-digit cyan VFD display, 60 red and green LEDs behind bezel, 1bit sound
20421769
20431770***************************************************************************/
20441771
r253556r253557
21331860static MACHINE_CONFIG_START( efootb4, efootb4_state )
21341861
21351862   /* basic machine hardware */
2136   MCFG_CPU_ADD("maincpu", TMS1670, 475000) // approximation - RC osc. R=42K, C=47pf
1863   MCFG_CPU_ADD("maincpu", TMS1670, 475000) // approximation - RC osc. R=42K, C=47pf, but unknown RC curve
21371864   MCFG_TMS1XXX_READ_K_CB(READ8(efootb4_state, read_k))
21381865   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(efootb4_state, write_r))
21391866   MCFG_TMS1XXX_WRITE_O_CB(WRITE16(efootb4_state, write_o))
r253556r253557
21551882
21561883  Entex (Electronic) Basketball 2
21571884  * TMS1100 6010 MP1218 (die also labeled MP1218)
2158  * 4 7seg LEDs, and other LEDs behind bezel, 1-bit sound
1885  * 4 7seg LEDs, and other LEDs behind bezel, 1bit sound
21591886
21601887  lamp translation table: led zz from game PCB = MAME lampyx:
21611888
r253556r253557
22561983static MACHINE_CONFIG_START( ebaskb2, ebaskb2_state )
22571984
22581985   /* basic machine hardware */
2259   MCFG_CPU_ADD("maincpu", TMS1100, 360000) // approximation - RC osc. R=33K, C=82pf
1986   MCFG_CPU_ADD("maincpu", TMS1100, 360000) // RC osc. R=33K, C=82pf -> ~360kHz
22601987   MCFG_TMS1XXX_READ_K_CB(READ8(ebaskb2_state, read_k))
22611988   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ebaskb2_state, write_r))
22621989   MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ebaskb2_state, write_o))
r253556r253557
22782005
22792006  Entex Raise The Devil
22802007  * TMS1100 MP1221 (die labeled MP1221)
2281  * 4 7seg LEDs(rightmost one unused), and other LEDs behind bezel, 1-bit sound
2008  * 4 7seg LEDs(rightmost one unused), and other LEDs behind bezel, 1bit sound
22822009
22832010  lamp translation table: led zz from game PCB = MAME lampyx:
22842011
r253556r253557
24522179
24532180void gpoker_state::prepare_display()
24542181{
2455   set_display_segmask(0x7ff, 0x7f);
2456   display_matrix(12, 11, m_o | (m_r >> 3 & 0xf00), m_r & 0x7ff);
2182   memset(m_display_segmask, ~0, sizeof(m_display_segmask));
2183   display_matrix_seg(12, 11, m_o | (m_r >> 3 & 0xf00), m_r & 0x7ff, 0x7f);
24572184}
24582185
24592186WRITE16_MEMBER(gpoker_state::write_r)
r253556r253557
25432270static MACHINE_CONFIG_START( gpoker, gpoker_state )
25442271
25452272   /* basic machine hardware */
2546   MCFG_CPU_ADD("maincpu", TMS1370, 350000) // approximation - RC osc. R=47K, C=47pf
2273   MCFG_CPU_ADD("maincpu", TMS1370, 350000) // RC osc. R=47K, C=47pf -> ~350kHz
25472274   MCFG_TMS1XXX_READ_K_CB(READ8(gpoker_state, read_k))
25482275   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(gpoker_state, write_r))
25492276   MCFG_TMS1XXX_WRITE_O_CB(WRITE16(gpoker_state, write_o))
r253556r253557
26562383static MACHINE_CONFIG_START( gjackpot, gjackpot_state )
26572384
26582385   /* basic machine hardware */
2659   MCFG_CPU_ADD("maincpu", TMS1670, 450000) // approximation - RC osc. R=47K, C=47pf
2386   MCFG_CPU_ADD("maincpu", TMS1670, 450000) // approximation - RC osc. R=47K, C=47pf, but unknown RC curve
26602387   MCFG_TMS1XXX_READ_K_CB(READ8(gpoker_state, read_k))
26612388   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(gjackpot_state, write_r))
26622389   MCFG_TMS1XXX_WRITE_O_CB(WRITE16(gpoker_state, write_o))
r253556r253557
26782405
26792406  Ideal Electronic Detective
26802407  * TMS0980NLL MP6100A (die labeled 0980B-00)
2681  * 10-digit 7seg LED display, 2-level sound
2408  * 10-digit 7seg LED display, 1bit sound
26822409
2683  hardware (and concept) is very similar to Parker Brothers Stop Thief
2410  hardware (and concept) is very similar to Parker Bros Stop Thief
26842411
26852412  This is an electronic board game. It requires game cards with suspect info,
26862413  and good old pen and paper to record game progress. To start the game, enter
r253556r253557
27052432
27062433WRITE16_MEMBER(elecdet_state::write_r)
27072434{
2708   // R7,R8: speaker out
2709   m_speaker->level_w((m_o & 0x80) ? (data >> 7 & 3) : 0);
2435   // R7,R8: speaker on
2436   m_speaker->level_w((data & 0x180 && m_o & 0x80) ? 1 : 0);
27102437
27112438   // R0-R6: select digit
2712   set_display_segmask(0x7f, 0x7f);
2713   display_matrix(7, 7, BITSWAP8(m_o,7,5,2,1,4,0,6,3), data);
2439   memset(m_display_segmask, ~0, sizeof(m_display_segmask));
2440   display_matrix_seg(7, 7, BITSWAP8(m_o,7,5,2,1,4,0,6,3), data, 0x7f);
27142441}
27152442
27162443WRITE16_MEMBER(elecdet_state::write_o)
r253556r253557
27192446   m_inp_mux = (data & 3) | (data >> 2 & 4) | (data >> 3 & 8);
27202447
27212448   // O0-O6: digit segments A-G
2722   // O7: speaker on -> write_r
2449   // O7: speaker out -> write_r
27232450   m_o = data;
27242451}
27252452
r253556r253557
27792506   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)false)
27802507INPUT_PORTS_END
27812508
2782
2783static const INT16 elecdet_speaker_levels[4] = { 0, 0x3fff, 0x3fff, 0x7fff };
2784
27852509static MACHINE_CONFIG_START( elecdet, elecdet_state )
27862510
27872511   /* basic machine hardware */
r253556r253557
27972521   /* sound hardware */
27982522   MCFG_SPEAKER_STANDARD_MONO("mono")
27992523   MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0)
2800   MCFG_SPEAKER_LEVELS(4, elecdet_speaker_levels)
28012524   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
28022525MACHINE_CONFIG_END
28032526
r253556r253557
28092532
28102533  Kenner Star Wars - Electronic Battle Command
28112534  * TMS1100 MCU, labeled MP3438A
2812  * 4x4 LED grid display + 2 separate LEDs and 2-digit 7segs, 1-bit sound
2535  * 4x4 LED grid display + 2 separate LEDs and 2-digit 7segs, 1bit sound
28132536
28142537  This is a small tabletop space-dogfighting game. To start the game,
28152538  press BASIC/INTER/ADV and enter P#(number of players), then
r253556r253557
29132636static MACHINE_CONFIG_START( starwbc, starwbc_state )
29142637
29152638   /* basic machine hardware */
2916   MCFG_CPU_ADD("maincpu", TMS1100, 325000) // approximation - RC osc. R=51K, C=47pf
2639   MCFG_CPU_ADD("maincpu", TMS1100, 325000) // RC osc. R=51K, C=47pf -> ~325kHz
29172640   MCFG_TMS1XXX_READ_K_CB(READ8(starwbc_state, read_k))
29182641   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(starwbc_state, write_r))
29192642   MCFG_TMS1XXX_WRITE_O_CB(WRITE16(starwbc_state, write_o))
r253556r253557
29592682
29602683void astro_state::prepare_display()
29612684{
2962   set_display_segmask(0x3ff, 0xff);
2963   display_matrix(8, 10, m_o, m_r);
2685   memset(m_display_segmask, ~0, sizeof(m_display_segmask));
2686   display_matrix_seg(8, 10, m_o, m_r, 0xff);
29642687}
29652688
29662689WRITE16_MEMBER(astro_state::write_r)
r253556r253557
30402763static MACHINE_CONFIG_START( astro, astro_state )
30412764
30422765   /* basic machine hardware */
3043   MCFG_CPU_ADD("maincpu", TMS1470, 450000) // approximation - RC osc. R=4.7K, C=33pf
2766   MCFG_CPU_ADD("maincpu", TMS1470, 450000) // approximation - RC osc. R=4.7K, C=33pf, but unknown RC curve
30442767   MCFG_TMS1XXX_READ_K_CB(READ8(astro_state, read_k))
30452768   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(astro_state, write_r))
30462769   MCFG_TMS1XXX_WRITE_O_CB(WRITE16(astro_state, write_o))
r253556r253557
30592782
30602783  Mattel Dungeons & Dragons - Computer Labyrinth Game
30612784  * TMS1100 M34012-N2LL (die labeled M34012)
3062  * 72 buttons, no LEDs, 1-bit sound
2785  * 72 buttons, no LEDs, 1bit sound
30632786
30642787  This is an electronic board game. It requires markers and wall pieces to play.
30652788  Refer to the official manual for more information.
r253556r253557
32282951static MACHINE_CONFIG_START( mdndclab, mdndclab_state )
32292952
32302953   /* basic machine hardware */
3231   MCFG_CPU_ADD("maincpu", TMS1100, 500000) // approximation - RC osc. R=27K, C=100pf
2954   MCFG_CPU_ADD("maincpu", TMS1100, 500000) // approximation - RC osc. R=27K, C=100pf, but unknown RC curve
32322955   MCFG_TMS1XXX_READ_K_CB(READ8(mdndclab_state, read_k))
32332956   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(mdndclab_state, write_r))
32342957   MCFG_TMS1XXX_WRITE_O_CB(WRITE16(mdndclab_state, write_o))
r253556r253557
33533076
33543077  Revision A hardware:
33553078  * TMS1000 (die labeled MP3226)
3356  * DS75494 Hex digit LED driver, 4 big lamps, 1-bit sound
3079  * DS75494 Hex digit LED driver, 4 big lamps, 1bit sound
33573080
33583081  Newer revisions (also Pocket Simon) have a smaller 16-pin MB4850 chip
33593082  instead of the TMS1000. This one has been decapped too, but we couldn't
r253556r253557
34333156static MACHINE_CONFIG_START( simon, simon_state )
34343157
34353158   /* basic machine hardware */
3436   MCFG_CPU_ADD("maincpu", TMS1000, 350000) // approximation - RC osc. R=33K, C=100pf
3159   MCFG_CPU_ADD("maincpu", TMS1000, 350000) // RC osc. R=33K, C=100pf -> ~350kHz
34373160   MCFG_TMS1XXX_READ_K_CB(READ8(simon_state, read_k))
34383161   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(simon_state, write_r))
34393162
r253556r253557
34543177
34553178  Milton Bradley Super Simon
34563179  * TMS1100 MP3476NLL (die labeled MP3476)
3457  * 8 big lamps(2 turn on at same time), 1-bit sound
3180  * 8 big lamps(2 turn on at same time), 1bit sound
34583181
34593182  The semi-squel to Simon, not as popular. It includes more game variations
34603183  and a 2-player head-to-head mode.
r253556r253557
37513474   save_item(NAME(m_gearbox_pos));
37523475}
37533476
3754static const INT16 bigtrak_speaker_levels[8] = { 0, 0x7fff/3, 0x7fff/3, 0x7fff/3*2, 0x7fff/3, 0x7fff/3*2, 0x7fff/3*2, 0x7fff };
3477static const INT16 bigtrak_speaker_levels[] = { 0, 32767/3, 32767/3, 32767/3*2, 32767/3, 32767/3*2, 32767/3*2, 32767 };
37553478
37563479static MACHINE_CONFIG_START( bigtrak, bigtrak_state )
37573480
37583481   /* basic machine hardware */
3759   MCFG_CPU_ADD("maincpu", TMS1000, 200000) // approximation - RC osc. R=83K, C=100pf
3482   MCFG_CPU_ADD("maincpu", TMS1000, 200000) // approximation - RC osc. R=83K, C=100pf, but unknown RC curve
37603483   MCFG_TMS1XXX_READ_K_CB(READ8(bigtrak_state, read_k))
37613484   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(bigtrak_state, write_r))
37623485   MCFG_TMS1XXX_WRITE_O_CB(WRITE16(bigtrak_state, write_o))
r253556r253557
38043527
38053528WRITE16_MEMBER(cnsector_state::write_r)
38063529{
3807   // R0-R5: select digit
3808   // R6-R9: direction leds
3809   set_display_segmask(0x3f, 0xff);
3810   display_matrix(8, 10, m_o, data);
3530   // R0-R5: select digit (right-to-left)
3531   for (int y = 0; y < 6; y++)
3532   {
3533      m_display_segmask[y] = 0xff;
3534      m_display_state[y] = (data >> y & 1) ? m_o : 0;
3535   }
3536
3537   // R6-R9: direction leds (-> lamp60-63)
3538   m_display_state[6] = data >> 6 & 0xf;
3539
3540   set_display_size(8, 7);
3541   display_update();
38113542}
38123543
38133544WRITE16_MEMBER(cnsector_state::write_o)
r253556r253557
38933624
38943625/***************************************************************************
38953626
3896  Parker Brothers Merlin handheld game, by Bob Doyle
3627  Parker Bros Merlin handheld game, by Bob Doyle
38973628  * TMS1100NLL MP3404A-N2
38983629  * 11 LEDs behind buttons, 3-level sound
38993630
r253556r253557
39863717INPUT_PORTS_END
39873718
39883719
3989static const INT16 merlin_speaker_levels[8] = { 0, 0x7fff/3, 0x7fff/3, 0x7fff/3*2, 0x7fff/3, 0x7fff/3*2, 0x7fff/3*2, 0x7fff };
3720static const INT16 merlin_speaker_levels[] = { 0, 32767/3, 32767/3, 32767/3*2, 32767/3, 32767/3*2, 32767/3*2, 32767 };
39903721
39913722static MACHINE_CONFIG_START( merlin, merlin_state )
39923723
39933724   /* basic machine hardware */
3994   MCFG_CPU_ADD("maincpu", TMS1100, 350000) // approximation - RC osc. R=33K, C=100pf
3725   MCFG_CPU_ADD("maincpu", TMS1100, 350000) // RC osc. R=33K, C=100pf -> ~350kHz
39953726   MCFG_TMS1XXX_READ_K_CB(READ8(merlin_state, read_k))
39963727   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(merlin_state, write_r))
39973728   MCFG_TMS1XXX_WRITE_O_CB(WRITE16(merlin_state, write_o))
r253556r253557
40553786static MACHINE_CONFIG_START( mmerlin, mmerlin_state )
40563787
40573788   /* basic machine hardware */
4058   MCFG_CPU_ADD("maincpu", TMS1400, 425000) // approximation - RC osc. R=30K, C=100pf
3789   MCFG_CPU_ADD("maincpu", TMS1400, 425000) // approximation - RC osc. R=30K, C=100pf, but unknown RC curve
40593790   MCFG_TMS1XXX_READ_K_CB(READ8(mmerlin_state, read_k))
40603791   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(mmerlin_state, write_r))
40613792   MCFG_TMS1XXX_WRITE_O_CB(WRITE16(mmerlin_state, write_o))
r253556r253557
40783809
40793810  Parker Brothers Stop Thief, by Bob Doyle
40803811  * TMS0980NLL MP6101B (die labeled 0980B-01A)
4081  * 3-digit 7seg LED display, 6-level sound
3812  * 3-digit 7seg LED display, 1bit sound
40823813
40833814  Stop Thief is actually a board game, the electronic device emulated here
40843815  (called Electronic Crime Scanner) is an accessory. To start a game, press
r253556r253557
41033834WRITE16_MEMBER(stopthief_state::write_r)
41043835{
41053836   // R0-R2: select digit
4106   set_display_segmask(7, 0x7f);
4107   display_matrix(7, 3, BITSWAP8(m_o,3,5,2,1,4,0,6,7) & 0x7f, data & 7);
3837   UINT8 o = BITSWAP8(m_o,3,5,2,1,4,0,6,7) & 0x7f;
3838   for (int y = 0; y < 3; y++)
3839   {
3840      m_display_segmask[y] = 0x7f;
3841      m_display_state[y] = (data >> y & 1) ? o : 0;
3842   }
41083843
4109   // R3-R8(tied together): speaker out
4110   int level = 0;
4111   for (int i = 0; m_o & 8 && i < 6; i++)
4112      level += (data >> (i+3) & 1);
4113   m_speaker->level_w(level);
3844   set_display_size(7, 3);
3845   display_update();
3846
3847   // R3-R8: speaker on
3848   m_speaker->level_w((data & 0x1f8 && m_o & 8) ? 1 : 0);
41143849}
41153850
41163851WRITE16_MEMBER(stopthief_state::write_o)
r253556r253557
41183853   // O0,O6: input mux
41193854   m_inp_mux = (data & 1) | (data >> 5 & 2);
41203855
4121   // O3: speaker on
3856   // O3: speaker out
41223857   // O0-O2,O4-O7: led segments A-G
41233858   m_o = data;
41243859}
r253556r253557
41653900   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)false)
41663901INPUT_PORTS_END
41673902
4168
4169static const INT16 stopthief_speaker_levels[7] = { 0, 0x7fff/6, 0x7fff/5, 0x7fff/4, 0x7fff/3, 0x7fff/2, 0x7fff };
4170
41713903static MACHINE_CONFIG_START( stopthief, stopthief_state )
41723904
41733905   /* basic machine hardware */
r253556r253557
41833915   /* sound hardware */
41843916   MCFG_SPEAKER_STANDARD_MONO("mono")
41853917   MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0)
4186   MCFG_SPEAKER_LEVELS(7, stopthief_speaker_levels)
41873918   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
41883919MACHINE_CONFIG_END
41893920
r253556r253557
41953926
41963927  Parker Brothers Bank Shot (known as Cue Ball in the UK), by Garry Kitchen
41973928  * TMS1400NLL MP7313-N2 (die labeled MP7313)
4198  * LED grid display, 1-bit sound
3929  * LED grid display, 1bit sound
41993930
42003931  Bank Shot is an electronic pool game. To select a game, repeatedly press
42013932  the [SELECT] button, then press [CUE UP] to start. Refer to the official
r253556r253557
42804011static MACHINE_CONFIG_START( bankshot, bankshot_state )
42814012
42824013   /* basic machine hardware */
4283   MCFG_CPU_ADD("maincpu", TMS1400, 475000) // approximation - RC osc. R=24K, C=100pf
4014   MCFG_CPU_ADD("maincpu", TMS1400, 475000) // approximation - RC osc. R=24K, C=100pf, but unknown RC curve
42844015   MCFG_TMS1XXX_READ_K_CB(READ8(bankshot_state, read_k))
42854016   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(bankshot_state, write_r))
42864017   MCFG_TMS1XXX_WRITE_O_CB(WRITE16(bankshot_state, write_o))
r253556r253557
43024033
43034034  Parker Brothers Split Second
43044035  * TMS1400NLL MP7314-N2 (die labeled MP7314)
4305  * LED grid display(default round LEDs, and rectangular shape ones), 1-bit sound
4036  * LED grid display(default round LEDs, and rectangular shape ones), 1bit sound
43064037
43074038  This is an electronic handheld reflex gaming device, it's straightforward
43084039  to use. The included mini-games are:
r253556r253557
43914122static MACHINE_CONFIG_START( splitsec, splitsec_state )
43924123
43934124   /* basic machine hardware */
4394   MCFG_CPU_ADD("maincpu", TMS1400, 475000) // approximation - RC osc. R=24K, C=100pf
4125   MCFG_CPU_ADD("maincpu", TMS1400, 475000) // approximation - RC osc. R=24K, C=100pf, but unknown RC curve
43954126   MCFG_TMS1XXX_READ_K_CB(READ8(splitsec_state, read_k))
43964127   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(splitsec_state, write_r))
43974128   MCFG_TMS1XXX_WRITE_O_CB(WRITE16(splitsec_state, write_o))
r253556r253557
44114142
44124143/***************************************************************************
44134144
4414  Parker Brothers Lost Treasure - The Electronic Deep-Sea Diving Game,
4415  Featuring The Electronic Dive-Control Center
4416  * TMS1100 M34038-NLL (die labeled 1100E, M34038)
4417  * 11 LEDs, 4-bit sound
4418 
4419  This is a board game. The electronic accessory is the emulated part here.
4420
4421***************************************************************************/
4422
4423class lostreas_state : public hh_tms1k_state
4424{
4425public:
4426   lostreas_state(const machine_config &mconfig, device_type type, const char *tag)
4427      : hh_tms1k_state(mconfig, type, tag)
4428   { }
4429
4430   DECLARE_WRITE16_MEMBER(write_r);
4431   DECLARE_WRITE16_MEMBER(write_o);
4432   DECLARE_READ8_MEMBER(read_k);
4433};
4434
4435// handlers
4436
4437WRITE16_MEMBER(lostreas_state::write_r)
4438{
4439   // R0-R10: leds
4440   display_matrix(11, 1, data, 1);
4441}
4442
4443WRITE16_MEMBER(lostreas_state::write_o)
4444{
4445   // O0-O3: input mux
4446   m_inp_mux = data & 0xf;
4447
4448   // O4: 330 ohm resistor - speaker out
4449   // O5: 220 ohm resistor - speaker out
4450   // O6: 180 ohm resistor - speaker out
4451   // O7:  68 ohm resistor - speaker out
4452   m_speaker->level_w(data >> 4 & 0xf);
4453}
4454
4455READ8_MEMBER(lostreas_state::read_k)
4456{
4457   // K: multiplexed inputs
4458   return read_inputs(4);
4459}
4460
4461
4462// config
4463
4464/* physical button layout and labels is like this:
4465  (note: Canadian version differs slightly to accomodoate dual-language)
4466
4467    [N-S(gold)]    [1] [2] [3]    [AIR]
4468    [E-W(gold)]    [4] [5] [6]    [UP]
4469    [N-S(silv)]    [7] [8] [9]    [$ VALUE]
4470    [E-W(silv)]                   [CLEAR]
4471*/
4472
4473static INPUT_PORTS_START( lostreas )
4474   PORT_START("IN.0") // O0
4475   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1")
4476   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2")
4477   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3")
4478   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4")
4479
4480   PORT_START("IN.1") // O1
4481   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5")
4482   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6")
4483   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7")
4484   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8")
4485
4486   PORT_START("IN.2") // O2
4487   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9")
4488   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_DEL) PORT_NAME("Clear")
4489   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_A) PORT_CODE(KEYCODE_U) PORT_NAME("Air/Up")
4490   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_V) PORT_NAME("$ Value")
4491
4492   PORT_START("IN.3") // O3
4493   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_R) PORT_NAME("E-W (silver)")
4494   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_E) PORT_NAME("N-S (silver)")
4495   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_W) PORT_NAME("E-W (gold)")
4496   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_Q) PORT_NAME("N-S (gold)")
4497INPUT_PORTS_END
4498
4499
4500static const INT16 lostreas_speaker_levels[16] =
4501{
4502   0, 0x7fff/15, 0x7fff/14, 0x7fff/13, 0x7fff/12, 0x7fff/11, 0x7fff/10, 0x7fff/9,
4503   0x7fff/8, 0x7fff/7, 0x7fff/6, 0x7fff/5, 0x7fff/4, 0x7fff/3, 0x7fff/2, 0x7fff/1
4504};
4505
4506static MACHINE_CONFIG_START( lostreas, lostreas_state )
4507
4508   /* basic machine hardware */
4509   MCFG_CPU_ADD("maincpu", TMS1100, 425000) // approximation - RC osc. R=39K, C=47pf
4510   MCFG_TMS1XXX_READ_K_CB(READ8(lostreas_state, read_k))
4511   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(lostreas_state, write_r))
4512   MCFG_TMS1XXX_WRITE_O_CB(WRITE16(lostreas_state, write_o))
4513
4514   MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1))
4515   MCFG_DEFAULT_LAYOUT(layout_lostreas)
4516
4517   /* sound hardware */
4518   MCFG_SPEAKER_STANDARD_MONO("mono")
4519   MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0)
4520   MCFG_SPEAKER_LEVELS(16, lostreas_speaker_levels)
4521   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
4522MACHINE_CONFIG_END
4523
4524
4525
4526
4527
4528/***************************************************************************
4529
45304145  Tandy Radio Shack Computerized Arcade (1981, 1982, 1995)
45314146  * TMS1100 MCU, labeled CD7282SL
4532  * 12 lamps behind buttons, 1-bit sound
4147  * 12 lamps behind buttons, 1bit sound
45334148
45344149  This handheld contains 12 minigames. It looks and plays like "Fabulous Fred"
45354150  by the Japanese company Mego Corp. in 1980, which in turn is a mix of Merlin
r253556r253557
46504265INPUT_PORTS_END
46514266
46524267
4653// output PLA is not decapped
46544268static const UINT16 tandy12_output_pla[0x20] =
46554269{
46564270   // these are certain
r253556r253557
46664280static MACHINE_CONFIG_START( tandy12, tandy12_state )
46674281
46684282   /* basic machine hardware */
4669   MCFG_CPU_ADD("maincpu", TMS1100, 400000) // approximation - RC osc. R=39K, C=47pf
4283   MCFG_CPU_ADD("maincpu", TMS1100, 400000) // RC osc. R=39K, C=47pf -> ~400kHz
46704284   MCFG_TMS1XXX_OUTPUT_PLA(tandy12_output_pla)
46714285   MCFG_TMS1XXX_READ_K_CB(READ8(tandy12_state, read_k))
46724286   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(tandy12_state, write_r))
r253556r253557
46914305  * PCB label TOMY B.O.
46924306  * TMS1040 MP2726 TOMY WIPE (die labeled MP2726A)
46934307  * TMS1025N2LL I/O expander
4694  * 2-digit 7seg display, 46 other leds, 1-bit sound
4308  * 2-digit 7seg display, 46 other leds, 1bit sound
46954309
46964310  known releases:
46974311  - USA: Break Up
r253556r253557
48924506  Tomy Power House Pinball
48934507  * PCB label TOMY P-B
48944508  * TMS1100 MP1180 TOMY PINB (die labeled MP1180)
4895  * 3 7seg LEDs, and other LEDs behind bezel, 1-bit sound
4509  * 3 7seg LEDs, and other LEDs behind bezel, 1bit sound
48964510
48974511  known releases:
48984512  - USA: Power House Pinball
r253556r253557
49354549
49364550void phpball_state::prepare_display()
49374551{
4938   set_display_segmask(7, 0x7f);
4552   // R0-R2 are 7segs
4553   for (int y = 0; y < 3; y++)
4554      m_display_segmask[y] = 0x7f;
4555
49394556   display_matrix(7, 9, m_o, m_r);
49404557}
49414558
r253556r253557
49474564   // R9: input mux
49484565   m_inp_mux = data >> 9 & 1;
49494566
4950   // R0-R2: digit select
49514567   // R0-R8: led select
49524568   m_r = data;
49534569   prepare_display();
r253556r253557
49554571
49564572WRITE16_MEMBER(phpball_state::write_o)
49574573{
4958   // O0-O6: digit segment/led data
4574   // O0-O6: led state
49594575   // O7: N/C
49604576   m_o = data & 0x7f;
49614577   prepare_display();
r253556r253557
49924608static MACHINE_CONFIG_START( phpball, phpball_state )
49934609
49944610   /* basic machine hardware */
4995   MCFG_CPU_ADD("maincpu", TMS1100, 375000) // approximation - RC osc. R=47K, C=47pf
4611   MCFG_CPU_ADD("maincpu", TMS1100, 375000) // RC osc. R=47K, C=47pf -> ~375kHz
49964612   MCFG_TMS1XXX_READ_K_CB(READ8(phpball_state, read_k))
49974613   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(phpball_state, write_r))
49984614   MCFG_TMS1XXX_WRITE_O_CB(WRITE16(phpball_state, write_o))
r253556r253557
50214637   ROM_LOAD( "mp1030", 0x0000, 0x0800, CRC(a81d7ccb) SHA1(4756ce42f1ea28ce5fe6498312f8306f10370969) )
50224638
50234639   ROM_REGION( 867, "maincpu:mpla", 0 )
5024   ROM_LOAD( "tms1100_common2_micro.pla", 0, 867, BAD_DUMP CRC(7cc90264) SHA1(c6e1cf1ffb178061da9e31858514f7cd94e86990) ) // not verified
4640   ROM_LOAD( "tms1100_common1_micro.pla", 0, 867, BAD_DUMP CRC(62445fc9) SHA1(d6297f2a4bc7a870b76cc498d19dbb0ce7d69fec) ) // not verified
50254641   ROM_REGION( 365, "maincpu:opla", 0 )
50264642   ROM_LOAD( "tms1100_mathmagi_output.pla", 0, 365, NO_DUMP )
50274643ROM_END
r253556r253557
50384654ROM_END
50394655
50404656
5041ROM_START( zodiac )
5042   ROM_REGION( 0x0800, "maincpu", 0 )
5043   ROM_LOAD( "mp3435", 0x0000, 0x0800, CRC(ecdc3160) SHA1(a7e82d66314a039fcffeddf99919d9f9ad42d61d) )
5044
5045   ROM_REGION( 867, "maincpu:mpla", 0 )
5046   ROM_LOAD( "tms1100_common3_micro.pla", 0, 867, BAD_DUMP CRC(03574895) SHA1(04407cabfb3adee2ee5e4218612cb06c12c540f4) ) // not verified
5047   ROM_REGION( 365, "maincpu:opla", 0 )
5048   ROM_LOAD( "tms1100_zodiac_output.pla", 0, 365, NO_DUMP )
5049ROM_END
5050
5051
50524657ROM_START( cqback )
50534658   ROM_REGION( 0x0800, "maincpu", 0 )
50544659   ROM_LOAD( "mp3415.u4", 0x0000, 0x0800, CRC(65ebdabf) SHA1(9b5cf5adaf9132ced87f611ae8c3148b9b62ba89) )
r253556r253557
50934698ROM_END
50944699
50954700
5096ROM_START( cnfball2 )
5097   ROM_REGION( 0x0800, "maincpu", 0 )
5098   ROM_LOAD( "mp1181", 0x0000, 0x0800, CRC(4553a840) SHA1(2e1132c9bc51641f77ba7f2430b5a3b2766b3a3d) )
5099
5100   ROM_REGION( 867, "maincpu:mpla", 0 )
5101   ROM_LOAD( "tms1100_common2_micro.pla", 0, 867, BAD_DUMP CRC(7cc90264) SHA1(c6e1cf1ffb178061da9e31858514f7cd94e86990) ) // not verified
5102   ROM_REGION( 365, "maincpu:opla", 0 )
5103   ROM_LOAD( "tms1100_cnfball2_output.pla", 0, 365, NO_DUMP )
5104ROM_END
5105
5106
51074701ROM_START( ebball )
51084702   ROM_REGION( 0x0400, "maincpu", 0 )
51094703   ROM_LOAD( "mp0914", 0x0000, 0x0400, CRC(3c6fb05b) SHA1(b2fe4b3ca72d6b4c9bfa84d67f64afdc215e7178) )
r253556r253557
53974991ROM_END
53984992
53994993
5400ROM_START( lostreas )
5401   ROM_REGION( 0x0800, "maincpu", 0 )
5402   ROM_LOAD( "m34038", 0x0000, 0x0800, CRC(4c996f63) SHA1(ebbaa8b2f909f4300887aa2dbdb7185eedc75d3f) )
5403
5404   ROM_REGION( 867, "maincpu:mpla", 0 )
5405   ROM_LOAD( "tms1100_common1_micro.pla", 0, 867, CRC(62445fc9) SHA1(d6297f2a4bc7a870b76cc498d19dbb0ce7d69fec) )
5406   ROM_REGION( 365, "maincpu:opla", 0 )
5407   ROM_LOAD( "tms1100_lostreas_output.pla", 0, 365, CRC(c62d850f) SHA1(d25974e6901eb10c52cdda12e6d4a13e26745e6f) )
5408ROM_END
5409
5410
54114994ROM_START( tandy12 )
54124995   ROM_REGION( 0x0800, "maincpu", 0 )
54134996   ROM_LOAD( "cd7282sl", 0x0000, 0x0800, CRC(a10013dd) SHA1(42ebd3de3449f371b99937f9df39c240d15ac686) )
r253556r253557
54465029COMP( 1980, mathmagi,  0,        0, mathmagi,  mathmagi,  driver_device, 0, "APF Electronics Inc.", "Mathemagician", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW )
54475030
54485031CONS( 1979, amaztron,  0,        0, amaztron,  amaztron,  driver_device, 0, "Coleco", "Amaze-A-Tron", MACHINE_SUPPORTS_SAVE )
5449COMP( 1979, zodiac,    0,        0, zodiac,    zodiac,    driver_device, 0, "Coleco", "Zodiac - The Astrology Computer", MACHINE_SUPPORTS_SAVE )
54505032CONS( 1978, cqback,    0,        0, cqback,    cqback,    driver_device, 0, "Coleco", "Electronic Quarterback", MACHINE_SUPPORTS_SAVE )
54515033CONS( 1980, h2hfootb,  0,        0, h2hfootb,  h2hfootb,  driver_device, 0, "Coleco", "Head to Head Football", MACHINE_SUPPORTS_SAVE )
54525034CONS( 1980, h2hbaseb,  0,        0, h2hbaseb,  h2hbaseb,  driver_device, 0, "Coleco", "Head to Head Baseball", MACHINE_SUPPORTS_SAVE )
54535035CONS( 1981, tc4,       0,        0, tc4,       tc4,       driver_device, 0, "Coleco", "Total Control 4", MACHINE_SUPPORTS_SAVE )
54545036
5455CONS( 1979, cnfball2,  0,        0, cnfball2,  cnfball2,  driver_device, 0, "Conic", "Electronic Football II (Conic)", MACHINE_SUPPORTS_SAVE )
5456
54575037CONS( 1979, ebball,    0,        0, ebball,    ebball,    driver_device, 0, "Entex", "Electronic Baseball (Entex)", MACHINE_SUPPORTS_SAVE )
54585038CONS( 1979, ebball2,   0,        0, ebball2,   ebball2,   driver_device, 0, "Entex", "Electronic Baseball 2 (Entex)", MACHINE_SUPPORTS_SAVE )
54595039CONS( 1980, ebball3,   0,        0, ebball3,   ebball3,   driver_device, 0, "Entex", "Electronic Baseball 3 (Entex)", MACHINE_SUPPORTS_SAVE )
r253556r253557
54865066CONS( 1980, bankshot,  0,        0, bankshot,  bankshot,  driver_device, 0, "Parker Brothers", "Bank Shot - Electronic Pool", MACHINE_SUPPORTS_SAVE )
54875067CONS( 1980, splitsec,  0,        0, splitsec,  splitsec,  driver_device, 0, "Parker Brothers", "Split Second", MACHINE_SUPPORTS_SAVE )
54885068CONS( 1982, mmerlin,   0,        0, mmerlin,   mmerlin,   driver_device, 0, "Parker Brothers", "Master Merlin", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK )
5489CONS( 1982, lostreas,  0,        0, lostreas,  lostreas,  driver_device, 0, "Parker Brothers", "Lost Treasure - The Electronic Deep-Sea Diving Game (Electronic Dive-Control Center)", MACHINE_SUPPORTS_SAVE ) // ***
54905069
54915070CONS( 1981, tandy12,   0,        0, tandy12,   tandy12,   driver_device, 0, "Tandy Radio Shack", "Tandy-12: Computerized Arcade", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) // some of the minigames: ***
54925071
trunk/src/mame/drivers/hh_ucom4.cpp
r253556r253557
188188   m_display_maxy = maxy;
189189}
190190
191void hh_ucom4_state::display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety, bool update)
191void hh_ucom4_state::display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety)
192192{
193193   set_display_size(maxx, maxy);
194194
r253556r253557
197197   for (int y = 0; y < maxy; y++)
198198      m_display_state[y] = (sety >> y & 1) ? ((setx & mask) | (1 << maxx)) : 0;
199199
200   if (update)
201      display_update();
200   display_update();
202201}
203202
204203
205// generic input handlers
206
207204UINT8 hh_ucom4_state::read_inputs(int columns)
208205{
209206   UINT8 ret = 0;
trunk/src/mame/drivers/hp9845.cpp
r253556r253557
1616// - LPU & PPU ROMs
1717// - LPU & PPU RAMs
1818// - Text mode screen
19// - Keyboard
20// - T15 tape drive
19// - Keyboard (most of keys)
2120// What's not yet in:
2221// - Beeper
22// - Rest of keyboard
2323// - Graphic screen
24// - Better naming of tape drive image (it's now "magt", should be "t15")
24// - Tape drive (this needs some heavy RE of the TACO chip)
2525// - Better documentation of this file
2626// - Software list to load optional ROMs
2727// What's wrong:
r253556r253557
3333#include "cpu/z80/z80.h"
3434#include "softlist.h"
3535#include "cpu/hphybrid/hphybrid.h"
36#include "machine/hp_taco.h"
3736
3837#define BIT_MASK(n) (1U << (n))
3938
r253556r253557
7877      m_io_key0(*this , "KEY0"),
7978      m_io_key1(*this , "KEY1"),
8079      m_io_key2(*this , "KEY2"),
81      m_io_key3(*this , "KEY3"),
82                m_t15(*this , "t15")
80      m_io_key3(*this , "KEY3")
8381   { }
8482
8583   UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
r253556r253557
9290      void vblank_w(screen_device &screen, bool state);
9391
9492      IRQ_CALLBACK_MEMBER(irq_callback);
95   void update_irq(void);
93   void update_irl(void);
9694
9795   TIMER_DEVICE_CALLBACK_MEMBER(kb_scan);
9896   DECLARE_READ16_MEMBER(kb_scancode_r);
r253556r253557
10199
102100      DECLARE_WRITE8_MEMBER(pa_w);
103101
104        DECLARE_WRITE_LINE_MEMBER(t15_irq_w);
105        DECLARE_WRITE_LINE_MEMBER(t15_flg_w);
106        DECLARE_WRITE_LINE_MEMBER(t15_sts_w);
107
108102private:
109103      required_device<hp_5061_3001_cpu_device> m_lpu;
110104      required_device<hp_5061_3001_cpu_device> m_ppu;
r253556r253557
113107   required_ioport m_io_key1;
114108   required_ioport m_io_key2;
115109   required_ioport m_io_key3;
116        required_device<hp_taco_device> m_t15;
117110
118111      void set_video_mar(UINT16 mar);
119112      void video_fill_buff(bool buff_idx);
r253556r253557
143136
144137      // Interrupt handling
145138      UINT8 m_irl_pending;
146      UINT8 m_irh_pending;
147139
148140      // State of keyboard
149141      ioport_value m_kb_state[ 4 ];
150142      UINT8 m_kb_scancode;
151143      UINT16 m_kb_status;
152144
153        // State of PPU I/O
154        UINT8 m_ppu_pa;
155145};
156146
157147static INPUT_PORTS_START(hp9845b)
r253556r253557
332322      m_video_frame = 0;
333323
334324      m_irl_pending = 0;
335                m_irh_pending = 0;
336325
337326      memset(&m_kb_state[ 0 ] , 0 , sizeof(m_kb_state));
338327      m_kb_scancode = 0x7f;
339328      m_kb_status = 0;
340
341                m_ppu_pa = 0;
342329}
343330
344331void hp9845b_state::set_video_mar(UINT16 mar)
r253556r253557
492479      if (irqline == HPHYBRID_IRL) {
493480            return m_irl_pending;
494481      } else {
495            return m_irh_pending;
482            return 0;
496483      }
497484}
498485
499void hp9845b_state::update_irq(void)
486void hp9845b_state::update_irl(void)
500487{
501488      m_ppu->set_input_line(HPHYBRID_IRL , m_irl_pending != 0);
502      m_ppu->set_input_line(HPHYBRID_IRH , m_irh_pending != 0);
503489}
504490
505491TIMER_DEVICE_CALLBACK_MEMBER(hp9845b_state::kb_scan)
r253556r253557
560546                  m_kb_scancode = i;
561547                  BIT_SET(m_irl_pending , 0);
562548                  BIT_SET(m_kb_status, 0);
563                  update_irq();
549                  update_irl();
564550
565551                  // Special case: pressing stop key sets LPU "status" flag
566552                  if (i == 0x47) {
r253556r253557
586572{
587573      BIT_CLR(m_irl_pending , 0);
588574      BIT_CLR(m_kb_status, 0);
589      update_irq();
575      update_irl();
590576      m_lpu->status_w(0);
591577      // TODO: beeper start
592578}
593579
594580WRITE8_MEMBER(hp9845b_state::pa_w)
595581{
596        m_ppu_pa = data;
597
598582      // TODO: handle sts & flg
599      if (data == 15) {
600                        // RHS tape drive (T15)
601                        m_ppu->status_w(m_t15->sts_r());
602                        m_ppu->flag_w(m_t15->flg_r());
583      if (data == 0xf) {
584            // RHS tape drive (T15)
585            m_ppu->status_w(1);
586            m_ppu->flag_w(1);
603587      } else {
604588            m_ppu->status_w(0);
605589            m_ppu->flag_w(0);
606590      }
607591}
608592
609WRITE_LINE_MEMBER(hp9845b_state::t15_irq_w)
610{
611        if (state) {
612                BIT_SET(m_irh_pending , 7);
613        } else {
614                BIT_CLR(m_irh_pending , 7);
615        }
616        update_irq();
617}
618
619WRITE_LINE_MEMBER(hp9845b_state::t15_flg_w)
620{
621        if (m_ppu_pa == 15) {
622                m_ppu->flag_w(state);
623        }
624}
625
626WRITE_LINE_MEMBER(hp9845b_state::t15_sts_w)
627{
628        if (m_ppu_pa == 15) {
629                m_ppu->status_w(state);
630        }
631}
632
633593static MACHINE_CONFIG_START( hp9845a, hp9845_state )
634594   //MCFG_CPU_ADD("lpu", HP_5061_3010, XTAL_11_4MHz)
635595   //MCFG_CPU_ADD("ppu", HP_5061_3011, XTAL_11_4MHz)
r253556r253557
678638      // PA = 0, IC = 3
679639      // Keyboard status input & keyboard interrupt clear
680640      AM_RANGE(HP_MAKE_IOADDR(0 , 3) , HP_MAKE_IOADDR(0 , 3)) AM_READWRITE(kb_status_r , kb_irq_clear_w)
681        // PA = 15, IC = 0..3
682        // Right-hand side tape drive (T15)
683        AM_RANGE(HP_MAKE_IOADDR(15 , 0) , HP_MAKE_IOADDR(15 , 3))        AM_DEVREADWRITE("t15" , hp_taco_device , reg_r , reg_w)
684641ADDRESS_MAP_END
685642
686643static MACHINE_CONFIG_START( hp9845b, hp9845b_state )
r253556r253557
706663   // Actual keyboard refresh rate should be KEY_SCAN_OSCILLATOR / 128 (2560 Hz)
707664   MCFG_TIMER_DRIVER_ADD_PERIODIC("kb_timer" , hp9845b_state , kb_scan , attotime::from_hz(100))
708665
709        // Tape controller
710        MCFG_DEVICE_ADD("t15" , HP_TACO , 4000000)
711        MCFG_TACO_IRQ_HANDLER(WRITELINE(hp9845b_state , t15_irq_w))
712        MCFG_TACO_FLG_HANDLER(WRITELINE(hp9845b_state , t15_flg_w))
713        MCFG_TACO_STS_HANDLER(WRITELINE(hp9845b_state , t15_sts_w))
714
715666      MCFG_SOFTWARE_LIST_ADD("optrom_list", "hp9845b_rom")
716667MACHINE_CONFIG_END
717668
trunk/src/mame/drivers/kurukuru.cpp
r253556r253557
11// license:BSD-3-Clause
22// copyright-holders:Roberto Fresca, hap
3/***********************************************************************************
3/******************************************************************************
44
55  KURU KURU PYON PYON
6  Success / Taiyo Jidoki
6  Taiyo Jidoki / Success
77
8
89  Driver by Roberto Fresca & hap.
910
1011
r253556r253557
1516  ports, descriptions and a lot of things... :)
1617
1718
18************************************************************************************
19*******************************************************************************
1920
2021  Technical Notes....
2122
r253556r253557
113114  AB =  NEC C1663C 8926B.
114115
115116
116************************************************************************************
117*******************************************************************************
117118
118119  General Notes....
119120
120  There are at least 4 games in the Pyon Pyon series...
121  The game name could be translated as "Croak Croak Hop Hop"
122  Kuru is the frog sound, and Pyon is the sound of jumps.
121123
122  1) Pyon Pyon (a marathon game with froggy characters).
123  2) Kuru Kuru Pyon Pyon (a kind of slots game with the same froggy characters).
124  3) Pyon Pyon Jyanpu (a contents where the same characters try to cross the river jumping on pads).
125  4) Sui Sui Pyon Pyon (a swimming competition where the same characters swim with different styles, even walking).
126
127124  Coin 1 (key 5) could be set either as Coin 1 or as Payout button, through
128125  a DIP switch.
129126
r253556r253557
132129  will be cleared).
133130
134131
135************************************************************************************
132*******************************************************************************
136133
137  Games Notes:
138  ------------
134  * How to play...
139135
140  * Kuru Kuru Pyon Pyon:
136  Insert tokens (medals)...
141137
142  The game name could be translated as "Croak Croak Hop Hop"
143  Kuru is the frog sound, and Pyon is the sound of jumps.
144
145  How to play...
146
147  Insert tokens (medals).
148138  You can bet to any (or all) of the following 5 characters: Bote, Oume, Pyoko,
149139  Kunio, and Pyon Pyon. Press start, and the reels start to roll. You'll win if
150140  you can get 3 of the choosen character(s) in a row, column or diagonal.
r253556r253557
156146  Red tadpoles are a bonus. Once you get one, it will go to the right panel,
157147  revealing a number. This number represents the extra credits you won.
158148
159  Bookkeeping...
160149
150  * Bookkeeping...
151
161152  Pressing Bookkeeping key (key 9), you enter the Bookkeeping Mode. There are
162153  2 screens with all the game information like DIP switches and statistics...
163154
r253556r253557
177168
178169  Pressing the Bookkeeping key once more, you exit the mode and go back to the game.
179170
180  ----------------------------------------------------------------------------------
181171
182  * Pyon Pyon Jyanpu:
172*******************************************************************************
183173
184  The game name could be translated as "Hop Hop Jump"
185  Pyon is the sound of jumps. Jyanpu means jump.
186
187  How to play...
188
189  Insert tokens (medals).
190  You can bet to any (or all) of the following 5 characters: Boketa, Kunio, Pyon-Pyon,
191  Pyokorin and Botechin. Press start, and the river's pads start to roll. You'll win
192  if your character gets the three pads to jump to the other side of the river.
193
194  There is also a bonus game with a black tadpole rounding some pads with extra credits.
195  you'll get the extra credits marked in the pad where the tadpole stopped.
196
197  Bookkeeping...
198
199  Pressing Bookkeeping key (key 9), you enter the Bookkeeping Mode. There are
200  2 screens with all the game information like DIP switches and statistics...
201
202  1st screen...
203
204  - [Left panel]:  All the DIP switches parameters.
205
206  - [Right panel]: Bet and Win totals, 100Y/10Y/medal IN/OUT, total of games,
207                   won, loss, won by paid range, and 'omake' (extra/bonus).
208
209  2nd screen (press Bookkeeping key again)...
210
211  - Win distribution by character
212   (Boketa, Kunio, Pyon-Pyon, Pyokorin and Botechin).
213
214  - Bet distribution (1, 2, 3, 4, 5~10)
215
216  - Omake (bonus) distribution (games total, win games, loss games)
217 
218  Pressing the Bookkeeping key once more, you exit the mode and go back to the game.
219
220
221************************************************************************************
222
223174  ADPCM Samples....
224175
225  There are 14 samples in Kuru Kuru Pyon Pyon.
176  There are 14 samples in the system.
226177
227  00: "Botechin"
178  00: "Boterin"
228179  01:
229  02: "Hakase" (professor)
180  02: "Hakase" ("professor")
230181  03: "Pyokorin"
231182  04: "Kunio"
232  05: "Pyon-Pyon"
233  06: "Boketa"
183  05: "Pyon Pyon"
184  06:
234185  07:
235186  08: "Oume"
236  09: "Haipaa" (hyper)
237  10: "Ichi ni tsuite" (on your marks)
238  11: "Youi" (get ready)
239  12: "Bang" (sound for the tadpoles landing in the right panel).
187  09: "Haipaa" ("hyper")
188  10: "Ichi ni tsuite" ("on your marks")
189  11: "Youi" ("get ready")
190  12: Bang sound for the tadpoles landing in the right panel.
240191  13: Sound effect for reels when running.
241192
242  The fact that there are samples for "on your marks", "get ready", and "bang",
243  make me think that these sounds could be shared with the other unemulated marathon
244  game of the series called just "Pyon Pyon".
245193
246***********************************************************************************/
194******************************************************************************/
247195
248196#include "emu.h"
249197#include "cpu/z80/z80.h"
r253556r253557
543491/*  bits d0-d3 are JAMMA top side pins 20,21,22,23, bits d4-d7 are JAMMA bottom side pins 20,21,22,23
544492    so that's player 1 left/right/button1/button2 then player 2 left/right/button1/button2
545493*/
546   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CODE(KEYCODE_Z) PORT_NAME("1st (Bote/Botechin)")
494   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CODE(KEYCODE_Z) PORT_NAME("1st (Bote)")
547495   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CODE(KEYCODE_X) PORT_NAME("2nd (Oume)")
548   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CODE(KEYCODE_C) PORT_NAME("3rd (Pyoko/Pyokorin)")
496   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CODE(KEYCODE_C) PORT_NAME("3rd (Pyoko)")
549497   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_CODE(KEYCODE_V) PORT_NAME("4th (Kunio)")
550   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_CODE(KEYCODE_B) PORT_NAME("5th (Pyon-Pyon)")
498   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_CODE(KEYCODE_B) PORT_NAME("5th (Pyon Pyon)")
551499   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER )   PORT_CODE(KEYCODE_N) PORT_NAME("Unknown A0h - bit5")
552500   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER )   PORT_CODE(KEYCODE_M) PORT_NAME("Unknown A0h - bit6")
553501   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
r253556r253557
781729MACHINE_CONFIG_END
782730
783731
784/*************************************************
785*                 ROMs Loading                   *
786*************************************************/
732/***************************************************************************
787733
734  Game driver(s)
735
736***************************************************************************/
737
788738/*  Kuru Kuru Pyon Pyon.
789    1990, Success / Taiyo Jidoki.
790739*/
791740ROM_START( kurukuru )
792741   ROM_REGION( 0x08000, "maincpu", 0 )
r253556r253557
808757   ROM_LOAD( "7908b-4.ic32", 0x0600, 0x0034, CRC(bddf925e) SHA1(861cf5966444d0c0392241e5cfa08db475fb439a) )
809758ROM_END
810759
811/*  Pyon Pyon Jyanpu.
760/*  Pyon Pyon Jump.
812761    Ver 1.40.
813   199?, Success / Taiyo Jidoki.
814762*/
815763ROM_START( ppj )
816764   ROM_REGION( 0x08000, "maincpu", 0 )
r253556r253557
833781ROM_END
834782
835783
836/***************************************************************************
837*                              Game Drivers                                *
838***************************************************************************/
839
840/*    YEAR  NAME      PARENT  MACHINE   INPUT     STATE          INIT  ROT    COMPANY                   FULLNAME                          FLAGS  */
841GAME( 1990, kurukuru, 0,      kurukuru, kurukuru, driver_device, 0,    ROT0, "Success / Taiyo Jidoki", "Kuru Kuru Pyon Pyon (Japan)",     0 )
842GAME( 199?, ppj,      0,      ppj,      ppj,      driver_device, 0,    ROT0, "Success / Taiyo Jidoki", "Pyon Pyon Jyanpu (V1.40, Japan)", 0 )
843
844// unemulated....
845
846//    199?, Success / Taiyo Jidoki, Pyon Pyon
847//    1990, Success / Taiyo Jidoki, Sui Sui Pyon Pyon
784/*    YEAR  NAME      PARENT  MACHINE   INPUT     STATE          INIT  ROT    COMPANY                   FULLNAME                        FLAGS  */
785GAME( 199?, kurukuru, 0,      kurukuru, kurukuru, driver_device, 0,    ROT0, "Success / Taiyo Jidoki", "Kuru Kuru Pyon Pyon (Japan)",   0 )
786GAME( 199?, ppj,      0,      ppj,      ppj,      driver_device, 0,    ROT0, "Success / Taiyo Jidoki", "Pyon Pyon Jump (V1.40, Japan)", 0 )
trunk/src/mame/drivers/mbdtower.cpp
r253556r253557
6262{
6363   // declare display matrix size and the 2 7segs
6464   set_display_size(7, 3);
65   set_display_segmask(6, 0x7f);
65   m_display_segmask[1] = m_display_segmask[2] = 0x7f;
6666
6767   // update current state
6868   if (~m_r & 0x10)
r253556r253557
246246static MACHINE_CONFIG_START( mbdtower, mbdtower_state )
247247
248248   /* basic machine hardware */
249   MCFG_CPU_ADD("maincpu", TMS1400, 425000) // approximation - RC osc. R=43K, C=56pf
249   MCFG_CPU_ADD("maincpu", TMS1400, 425000) // approximation - RC osc. R=43K, C=56pf, but unknown RC curve
250250   MCFG_TMS1XXX_READ_K_CB(READ8(mbdtower_state, read_k))
251251   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(mbdtower_state, write_r))
252252   MCFG_TMS1XXX_WRITE_O_CB(WRITE16(mbdtower_state, write_o))
trunk/src/mame/drivers/mitchell.cpp
r253556r253557
20452045
20462046ROM_START( block )
20472047   ROM_REGION( 0x50000, "maincpu", 0 )
2048   ROM_LOAD( "ble_05b.14f",   0x00000, 0x08000, CRC(fcdb7885) SHA1(500ee4b8344181e9ad348bd22344a1a942fe9fdc) )
2049   ROM_LOAD( "ble_06b.15f",   0x10000, 0x20000, CRC(e114ebde) SHA1(12362e809443644b43fbc72e7eead5f376fe11d3) )
2050   ROM_LOAD( "ble_07b.16f",   0x30000, 0x20000, CRC(61bef077) SHA1(92792f26305df1e5e66607bed391b84b4964ba3e) )
2048   ROM_LOAD( "ble_05.rom",   0x00000, 0x08000, CRC(c12e7f4c) SHA1(335f4eab2323b942d5feeb3bab6f7286fabfffb4) )
2049   ROM_LOAD( "ble_06.rom",   0x10000, 0x20000, CRC(cdb13d55) SHA1(2e4489d12a603b4c7dfb90d246ebff9176e88a0b) )
2050   ROM_LOAD( "ble_07.rom",   0x30000, 0x20000, CRC(1d114f13) SHA1(ee3588e1752b3432fd611e2d7d4fb43f942de580) )
20512051
20522052   ROM_REGION( 0x100000, "gfx1", ROMREGION_ERASEFF )
2053   ROM_LOAD( "bl_08.8h",    0x000000, 0x20000, CRC(aa0f4ff1) SHA1(58f3c468f89d834caaf66d3c084ab87addbb75c0) ) /* chars */
2054   ROM_LOAD( "bl_09.9h",    0x020000, 0x20000, CRC(6fa8c186) SHA1(d4dd26d666f2accce871f70e7882e140d924dd07) )
2053   ROM_LOAD( "bl_08.rom",    0x000000, 0x20000, CRC(aa0f4ff1) SHA1(58f3c468f89d834caaf66d3c084ab87addbb75c0) ) /* chars */
2054   ROM_LOAD( "bl_09.rom",    0x020000, 0x20000, CRC(6fa8c186) SHA1(d4dd26d666f2accce871f70e7882e140d924dd07) )
20552055   /* 40000-7ffff empty */
2056   ROM_LOAD( "bl_18.8j",    0x080000, 0x20000, CRC(c0acafaf) SHA1(7c44b2605da6a324d0c145202cb8bac7af7a9c68) )
2057   ROM_LOAD( "bl_19.9j",    0x0a0000, 0x20000, CRC(1ae942f5) SHA1(e9322790db0bf2a9e862b14e166ee3f36f9ea5ad) )
2056   ROM_LOAD( "bl_18.rom",    0x080000, 0x20000, CRC(c0acafaf) SHA1(7c44b2605da6a324d0c145202cb8bac7af7a9c68) )
2057   ROM_LOAD( "bl_19.rom",    0x0a0000, 0x20000, CRC(1ae942f5) SHA1(e9322790db0bf2a9e862b14e166ee3f36f9ea5ad) )
20582058   /* c0000-fffff empty */
20592059
20602060   ROM_REGION( 0x040000, "gfx2", 0 )
2061   ROM_LOAD( "bl_16.2j",    0x000000, 0x20000, CRC(fadcaff7) SHA1(f4bd8e375fe6b1e6a07b4ec4e58f5807dbd738f8) ) /* sprites */
2062   ROM_LOAD( "bl_17.3j",    0x020000, 0x20000, CRC(5f8cab42) SHA1(3a4c682a7938479e0be80c0494c2c8fc7303b663) )
2061   ROM_LOAD( "bl_16.rom",    0x000000, 0x20000, CRC(fadcaff7) SHA1(f4bd8e375fe6b1e6a07b4ec4e58f5807dbd738f8) ) /* sprites */
2062   ROM_LOAD( "bl_17.rom",    0x020000, 0x20000, CRC(5f8cab42) SHA1(3a4c682a7938479e0be80c0494c2c8fc7303b663) )
20632063
20642064   ROM_REGION( 0x80000, "oki", 0 ) /* OKIM */
2065   ROM_LOAD( "bl_01.2d",    0x00000, 0x20000, CRC(c2ec2abb) SHA1(89981f2a887ace4c4580e2828cbdc962f89c215e) )
2065   ROM_LOAD( "bl_01.rom",    0x00000, 0x20000, CRC(c2ec2abb) SHA1(89981f2a887ace4c4580e2828cbdc962f89c215e) )
20662066ROM_END
20672067
2068ROM_START( blockr1 )
2068ROM_START( blockj )
20692069   ROM_REGION( 0x50000, "maincpu", 0 )
2070   ROM_LOAD( "ble_05a.14f",   0x00000, 0x08000, CRC(fa2a4536) SHA1(8f584745116bd0ced4d66719cd80c0372b797134) )
2071   ROM_LOAD( "ble_06a.15f",   0x10000, 0x20000, CRC(e114ebde) SHA1(12362e809443644b43fbc72e7eead5f376fe11d3) )
2072   ROM_LOAD( "ble_07.16f",    0x30000, 0x20000, CRC(1d114f13) SHA1(ee3588e1752b3432fd611e2d7d4fb43f942de580) )
2070   ROM_LOAD( "blj_05.rom",   0x00000, 0x08000, CRC(3b55969a) SHA1(86de2f1f5878de380a8b1e3935cffa146863f07f) )
2071   ROM_LOAD( "ble_06.rom",   0x10000, 0x20000, CRC(cdb13d55) SHA1(2e4489d12a603b4c7dfb90d246ebff9176e88a0b) )
2072   ROM_LOAD( "blj_07.rom",   0x30000, 0x20000, CRC(1723883c) SHA1(e6b7575a55c045b90fb41290a60306713121acfb) )
20732073
2074   /* the highscore table specifies an unused tile number, so we need ROMREGION_ERASEFF to ensure it is blank */
20752074   ROM_REGION( 0x100000, "gfx1", ROMREGION_ERASEFF )
2076   ROM_LOAD( "bl_08.8h",    0x000000, 0x20000, CRC(aa0f4ff1) SHA1(58f3c468f89d834caaf66d3c084ab87addbb75c0) ) /* chars */
2077   ROM_LOAD( "bl_09.9h",    0x020000, 0x20000, CRC(6fa8c186) SHA1(d4dd26d666f2accce871f70e7882e140d924dd07) )
2075   ROM_LOAD( "bl_08.rom",    0x000000, 0x20000, CRC(aa0f4ff1) SHA1(58f3c468f89d834caaf66d3c084ab87addbb75c0) ) /* chars */
2076   ROM_LOAD( "bl_09.rom",    0x020000, 0x20000, CRC(6fa8c186) SHA1(d4dd26d666f2accce871f70e7882e140d924dd07) )
20782077   /* 40000-7ffff empty */
2079   ROM_LOAD( "bl_18.8j",    0x080000, 0x20000, CRC(c0acafaf) SHA1(7c44b2605da6a324d0c145202cb8bac7af7a9c68) )
2080   ROM_LOAD( "bl_19.9j",    0x0a0000, 0x20000, CRC(1ae942f5) SHA1(e9322790db0bf2a9e862b14e166ee3f36f9ea5ad) )
2078   ROM_LOAD( "bl_18.rom",    0x080000, 0x20000, CRC(c0acafaf) SHA1(7c44b2605da6a324d0c145202cb8bac7af7a9c68) )
2079   ROM_LOAD( "bl_19.rom",    0x0a0000, 0x20000, CRC(1ae942f5) SHA1(e9322790db0bf2a9e862b14e166ee3f36f9ea5ad) )
20812080   /* c0000-fffff empty */
20822081
20832082   ROM_REGION( 0x040000, "gfx2", 0 )
2084   ROM_LOAD( "bl_16.2j",    0x000000, 0x20000, CRC(fadcaff7) SHA1(f4bd8e375fe6b1e6a07b4ec4e58f5807dbd738f8) ) /* sprites */
2085   ROM_LOAD( "bl_17.3j",    0x020000, 0x20000, CRC(5f8cab42) SHA1(3a4c682a7938479e0be80c0494c2c8fc7303b663) )
2083   ROM_LOAD( "bl_16.rom",    0x000000, 0x20000, CRC(fadcaff7) SHA1(f4bd8e375fe6b1e6a07b4ec4e58f5807dbd738f8) ) /* sprites */
2084   ROM_LOAD( "bl_17.rom",    0x020000, 0x20000, CRC(5f8cab42) SHA1(3a4c682a7938479e0be80c0494c2c8fc7303b663) )
20862085
20872086   ROM_REGION( 0x80000, "oki", 0 ) /* OKIM */
2088   ROM_LOAD( "bl_01.2d",    0x00000, 0x20000, CRC(c2ec2abb) SHA1(89981f2a887ace4c4580e2828cbdc962f89c215e) )
2087   ROM_LOAD( "bl_01.rom",    0x00000, 0x20000, CRC(c2ec2abb) SHA1(89981f2a887ace4c4580e2828cbdc962f89c215e) )
20892088ROM_END
20902089
2091ROM_START( blockr2 )
2090ROM_START( blockjoy )
20922091   ROM_REGION( 0x50000, "maincpu", 0 )
2093   ROM_LOAD( "ble_05.14f",   0x00000, 0x08000, CRC(c12e7f4c) SHA1(335f4eab2323b942d5feeb3bab6f7286fabfffb4) )
2094   ROM_LOAD( "ble_06.15f",   0x10000, 0x20000, CRC(cdb13d55) SHA1(2e4489d12a603b4c7dfb90d246ebff9176e88a0b) )
2095   ROM_LOAD( "ble_07.16f",   0x30000, 0x20000, CRC(1d114f13) SHA1(ee3588e1752b3432fd611e2d7d4fb43f942de580) )
2092   ROM_LOAD( "ble_05.bin",   0x00000, 0x08000, CRC(fa2a4536) SHA1(8f584745116bd0ced4d66719cd80c0372b797134) )
2093   ROM_LOAD( "blf_06.bin",   0x10000, 0x20000, CRC(e114ebde) SHA1(12362e809443644b43fbc72e7eead5f376fe11d3) )
2094// a ble_06a labeled rom has been dumped and verified identical to blf_06.bin.
20962095
2097   ROM_REGION( 0x100000, "gfx1", ROMREGION_ERASEFF )
2098   ROM_LOAD( "bl_08.8h",    0x000000, 0x20000, CRC(aa0f4ff1) SHA1(58f3c468f89d834caaf66d3c084ab87addbb75c0) ) /* chars */
2099   ROM_LOAD( "bl_09.9h",    0x020000, 0x20000, CRC(6fa8c186) SHA1(d4dd26d666f2accce871f70e7882e140d924dd07) )
2100   /* 40000-7ffff empty */
2101   ROM_LOAD( "bl_18.8j",    0x080000, 0x20000, CRC(c0acafaf) SHA1(7c44b2605da6a324d0c145202cb8bac7af7a9c68) )
2102   ROM_LOAD( "bl_19.9j",    0x0a0000, 0x20000, CRC(1ae942f5) SHA1(e9322790db0bf2a9e862b14e166ee3f36f9ea5ad) )
2103   /* c0000-fffff empty */
2096// this seems to be a bad version of the above rom, although the rom code is different it is 99% the same, and level 6
2097// is impossible to finish due to a missing block.  Probably bitrot
2098//  ROM_LOAD( "ble_06.bin",   0x10000, 0x20000, BAD_DUMP CRC(58a77402) SHA1(cb24b1edd53a0965c3a9a34fe764b5c1f8dd9733) )
21042099
2105   ROM_REGION( 0x040000, "gfx2", 0 )
2106   ROM_LOAD( "bl_16.2j",    0x000000, 0x20000, CRC(fadcaff7) SHA1(f4bd8e375fe6b1e6a07b4ec4e58f5807dbd738f8) ) /* sprites */
2107   ROM_LOAD( "bl_17.3j",    0x020000, 0x20000, CRC(5f8cab42) SHA1(3a4c682a7938479e0be80c0494c2c8fc7303b663) )
2100   ROM_LOAD( "ble_07.rom",   0x30000, 0x20000, CRC(1d114f13) SHA1(ee3588e1752b3432fd611e2d7d4fb43f942de580) )
21082101
2109   ROM_REGION( 0x80000, "oki", 0 ) /* OKIM */
2110   ROM_LOAD( "bl_01.2d",    0x00000, 0x20000, CRC(c2ec2abb) SHA1(89981f2a887ace4c4580e2828cbdc962f89c215e) )
2111ROM_END
2112
2113ROM_START( blockj )
2114   ROM_REGION( 0x50000, "maincpu", 0 )
2115   ROM_LOAD( "blj_05.14f",   0x00000, 0x08000, CRC(3b55969a) SHA1(86de2f1f5878de380a8b1e3935cffa146863f07f) )
2116   ROM_LOAD( "ble_06.15f",   0x10000, 0x20000, CRC(cdb13d55) SHA1(2e4489d12a603b4c7dfb90d246ebff9176e88a0b) )
2117   ROM_LOAD( "blj_07.16f",   0x30000, 0x20000, CRC(1723883c) SHA1(e6b7575a55c045b90fb41290a60306713121acfb) )
2118
2102   /* the highscore table specifies an unused tile number, so we need ROMREGION_ERASEFF to ensure it is blank */
21192103   ROM_REGION( 0x100000, "gfx1", ROMREGION_ERASEFF )
2120   ROM_LOAD( "bl_08.8h",    0x000000, 0x20000, CRC(aa0f4ff1) SHA1(58f3c468f89d834caaf66d3c084ab87addbb75c0) ) /* chars */
2121   ROM_LOAD( "bl_09.9h",    0x020000, 0x20000, CRC(6fa8c186) SHA1(d4dd26d666f2accce871f70e7882e140d924dd07) )
2104   ROM_LOAD( "bl_08.rom",    0x000000, 0x20000, CRC(aa0f4ff1) SHA1(58f3c468f89d834caaf66d3c084ab87addbb75c0) ) /* chars */
2105   ROM_LOAD( "bl_09.rom",    0x020000, 0x20000, CRC(6fa8c186) SHA1(d4dd26d666f2accce871f70e7882e140d924dd07) )
21222106   /* 40000-7ffff empty */
2123   ROM_LOAD( "bl_18.8j",    0x080000, 0x20000, CRC(c0acafaf) SHA1(7c44b2605da6a324d0c145202cb8bac7af7a9c68) )
2124   ROM_LOAD( "bl_19.9j",    0x0a0000, 0x20000, CRC(1ae942f5) SHA1(e9322790db0bf2a9e862b14e166ee3f36f9ea5ad) )
2107   ROM_LOAD( "bl_18.rom",    0x080000, 0x20000, CRC(c0acafaf) SHA1(7c44b2605da6a324d0c145202cb8bac7af7a9c68) )
2108   ROM_LOAD( "bl_19.rom",    0x0a0000, 0x20000, CRC(1ae942f5) SHA1(e9322790db0bf2a9e862b14e166ee3f36f9ea5ad) )
21252109   /* c0000-fffff empty */
21262110
21272111   ROM_REGION( 0x040000, "gfx2", 0 )
2128   ROM_LOAD( "bl_16.2j",    0x000000, 0x20000, CRC(fadcaff7) SHA1(f4bd8e375fe6b1e6a07b4ec4e58f5807dbd738f8) ) /* sprites */
2129   ROM_LOAD( "bl_17.3j",    0x020000, 0x20000, CRC(5f8cab42) SHA1(3a4c682a7938479e0be80c0494c2c8fc7303b663) )
2112   ROM_LOAD( "bl_16.rom",    0x000000, 0x20000, CRC(fadcaff7) SHA1(f4bd8e375fe6b1e6a07b4ec4e58f5807dbd738f8) ) /* sprites */
2113   ROM_LOAD( "bl_17.rom",    0x020000, 0x20000, CRC(5f8cab42) SHA1(3a4c682a7938479e0be80c0494c2c8fc7303b663) )
21302114
21312115   ROM_REGION( 0x80000, "oki", 0 ) /* OKIM */
2132   ROM_LOAD( "bl_01.2d",    0x00000, 0x20000, CRC(c2ec2abb) SHA1(89981f2a887ace4c4580e2828cbdc962f89c215e) )
2116   ROM_LOAD( "bl_01.rom",    0x00000, 0x20000, CRC(c2ec2abb) SHA1(89981f2a887ace4c4580e2828cbdc962f89c215e) )
21332117ROM_END
21342118
21352119ROM_START( blockbl )
r253556r253557
23412325 *
23422326 *************************************/
23432327
2344GAME( 1988, mgakuen,   0,        mgakuen,   mgakuen,  mitchell_state, mgakuen,   ROT0,   "Yuga",                      "Mahjong Gakuen", MACHINE_SUPPORTS_SAVE )
2345GAME( 1988, 7toitsu,   mgakuen,  mgakuen,   mgakuen,  mitchell_state, mgakuen,   ROT0,   "Yuga",                      "Chi-Toitsu", MACHINE_SUPPORTS_SAVE )
2346GAME( 1989, mgakuen2,  0,        marukin,   marukin,  mitchell_state, mgakuen2,  ROT0,   "Face",                      "Mahjong Gakuen 2 Gakuen-chou no Fukushuu", MACHINE_SUPPORTS_SAVE )
2347GAME( 1989, pkladies,  0,        marukin,   pkladies, mitchell_state, pkladies,  ROT0,   "Mitchell",                  "Poker Ladies", MACHINE_SUPPORTS_SAVE )
2348GAME( 1989, pkladiesl, pkladies, marukin,   pkladies, mitchell_state, pkladies,  ROT0,   "Leprechaun",                "Poker Ladies (Leprechaun ver. 510)", MACHINE_SUPPORTS_SAVE )
2349GAME( 1989, pkladiesla,pkladies, marukin,   pkladies, mitchell_state, pkladies,  ROT0,   "Leprechaun",                "Poker Ladies (Leprechaun ver. 401)", MACHINE_SUPPORTS_SAVE )
2350GAME( 1989, pkladiesbl,pkladies, pkladiesbl,pkladies, mitchell_state, pkladiesbl,ROT0,   "bootleg",                   "Poker Ladies (Censored bootleg)", MACHINE_NOT_WORKING ) // by Playmark? need to figure out CPU 'decryption' / ordering
2351GAME( 1989, dokaben,   0,        pang,      pang,     mitchell_state, dokaben,   ROT0,   "Capcom",                    "Dokaben (Japan)", MACHINE_SUPPORTS_SAVE )
2352GAME( 1989, pang,      0,        pang,      pang,     mitchell_state, pang,      ROT0,   "Mitchell",                  "Pang (World)", MACHINE_SUPPORTS_SAVE )
2353GAME( 1989, bbros,     pang,     pang,      pang,     mitchell_state, pang,      ROT0,   "Mitchell (Capcom license)", "Buster Bros. (USA)", MACHINE_SUPPORTS_SAVE )
2354GAME( 1989, pompingw,  pang,     pang,      pang,     mitchell_state, pang,      ROT0,   "Mitchell",                  "Pomping World (Japan)", MACHINE_SUPPORTS_SAVE )
2355GAME( 1989, pangb,     pang,     pang,      pang,     mitchell_state, pangb,     ROT0,   "bootleg",                   "Pang (bootleg, set 1)", MACHINE_SUPPORTS_SAVE )
2356GAME( 1989, pangbold,  pang,     pang,      pang,     mitchell_state, pangb,     ROT0,   "bootleg",                   "Pang (bootleg, set 2)", MACHINE_SUPPORTS_SAVE )
2357GAME( 1989, pangba,    pang,     spangbl,   pang,     mitchell_state, pangb,     ROT0,   "bootleg",                   "Pang (bootleg, set 3)", MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE )
2358GAME( 1989, pangb2,    pang,     pang,      pang,     mitchell_state, pangb,     ROT0,   "bootleg",                   "Pang (bootleg, set 4)", MACHINE_SUPPORTS_SAVE )
2359GAME( 1989, cworld,    0,        pang,      qtono1,   mitchell_state, cworld,    ROT0,   "Capcom",                    "Capcom World (Japan)", MACHINE_SUPPORTS_SAVE )
2360GAME( 1990, hatena,    0,        pang,      qtono1,   mitchell_state, hatena,    ROT0,   "Capcom",                    "Adventure Quiz 2 - Hatena? no Daibouken (Japan 900228)", MACHINE_SUPPORTS_SAVE )
2361GAME( 1990, spang,     0,        pangnv,    pang,     mitchell_state, spang,     ROT0,   "Mitchell",                  "Super Pang (World 900914)", MACHINE_SUPPORTS_SAVE )
2362GAME( 1990, sbbros,    spang,    pangnv,    pang,     mitchell_state, sbbros,    ROT0,   "Mitchell (Capcom license)", "Super Buster Bros. (USA 901001)", MACHINE_SUPPORTS_SAVE )
2363GAME( 1990, spangj,    spang,    pangnv,    pang,     mitchell_state, spangj,    ROT0,   "Mitchell",                  "Super Pang (Japan 901023)", MACHINE_SUPPORTS_SAVE )
2364GAME( 1990, spangbl,   spang,    spangbl,   spangbl,  mitchell_state, spangbl,   ROT0,   "bootleg",                   "Super Pang (World 900914, bootleg)", MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE ) // different sound hardware
2365GAME( 1994, mstworld,  0,        mstworld,  mstworld, mitchell_state, mstworld,  ROT0,   "bootleg (TCH)",             "Monsters World (bootleg of Super Pang)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )
2366GAME( 1990, marukin,   0,        marukin,   marukin,  mitchell_state, marukin,   ROT0,   "Yuga",                      "Super Marukin-Ban (Japan 901017)", MACHINE_SUPPORTS_SAVE )
2367GAME( 1991, qtono1,    0,        pang,      qtono1,   mitchell_state, qtono1,    ROT0,   "Capcom",                    "Quiz Tonosama no Yabou (Japan)", MACHINE_SUPPORTS_SAVE )
2368GAME( 1991, qsangoku,  0,        pang,      qtono1,   mitchell_state, qsangoku,  ROT0,   "Capcom",                    "Quiz Sangokushi (Japan)", MACHINE_SUPPORTS_SAVE )
2369GAME( 1991, block,     0,        pangnv,    blockjoy, mitchell_state, block,     ROT270, "Capcom",                    "Block Block (World 911219 Joystick)", MACHINE_SUPPORTS_SAVE )
2370GAME( 1991, blockr1,   block,    pangnv,    blockjoy, mitchell_state, block,     ROT270, "Capcom",                    "Block Block (World 911106 Joystick)", MACHINE_SUPPORTS_SAVE )
2371GAME( 1991, blockr2,   block,    pangnv,    block,    mitchell_state, block,     ROT270, "Capcom",                    "Block Block (World 910910)", MACHINE_SUPPORTS_SAVE )
2372GAME( 1991, blockj,    block,    pangnv,    block,    mitchell_state, block,     ROT270, "Capcom",                    "Block Block (Japan 910910)", MACHINE_SUPPORTS_SAVE )
2373GAME( 1991, blockbl,   block,    pangnv,    block,    mitchell_state, blockbl,   ROT270, "bootleg",                   "Block Block (bootleg)", MACHINE_SUPPORTS_SAVE )
2328GAME( 1988, mgakuen,   0,        mgakuen, mgakuen, mitchell_state,  mgakuen,  ROT0,   "Yuga", "Mahjong Gakuen", MACHINE_SUPPORTS_SAVE )
2329GAME( 1988, 7toitsu,   mgakuen,  mgakuen, mgakuen, mitchell_state,  mgakuen,  ROT0,   "Yuga", "Chi-Toitsu", MACHINE_SUPPORTS_SAVE )
2330GAME( 1989, mgakuen2,  0,        marukin, marukin, mitchell_state,  mgakuen2, ROT0,   "Face", "Mahjong Gakuen 2 Gakuen-chou no Fukushuu", MACHINE_SUPPORTS_SAVE )
2331GAME( 1989, pkladies,  0,        marukin, pkladies, mitchell_state, pkladies, ROT0,   "Mitchell", "Poker Ladies", MACHINE_SUPPORTS_SAVE )
2332GAME( 1989, pkladiesl, pkladies, marukin, pkladies, mitchell_state, pkladies, ROT0,   "Leprechaun", "Poker Ladies (Leprechaun ver. 510)", MACHINE_SUPPORTS_SAVE )
2333GAME( 1989, pkladiesla,pkladies, marukin, pkladies, mitchell_state, pkladies, ROT0,   "Leprechaun", "Poker Ladies (Leprechaun ver. 401)", MACHINE_SUPPORTS_SAVE )
2334GAME( 1989, pkladiesbl,pkladies, pkladiesbl,pkladies, mitchell_state,pkladiesbl,ROT0, "bootleg", "Poker Ladies (Censored bootleg)", MACHINE_NOT_WORKING ) // by Playmark? need to figure out CPU 'decryption' / ordering
2335GAME( 1989, dokaben,   0,        pang,    pang, mitchell_state,     dokaben,  ROT0,   "Capcom", "Dokaben (Japan)", MACHINE_SUPPORTS_SAVE )
2336GAME( 1989, pang,      0,        pang,    pang, mitchell_state,     pang,     ROT0,   "Mitchell", "Pang (World)", MACHINE_SUPPORTS_SAVE )
2337GAME( 1989, bbros,     pang,     pang,    pang, mitchell_state,     pang,     ROT0,   "Mitchell (Capcom license)", "Buster Bros. (USA)", MACHINE_SUPPORTS_SAVE )
2338GAME( 1989, pompingw,  pang,     pang,    pang, mitchell_state,     pang,     ROT0,   "Mitchell", "Pomping World (Japan)", MACHINE_SUPPORTS_SAVE )
2339GAME( 1989, pangb,     pang,     pang,    pang, mitchell_state,     pangb,    ROT0,   "bootleg", "Pang (bootleg, set 1)", MACHINE_SUPPORTS_SAVE )
2340GAME( 1989, pangbold,  pang,     pang,    pang, mitchell_state,     pangb,    ROT0,   "bootleg", "Pang (bootleg, set 2)", MACHINE_SUPPORTS_SAVE )
2341GAME( 1989, pangba,    pang,     spangbl, pang, mitchell_state,     pangb,    ROT0,   "bootleg", "Pang (bootleg, set 3)", MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE )
2342GAME( 1989, pangb2,    pang,     pang,    pang, mitchell_state,     pangb,    ROT0,   "bootleg", "Pang (bootleg, set 4)", MACHINE_SUPPORTS_SAVE )
2343GAME( 1989, cworld,    0,        pang,    qtono1, mitchell_state,   cworld,   ROT0,   "Capcom", "Capcom World (Japan)", MACHINE_SUPPORTS_SAVE )
2344GAME( 1990, hatena,    0,        pang,    qtono1, mitchell_state,   hatena,   ROT0,   "Capcom", "Adventure Quiz 2 - Hatena? no Daibouken (Japan 900228)", MACHINE_SUPPORTS_SAVE )
2345GAME( 1990, spang,     0,        pangnv,  pang, mitchell_state,     spang,    ROT0,   "Mitchell", "Super Pang (World 900914)", MACHINE_SUPPORTS_SAVE )
2346GAME( 1990, sbbros,    spang,    pangnv,  pang, mitchell_state,     sbbros,   ROT0,   "Mitchell (Capcom license)", "Super Buster Bros. (USA 901001)", MACHINE_SUPPORTS_SAVE )
2347GAME( 1990, spangj,    spang,    pangnv,  pang, mitchell_state,     spangj,   ROT0,   "Mitchell", "Super Pang (Japan 901023)", MACHINE_SUPPORTS_SAVE )
2348GAME( 1990, spangbl,   spang,    spangbl, spangbl, mitchell_state,  spangbl,  ROT0,   "bootleg", "Super Pang (World 900914, bootleg)", MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE ) // different sound hardware
2349GAME( 1994, mstworld,  0,        mstworld,mstworld, mitchell_state, mstworld, ROT0,   "bootleg (TCH)", "Monsters World (bootleg of Super Pang)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )
2350GAME( 1990, marukin,   0,        marukin, marukin, mitchell_state,  marukin,  ROT0,   "Yuga", "Super Marukin-Ban (Japan 901017)", MACHINE_SUPPORTS_SAVE )
2351GAME( 1991, qtono1,    0,        pang,    qtono1, mitchell_state,   qtono1,   ROT0,   "Capcom", "Quiz Tonosama no Yabou (Japan)", MACHINE_SUPPORTS_SAVE )
2352GAME( 1991, qsangoku,  0,        pang,    qtono1, mitchell_state,   qsangoku, ROT0,   "Capcom", "Quiz Sangokushi (Japan)", MACHINE_SUPPORTS_SAVE )
2353GAME( 1991, block,     0,        pangnv,  block, mitchell_state,    block,    ROT270, "Capcom", "Block Block (World 910910)", MACHINE_SUPPORTS_SAVE )
2354GAME( 1991, blockj,    block,    pangnv,  block, mitchell_state,    block,    ROT270, "Capcom", "Block Block (Japan 910910)", MACHINE_SUPPORTS_SAVE )
2355GAME( 1991, blockjoy,  block,    pangnv,  blockjoy, mitchell_state, block,    ROT270, "Capcom", "Block Block (World 911106 Joystick)", MACHINE_SUPPORTS_SAVE )
2356GAME( 1991, blockbl,   block,    pangnv,  block, mitchell_state,    blockbl,  ROT270, "bootleg", "Block Block (bootleg)", MACHINE_SUPPORTS_SAVE )
trunk/src/mame/drivers/pc9801.cpp
r253556r253557
513513   UINT8 *m_kanji_rom;
514514
515515   UINT8 m_dma_offset[4];
516   UINT8 m_dma_autoinc[4];
517516   int m_dack;
518517
519518   UINT8 m_video_ff[8],m_gfx_ff;
r253556r253557
571570   UINT8 m_sys_type;
572571
573572   DECLARE_WRITE_LINE_MEMBER( write_uart_clock );
574   DECLARE_WRITE8_MEMBER(rtc_w);
575   DECLARE_WRITE8_MEMBER(dmapg4_w);
576   DECLARE_WRITE8_MEMBER(dmapg8_w);
573   DECLARE_WRITE8_MEMBER(rtc_dmapg_w);
577574   DECLARE_WRITE8_MEMBER(nmi_ctrl_w);
578575   DECLARE_WRITE8_MEMBER(vrtc_clear_w);
579576   DECLARE_WRITE8_MEMBER(pc9801_video_ff_w);
r253556r253557
978975}
979976
980977
981WRITE8_MEMBER(pc9801_state::rtc_w)
978WRITE8_MEMBER(pc9801_state::rtc_dmapg_w)
982979{
983   m_rtc->c0_w((data & 0x01) >> 0);
984   m_rtc->c1_w((data & 0x02) >> 1);
985   m_rtc->c2_w((data & 0x04) >> 2);
986   m_rtc->stb_w((data & 0x08) >> 3);
987   m_rtc->clk_w((data & 0x10) >> 4);
988   m_rtc->data_in_w(((data & 0x20) >> 5));
989   if(data & 0xc0)
990      logerror("RTC write to undefined bits %02x\n",data & 0xc0);
980   if((offset & 1) == 0)
981   {
982      if(offset == 0)
983      {
984         m_rtc->c0_w((data & 0x01) >> 0);
985         m_rtc->c1_w((data & 0x02) >> 1);
986         m_rtc->c2_w((data & 0x04) >> 2);
987         m_rtc->stb_w((data & 0x08) >> 3);
988         m_rtc->clk_w((data & 0x10) >> 4);
989         m_rtc->data_in_w(((data & 0x20) >> 5));
990         if(data & 0xc0)
991            logerror("RTC write to undefined bits %02x\n",data & 0xc0);
992      }
993      else
994         logerror("Write to undefined port [%02x] <- %02x\n",offset+0x20,data);
995   }
996   else // odd
997   {
998//      logerror("Write to DMA bank register %d %02x\n",((offset >> 1)+1) & 3,data);
999      m_dma_offset[((offset >> 1)+1) & 3] = data & 0x0f;
1000   }
9911001}
9921002
993WRITE8_MEMBER(pc9801_state::dmapg4_w)
994{
995   m_dma_offset[(offset+1) & 3] = data & 0x0f;
996}
997
998WRITE8_MEMBER(pc9801_state::dmapg8_w)
999{
1000   if(offset == 4)
1001      m_dma_autoinc[data & 3] = (data >> 2) & 3;
1002   else if(offset < 4)
1003      m_dma_offset[(offset+1) & 3] = data;
1004}
1005
10061003WRITE8_MEMBER(pc9801_state::nmi_ctrl_w)
10071004{
10081005   m_nmi_ff = (offset & 2) >> 1;
r253556r253557
17861783   ADDRESS_MAP_UNMAP_HIGH
17871784   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8("i8237", am9517a_device, read, write, 0xff00)
17881785   AM_RANGE(0x0000, 0x000f) AM_READWRITE8(pic_r, pic_w, 0x00ff) // i8259 PIC (bit 3 ON slave / master) / i8237 DMA
1789   AM_RANGE(0x0020, 0x0021) AM_WRITE8(rtc_w,0x00ff)
1790   AM_RANGE(0x0020, 0x0027) AM_WRITE8(dmapg4_w,0xff00)
1786   AM_RANGE(0x0020, 0x0027) AM_WRITE8(rtc_dmapg_w,0xffff) // RTC / DMA registers (LS244)
17911787   AM_RANGE(0x0030, 0x0037) AM_DEVREADWRITE8("ppi8255_sys", i8255_device, read, write, 0xff00) //i8251 RS232c / i8255 system port
17921788   AM_RANGE(0x0040, 0x0047) AM_DEVREADWRITE8("ppi8255_prn", i8255_device, read, write, 0x00ff)
17931789   AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE8("keyb", pc9801_kbd_device, rx_r, tx_w, 0xff00) //i8255 printer port / i8251 keyboard
r253556r253557
22452241
22462242static ADDRESS_MAP_START( pc9801ux_io, AS_IO, 16, pc9801_state )
22472243   ADDRESS_MAP_UNMAP_HIGH
2248   AM_RANGE(0x0020, 0x002f) AM_WRITE8(dmapg8_w,0xff00)
22492244   AM_RANGE(0x0050, 0x0057) AM_NOP // 2dd ppi?
22502245   AM_RANGE(0x005c, 0x005f) AM_READ(pc9821_timestamp_r) AM_WRITENOP // artic
22512246   AM_RANGE(0x0068, 0x006b) AM_WRITE8(pc9801rs_video_ff_w,0x00ff) //mode FF / <undefined>
r253556r253557
22932288{
22942289   if(offset == 1)
22952290   {
2296      if(((data & 0xfe) == 4) && !m_ex_video_ff[3]) // TODO: many other settings are protected
2297         return;
22982291      m_ex_video_ff[(data & 0xfe) >> 1] = data & 1;
22992292
23002293      //if((data & 0xfe) == 0x20)
r253556r253557
24862479//  ADDRESS_MAP_UNMAP_HIGH // TODO: a read to somewhere makes this to fail at POST
24872480   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8("i8237", am9517a_device, read, write, 0xff00ff00)
24882481   AM_RANGE(0x0000, 0x000f) AM_READWRITE8(pic_r, pic_w, 0x00ff00ff) // i8259 PIC (bit 3 ON slave / master) / i8237 DMA
2489   AM_RANGE(0x0020, 0x0023) AM_WRITE8(rtc_w,0x000000ff)
2490   AM_RANGE(0x0020, 0x002f) AM_WRITE8(dmapg8_w,0xff00ff00)
2482   AM_RANGE(0x0020, 0x0027) AM_WRITE8(rtc_dmapg_w,        0xffffffff) // RTC / DMA registers (LS244)
24912483   AM_RANGE(0x0030, 0x0037) AM_DEVREADWRITE8("ppi8255_sys", i8255_device, read, write, 0xff00ff00) //i8251 RS232c / i8255 system port
24922484   AM_RANGE(0x0040, 0x0047) AM_DEVREADWRITE8("ppi8255_prn", i8255_device, read, write, 0x00ff00ff)
24932485   AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE8("keyb", pc9801_kbd_device, rx_r, tx_w, 0xff00ff00) //i8255 printer port / i8251 keyboard
r253556r253557
28912883{
28922884   address_space &program = m_maincpu->space(AS_PROGRAM);
28932885   offs_t addr = (m_dma_offset[m_dack] << 16) | offset;
2894   if(offset == 0xffff)
2895   {
2896      switch(m_dma_autoinc[m_dack])
2897      {
2898         case 1:
2899         {
2900            UINT8 page = m_dma_offset[m_dack];
2901            m_dma_offset[m_dack] = ((page + 1) & 0xf) | (page & 0xf0);
2902            break;
2903         }
2904         case 3:
2905            m_dma_offset[m_dack]++;
2906            break;
2907      }
2908   }
29092886
29102887//  logerror("%08x\n",addr);
29112888
r253556r253557
29172894{
29182895   address_space &program = m_maincpu->space(AS_PROGRAM);
29192896   offs_t addr = (m_dma_offset[m_dack] << 16) | offset;
2920   if(offset == 0xffff)
2921   {
2922      switch(m_dma_autoinc[m_dack])
2923      {
2924         case 1:
2925         {
2926            UINT8 page = m_dma_offset[m_dack];
2927            m_dma_offset[m_dack] = ((page + 1) & 0xf) | (page & 0xf0);
2928            break;
2929         }
2930         case 3:
2931            m_dma_offset[m_dack]++;
2932            break;
2933      }
2934   }
2897
29352898//  logerror("%08x %02x\n",addr,data);
29362899
29372900   program.write_byte(addr, data);
r253556r253557
31763139   m_mouse.control = 0xff;
31773140   m_mouse.freq_reg = 0;
31783141   m_mouse.freq_index = 0;
3179   m_dma_autoinc[0] = m_dma_autoinc[1] = m_dma_autoinc[2] = m_dma_autoinc[3] = 0;
31803142   memset(&m_egc, 0, sizeof(m_egc));
31813143}
31823144
r253556r253557
34683430
34693431   MCFG_RAM_ADD(RAM_TAG)
34703432   MCFG_RAM_DEFAULT_SIZE("1664K")
3471   MCFG_RAM_EXTRA_OPTIONS("640K,3712K,7808K,14M")
3433   MCFG_RAM_EXTRA_OPTIONS("640K,3712K,7808K")
34723434
34733435   MCFG_DEVICE_MODIFY("upd7220_btm")
34743436   MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_grcg_2_map)
trunk/src/mame/drivers/sigmab52.cpp
r253556r253557
1010
1111  Games running on this hardware:
1212
13  * Joker's Wild (B52 system, BP55114-V1104, Ver.054NMV),               199?, Sigma.
14  * Joker's Wild (B52 system, BP55114-V1104, Ver.054NMV, Harrah's GFX), 199?, Sigma.
15  * Joker's Wild (B52 system, WP02001-054, Ver.031WM),                  199?, Sigma.
16  * Super 8 Ways FC (DB98103-011, Fruit combination),                   1989, Sigma.
13  * Joker's Wild (B52 system, set 1),        199?, Sigma.
14  * Joker's Wild (B52 system, set 2),        199?, Sigma.
15  * Joker's Wild (B52 system, Harrah's GFX), 199?, Sigma.
1716
1817
1918  The HD63484 ACRTC support is a bit hacky and incomplete,
r253556r253557
619618*        Rom Load        *
620619*************************/
621620
622/* Joker's Wild
623   BP55114-V1104, Ver.054NMV
624   Modern cards set. Normal cardsback.
625*/
626621ROM_START( jwildb52 )
627   ROM_REGION( 0x10000, "maincpu", 0 )  // BP55114-V1104, Ver.054NMV
622   ROM_REGION( 0x10000, "maincpu", 0 )
628623   ROM_LOAD( "poker.ic95", 0x00000, 0x10000, CRC(07eb9007) SHA1(ee814c40c6d8c9ea9e5246cae0cfa2c30f2976ed) )
629624
630625   ROM_REGION16_BE( 0x40000, "gfx1", 0 )
r253556r253557
641636ROM_END
642637
643638
644/* Joker's Wild
645   BP55114-V1104, Ver.054NMV
646   Modern cards set. Harrah's cardsback.
647*/
648ROM_START( jwildb52h )
649   ROM_REGION( 0x10000, "maincpu", 0 )
650   ROM_LOAD( "jokers_wild_ver_xxx.ic95", 0x00000, 0x10000, CRC(07eb9007) SHA1(ee814c40c6d8c9ea9e5246cae0cfa2c30f2976ed) )
651
652   ROM_REGION16_BE( 0x40000, "gfx1", 0 )
653   ROM_LOAD32_BYTE( "2006-1_harrahs.ic45", 0x00003, 0x10000, CRC(6e6871dc) SHA1(5dfc99c808c06ec34838324181988d4550c1ed1a) )
654   ROM_LOAD32_BYTE( "2006-2_harrahs.ic46", 0x00001, 0x10000, CRC(1039c62d) SHA1(11f0dbcbbff5f6e9028a0305f7e16a0654be40d4) )
655   ROM_LOAD32_BYTE( "2006-3_harrahs.ic47", 0x00000, 0x10000, CRC(d66af95a) SHA1(70bba1aeea9221541b82642045ce8ecf26e1d08c) )
656   ROM_LOAD32_BYTE( "2006-4_harrahs.ic48", 0x00002, 0x10000, CRC(2bf196cb) SHA1(686ca0dd84c48f51efee5349ea3db65531dd4a52) )
657
658   ROM_REGION( 0x8000, "audiocpu", 0 )
659   ROM_LOAD( "poker-01-00.43", 0x0000, 0x8000, CRC(2712d44c) SHA1(295526b27676cd97cbf111d47305d63c2b3ea50d) )
660
661   ROM_REGION( 0x0100, "proms", 0 )
662   ROM_LOAD( "mb7118.41", 0x0000, 0x0100, CRC(b362f9e2) SHA1(3963b40389ed6584e4cd96ab48849552857d99af) )
663ROM_END
664
665
666/* Joker's Wild
667   WP02001-054, Ver.031WM
668   Classic cards set.  Normal cardsback.
669*/
670639ROM_START( jwildb52a )
671640   ROM_REGION( 0x10000, "maincpu", 0 )
672641   ROM_LOAD( "sigm_wrk.bin", 0x00000, 0x10000, CRC(15c83c6c) SHA1(7a05bd94ea8b1ad051fbe6580a6550d4bb47dd15) )
r253556r253557
687656ROM_END
688657
689658
690/* Super 8 Ways FC
691   Fruit combination.
692   DB98103-011.
693*/
659ROM_START( jwildb52h )
660   ROM_REGION( 0x10000, "maincpu", 0 )
661   ROM_LOAD( "jokers_wild_ver_xxx.ic95", 0x00000, 0x10000, CRC(07eb9007) SHA1(ee814c40c6d8c9ea9e5246cae0cfa2c30f2976ed) )
662
663   ROM_REGION16_BE( 0x40000, "gfx1", 0 )
664   ROM_LOAD32_BYTE( "2006-1_harrahs.ic45", 0x00003, 0x10000, CRC(6e6871dc) SHA1(5dfc99c808c06ec34838324181988d4550c1ed1a) )
665   ROM_LOAD32_BYTE( "2006-2_harrahs.ic46", 0x00001, 0x10000, CRC(1039c62d) SHA1(11f0dbcbbff5f6e9028a0305f7e16a0654be40d4) )
666   ROM_LOAD32_BYTE( "2006-3_harrahs.ic47", 0x00000, 0x10000, CRC(d66af95a) SHA1(70bba1aeea9221541b82642045ce8ecf26e1d08c) )
667   ROM_LOAD32_BYTE( "2006-4_harrahs.ic48", 0x00002, 0x10000, CRC(2bf196cb) SHA1(686ca0dd84c48f51efee5349ea3db65531dd4a52) )
668
669   ROM_REGION( 0x8000, "audiocpu", 0 )
670   ROM_LOAD( "poker-01-00.43", 0x0000, 0x8000, CRC(2712d44c) SHA1(295526b27676cd97cbf111d47305d63c2b3ea50d) )
671
672   ROM_REGION( 0x0100, "proms", 0 )
673   ROM_LOAD( "mb7118.41", 0x0000, 0x0100, CRC(b362f9e2) SHA1(3963b40389ed6584e4cd96ab48849552857d99af) )
674ROM_END
675
676
694677ROM_START( s8waysfc )
695678   ROM_REGION( 0x10000, "maincpu", 0 )
696679   ROM_LOAD( "dv98103.011", 0x00000, 0x10000, CRC(416190a1) SHA1(e2738644efc6c2adcea2470b482f3f818ed9af8d) )
r253556r253557
715698*      Driver Init       *
716699*************************/
717700
718DRIVER_INIT_MEMBER(sigmab52_state, jwildb52)
701DRIVER_INIT_MEMBER(sigmab52_state,jwildb52)
719702{
720703}
721704
r253556r253557
724707*      Game Drivers      *
725708*************************/
726709
727/*     YEAR  NAME       PARENT    MACHINE   INPUT     STATE           INIT      ROT    COMPANY  FULLNAME                                                             FLAGS */
728GAMEL( 199?, jwildb52,  0,        jwildb52, jwildb52, sigmab52_state, jwildb52, ROT0, "Sigma", "Joker's Wild (B52 system, BP55114-V1104, Ver.054NMV)",               MACHINE_NOT_WORKING, layout_sigmab52 )
729GAMEL( 199?, jwildb52h, jwildb52, jwildb52, jwildb52, sigmab52_state, jwildb52, ROT0, "Sigma", "Joker's Wild (B52 system, BP55114-V1104, Ver.054NMV, Harrah's GFX)", MACHINE_NOT_WORKING, layout_sigmab52 )
730GAMEL( 199?, jwildb52a, jwildb52, jwildb52, jwildb52, sigmab52_state, jwildb52, ROT0, "Sigma", "Joker's Wild (B52 system, WP02001-054, Ver.031WM)",                  MACHINE_NOT_WORKING, layout_sigmab52 )
731GAME ( 1989, s8waysfc,  0,        jwildb52, s8waysfc, sigmab52_state, jwildb52, ROT0, "Sigma", "Super 8 Ways FC (DB98103-011, Fruit combination)",                   MACHINE_NOT_WORKING )
710/*    YEAR  NAME       PARENT    MACHINE   INPUT     INIT      ROT    COMPANY  FULLNAME                                  FLAGS */
711GAMEL( 199?, jwildb52,  0,        jwildb52, jwildb52, sigmab52_state, jwildb52, ROT0, "Sigma", "Joker's Wild (B52 system, set 1)",        MACHINE_NOT_WORKING, layout_sigmab52 )
712GAMEL( 199?, jwildb52a, jwildb52, jwildb52, jwildb52, sigmab52_state, jwildb52, ROT0, "Sigma", "Joker's Wild (B52 system, set 2)",        MACHINE_NOT_WORKING, layout_sigmab52 )
713GAMEL( 199?, jwildb52h, jwildb52, jwildb52, jwildb52, sigmab52_state, jwildb52, ROT0, "Sigma", "Joker's Wild (B52 system, Harrah's GFX)", MACHINE_NOT_WORKING, layout_sigmab52 )
714GAME ( 199?, s8waysfc,  0,        jwildb52, s8waysfc, sigmab52_state, jwildb52, ROT0, "Sigma", "Super 8 Ways FC (Fruit combination)",     MACHINE_NOT_WORKING )
trunk/src/mame/drivers/ticalc1x.cpp
r253556r253557
3535   ticalc1x_state(const machine_config &mconfig, device_type type, const char *tag)
3636      : hh_tms1k_state(mconfig, type, tag)
3737   { }
38
39protected:
40   virtual void machine_start() override;
3841};
3942
4043
44void ticalc1x_state::machine_start()
45{
46   hh_tms1k_state::machine_start();
47   memset(m_display_segmask, ~0, sizeof(m_display_segmask)); // !
48}
4149
50
51
4252/***************************************************************************
4353
4454  Minidrivers (subclass, I/O, Inputs, Machine Config)
r253556r253557
7585void tisr16_state::prepare_display()
7686{
7787   // update leds state
78   set_display_segmask(0xfff, 0xff);
79   display_matrix(8, 12, m_o, m_r, false);
88   for (int y = 0; y < 11; y++)
89      m_display_state[y] = (m_r >> y & 1) ? m_o : 0;
8090
8191   // exponent sign is from R10 O1, and R10 itself only uses segment G
8292   m_display_state[11] = m_display_state[10] << 5 & 0x40;
8393   m_display_state[10] &= 0x40;
94
95   set_display_size(8, 12);
8496   display_update();
8597}
8698
8799WRITE16_MEMBER(tisr16_state::write_r)
88100{
89   // R0-R10: input mux, select digit
101   // R0-R10: input mux
102   // R0-R10: select digit (right-to-left)
90103   m_r = m_inp_mux = data;
91104   prepare_display();
92105}
r253556r253557
246259static MACHINE_CONFIG_START( tisr16, tisr16_state )
247260
248261   /* basic machine hardware */
249   MCFG_CPU_ADD("maincpu", TMS1000, 300000) // approximation - RC osc. R=43K, C=68pf (note: tisr16ii MCU RC osc. is different: R=30K, C=100pf, same freq)
262   MCFG_CPU_ADD("maincpu", TMS1000, 300000) // RC osc. R=43K, C=68pf -> ~300kHz (note: tisr16ii MCU RC osc. is different: R=30K, C=100pf -> also ~300kHz)
250263   MCFG_TMS1XXX_READ_K_CB(READ8(tisr16_state, read_k))
251264   MCFG_TMS1XXX_WRITE_O_CB(WRITE16(tisr16_state, write_o))
252265   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(tisr16_state, write_r))
r253556r253557
302315
303316WRITE16_MEMBER(ti1250_state::write_r)
304317{
305   // R0-R8: select digit
306   set_display_segmask(0xff, 0xff);
307   set_display_segmask(0x100, 0x40); // R8 only has segment G connected
308   display_matrix(8, 9, m_o, data);
318   // R8 only has segment G connected
319   m_display_segmask[8] = 0x40;
320
321   // R0-R7(,R8): select digit (right-to-left)
322   display_matrix_seg(8, 9, m_o, data, 0xff);
309323}
310324
311325WRITE16_MEMBER(ti1250_state::write_o)
r253556r253557
384398static MACHINE_CONFIG_START( ti1250, ti1250_state )
385399
386400   /* basic machine hardware */
387   MCFG_CPU_ADD("maincpu", TMS0950, 200000) // approximation - RC osc. R=68K, C=68pf
401   MCFG_CPU_ADD("maincpu", TMS0950, 200000) // RC osc. R=68K, C=68pf -> ~200kHz
388402   MCFG_TMS1XXX_READ_K_CB(READ8(ti1250_state, read_k))
389403   MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ti1250_state, write_o))
390404   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ti1250_state, write_r))
r253556r253557
437451
438452WRITE16_MEMBER(ti1000_state::write_r)
439453{
440   // R0-R7: select digit
441   set_display_segmask(0xff, 0xff);
442   display_matrix(8, 8, m_o, data);
454   // R0-R7: select digit (right-to-left)
455   UINT8 o = BITSWAP8(m_o,7,4,3,2,1,0,6,5);
456   display_matrix_seg(8, 8, o, data, 0xff);
443457}
444458
445459WRITE16_MEMBER(ti1000_state::write_o)
r253556r253557
447461   // O0-O3,O5(?): input mux
448462   // O0-O7: digit segments
449463   m_inp_mux = (data & 0xf) | (data >> 1 & 0x10);
450   m_o = BITSWAP8(data,7,4,3,2,1,0,6,5);
464   m_o = data;
451465}
452466
453467READ8_MEMBER(ti1000_state::read_k)
r253556r253557
541555
542556   // 3rd digit only has A and G for =, though some newer hardware revisions
543557   // (goes for both wizatron and lilprof) use a custom equals-sign digit here
544   set_display_segmask(8, 0x41);
558   m_display_segmask[3] = 0x41;
545559
546   // R0-R8: select digit
547   set_display_segmask(0x1ff^8, 0x7f);
548   display_matrix(7, 9, m_o, data);
560   // R0-R8: select digit (right-to-left)
561   display_matrix_seg(7, 9, m_o, data, 0x7f);
549562}
550563
551564WRITE16_MEMBER(wizatron_state::write_o)
r253556r253557
712725WRITE16_MEMBER(lilprof78_state::write_r)
713726{
714727   // update leds state
715   UINT8 seg = BITSWAP8(m_o,7,4,3,2,1,0,6,5) & 0x7f;
728   UINT8 o = BITSWAP8(m_o,7,4,3,2,1,0,6,5) & 0x7f;
716729   UINT16 r = (data & 7) | (data << 1 & 0x1f0);
717   set_display_segmask(0x1ff, 0x7f);
718   display_matrix(7, 9, seg, r, false);
719   
730
731   for (int y = 0; y < 9; y++)
732      m_display_state[y] = (r >> y & 1) ? o : 0;
733
720734   // 3rd digit A/G(equals sign) is from O7
721   m_display_state[3] = (r != 0 && m_o & 0x80) ? 0x41 : 0;
735   m_display_state[3] = (r && m_o & 0x80) ? 0x41 : 0;
722736
723737   // 6th digit is a custom 7seg for math symbols (see wizatron_state write_r)
724738   m_display_state[6] = BITSWAP8(m_display_state[6],7,6,1,4,2,3,5,0);
739
740   set_display_size(7, 9);
725741   display_update();
726742}
727743
r253556r253557
820836void dataman_state::prepare_display()
821837{
822838   // note the extra segment on R9
823   set_display_segmask(0x1ff, 0x7f);
824   display_matrix(8, 9, m_o | (m_r >> 2 & 0x80), m_r & 0x1ff);
839   display_matrix_seg(8, 9, m_o | (m_r >> 2 & 0x80), m_r & 0x1ff, 0x7f);
825840}
826841
827842WRITE16_MEMBER(dataman_state::write_r)
r253556r253557
944959
945960WRITE16_MEMBER(ti30_state::write_r)
946961{
962   // 1st digit only has segments B,F,G,DP
963   m_display_segmask[0] = 0xe2;
964
947965   // R0-R8: select digit
948   set_display_segmask(0x1fe, 0xff);
949   set_display_segmask(0x001, 0xe2); // 1st digit only has segments B,F,G,DP
950   display_matrix(8, 9, m_o, data);
966   UINT8 o = BITSWAP8(m_o,7,5,2,1,4,0,6,3);
967   display_matrix_seg(8, 9, o, data, 0xff);
951968}
952969
953970WRITE16_MEMBER(ti30_state::write_o)
r253556r253557
955972   // O0-O2,O4-O7: input mux
956973   // O0-O7: digit segments
957974   m_inp_mux = (data & 7) | (data >> 1 & 0x78);
958   m_o = BITSWAP8(data,7,5,2,1,4,0,6,3);
975   m_o = data;
959976}
960977
961978READ8_MEMBER(ti30_state::read_k)
r253556r253557
13671384
13681385COMP( 1977, dataman,   0,        0, dataman,   dataman,   driver_device, 0, "Texas Instruments", "DataMan", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW )
13691386
1370COMP( 1976, ti30,      0,        0, ti30,     ti30,       driver_device, 0, "Texas Instruments", "TI-30", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW )
1371COMP( 1976, tibusan,   0,        0, ti30,     tibusan,    driver_device, 0, "Texas Instruments", "TI Business Analyst", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW )
1372COMP( 1977, tiprog,    0,        0, ti30,     tiprog,     driver_device, 0, "Texas Instruments", "TI Programmer", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW )
1387COMP( 1976, ti30,      0,        0, ti30,     ti30,      driver_device, 0, "Texas Instruments", "TI-30", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW )
1388COMP( 1976, tibusan,   0,        0, ti30,     tibusan,   driver_device, 0, "Texas Instruments", "TI Business Analyst", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW )
1389COMP( 1977, tiprog,    0,        0, ti30,     tiprog,    driver_device, 0, "Texas Instruments", "TI Programmer", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW )
trunk/src/mame/includes/blmbycar.h
r253556r253557
1111public:
1212   blmbycar_state(const machine_config &mconfig, device_type type, const char *tag)
1313      : driver_device(mconfig, type, tag),
14      m_maincpu(*this, "maincpu"),
15      m_gfxdecode(*this, "gfxdecode"),
16      m_palette(*this, "palette"),
1714      m_vram_1(*this, "vram_1"),
1815      m_vram_0(*this, "vram_0"),
1916      m_scroll_1(*this, "scroll_1"),
2017      m_scroll_0(*this, "scroll_0"),
21      m_spriteram(*this, "spriteram") { }
18      m_spriteram(*this, "spriteram"),
19      m_maincpu(*this, "maincpu"),
20      m_gfxdecode(*this, "gfxdecode"),
21      m_palette(*this, "palette") { }
2222
23   /* devices */
24   required_device<cpu_device> m_maincpu;
25   required_device<gfxdecode_device> m_gfxdecode;
26   required_device<palette_device> m_palette;
27
2823   /* memory pointers */
2924   required_shared_ptr<UINT16> m_vram_1;
3025   required_shared_ptr<UINT16> m_vram_0;
r253556r253557
4035   UINT8       m_pot_wheel;    // blmbycar
4136   int         m_old_val;  // blmbycar
4237   int         m_retvalue; // waterball
43
44   // common
45   DECLARE_WRITE16_MEMBER(okibank_w);
46   DECLARE_WRITE16_MEMBER(vram_0_w);
47   DECLARE_WRITE16_MEMBER(vram_1_w);
48
49   // blmbycar
38   DECLARE_WRITE16_MEMBER(blmbycar_okibank_w);
5039   DECLARE_WRITE16_MEMBER(blmbycar_pot_wheel_reset_w);
5140   DECLARE_WRITE16_MEMBER(blmbycar_pot_wheel_shift_w);
5241   DECLARE_READ16_MEMBER(blmbycar_pot_wheel_r);
5342   DECLARE_READ16_MEMBER(blmbycar_opt_wheel_r);
54
55   // waterball
5643   DECLARE_READ16_MEMBER(waterball_unk_r);
57
44   DECLARE_WRITE16_MEMBER(blmbycar_vram_0_w);
45   DECLARE_WRITE16_MEMBER(blmbycar_vram_1_w);
46   DECLARE_DRIVER_INIT(blmbycar);
5847   TILE_GET_INFO_MEMBER(get_tile_info_0);
5948   TILE_GET_INFO_MEMBER(get_tile_info_1);
60
61   DECLARE_DRIVER_INIT(blmbycar);
6249   virtual void video_start() override;
6350   DECLARE_MACHINE_START(blmbycar);
6451   DECLARE_MACHINE_RESET(blmbycar);
6552   DECLARE_MACHINE_START(watrball);
6653   DECLARE_MACHINE_RESET(watrball);
67   
68   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
54   UINT32 screen_update_blmbycar(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
6955   void draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect );
56   required_device<cpu_device> m_maincpu;
57   required_device<gfxdecode_device> m_gfxdecode;
58   required_device<palette_device> m_palette;
7059};
trunk/src/mame/includes/fidelz80.h
r253556r253557
6262   void display_update();
6363   void set_display_size(int maxx, int maxy);
6464   void set_display_segmask(UINT32 digits, UINT32 mask);
65   void display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety, bool update = true);
65   void display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety);
6666
6767protected:
6868   virtual void machine_start() override;
trunk/src/mame/includes/glass.h
r253556r253557
1111public:
1212   glass_state(const machine_config &mconfig, device_type type, const char *tag)
1313      : driver_device(mconfig, type, tag),
14      m_maincpu(*this, "maincpu"),
15      m_gfxdecode(*this, "gfxdecode"),
16      m_palette(*this, "palette"),
1714      m_videoram(*this, "videoram"),
1815      m_vregs(*this, "vregs"),
1916      m_spriteram(*this, "spriteram"),
20      m_mainram(*this, "mainram") { }
21     
17      m_mainram(*this, "mainram"),
18      m_maincpu(*this, "maincpu"),
19      m_gfxdecode(*this, "gfxdecode"),
20      m_palette(*this, "palette") { }
2221
23   /* devices */
24   required_device<cpu_device> m_maincpu;
25   required_device<gfxdecode_device> m_gfxdecode;
26   required_device<palette_device> m_palette;
27
2822   /* memory pointers */
2923   required_shared_ptr<UINT16> m_videoram;
3024   required_shared_ptr<UINT16> m_vregs;
r253556r253557
4034   int         m_current_command;
4135   int         m_cause_interrupt;
4236   int         m_blitter_serial_buffer[5];
43
4437   DECLARE_WRITE16_MEMBER(clr_int_w);
4538   DECLARE_WRITE16_MEMBER(OKIM6295_bankswitch_w);
46   DECLARE_WRITE16_MEMBER(coin_w);
47   DECLARE_WRITE16_MEMBER(blitter_w);
48   DECLARE_WRITE16_MEMBER(vram_w);
49   DECLARE_READ16_MEMBER(mainram_r);
50   DECLARE_WRITE16_MEMBER(mainram_w);
39   DECLARE_WRITE16_MEMBER(glass_coin_w);
40   DECLARE_WRITE16_MEMBER(glass_blitter_w);
41   DECLARE_WRITE16_MEMBER(glass_vram_w);
5142
43   DECLARE_READ16_MEMBER( glass_mainram_r );
44   DECLARE_WRITE16_MEMBER( glass_mainram_w );
45
5246   DECLARE_DRIVER_INIT(glass);
5347   DECLARE_DRIVER_INIT(glassp);
48   TILE_GET_INFO_MEMBER(get_tile_info_glass_screen0);
49   TILE_GET_INFO_MEMBER(get_tile_info_glass_screen1);
5450   virtual void machine_start() override;
5551   virtual void machine_reset() override;
5652   virtual void video_start() override;
57   
58   TILE_GET_INFO_MEMBER(get_tile_info_screen0);
59   TILE_GET_INFO_MEMBER(get_tile_info_screen1);
60   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
61   INTERRUPT_GEN_MEMBER(interrupt);
53   UINT32 screen_update_glass(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
54   INTERRUPT_GEN_MEMBER(glass_interrupt);
6255   void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
63   void ROM16_split_gfx( const char *src_reg, const char *dst_reg, int start, int length, int dest1, int dest2 );
56   void glass_ROM16_split_gfx( const char *src_reg, const char *dst_reg, int start, int length, int dest1, int dest2 );
57   required_device<cpu_device> m_maincpu;
58   required_device<gfxdecode_device> m_gfxdecode;
59   required_device<palette_device> m_palette;
6460};
trunk/src/mame/includes/hh_tms1k.h
r253556r253557
6262   void display_update();
6363   void set_display_size(int maxx, int maxy);
6464   void set_display_segmask(UINT32 digits, UINT32 mask);
65   void display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety, bool update = true);
65   void display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety);
66   void display_matrix_seg(int maxx, int maxy, UINT32 setx, UINT32 sety, UINT16 segmask);
6667
6768protected:
6869   virtual void machine_start() override;
trunk/src/mame/includes/hh_ucom4.h
r253556r253557
5555   TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick);
5656   void display_update();
5757   void set_display_size(int maxx, int maxy);
58   void display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety, bool update = true);
58   void display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety);
5959
6060protected:
6161   virtual void machine_start() override;
trunk/src/mame/includes/xbox.h
r253556r253557
188188   ENDPOINT=5
189189};
190190
191enum USBRequestType
192{
193   StandardType=0,
194   ClassType,
195   VendorType,
196   ReservedType
197};
198
199enum USBRequestRecipient
200{
201   DeviceRecipient=0,
202   InterfaceRecipient,
203   EndpointRecipient,
204   OtherRecipient
205};
206
207enum USBDeviceState
208{
209   DefaultState,
210   AddressState,
211   ConfiguredState
212};
213
214191class ohci_function_device {
215192public:
216193   ohci_function_device(running_machine &machine);
r253556r253557
221198   void add_configuration_descriptor(USBStandardConfigurationDescriptor &descriptor);
222199   void add_interface_descriptor(USBStandardInterfaceDescriptor &descriptor);
223200   void add_endpoint_descriptor(USBStandardEndpointDescriptor &descriptor);
224   int handle_nonstandard_request(USBSetupPacket *setup);
225   int state;
226201   int address;
227202   int newaddress;
228203   int controldirection;
229204   int controltype;
230205   int controlrecipient;
231   int configurationvalue;
232206   bool settingaddress;
233207   int remain;
234208   UINT8 *position;
trunk/src/mame/layout/cnfball2.lay
r253556r253557
1<?xml version="1.0"?>
2<mamelayout version="2">
3
4<!-- define elements -->
5
6   <element name="static_black"><rect><color red="0.0" green="0.0" blue="0.0" /></rect></element>
7   <element name="static_white"><rect><color red="0.8" green="0.8" blue="0.8" /></rect></element>
8   <element name="static_green"><rect><color red="0.1" green="0.5" blue="0.2" /></rect></element>
9
10   <element name="text_down">
11      <rect><color red="0.1" green="0.5" blue="0.2" /></rect>
12      <text string="DOWN"><color red="0.8" green="0.8" blue="0.8" /></text>
13   </element>
14   <element name="text_home">
15      <rect><color red="0.1" green="0.5" blue="0.2" /></rect>
16      <text string="HOME"><color red="0.8" green="0.8" blue="0.8" /></text>
17   </element>
18   <element name="text_yards">
19      <rect><color red="0.1" green="0.5" blue="0.2" /></rect>
20      <text string="YARDS TO GO"><color red="0.8" green="0.8" blue="0.8" /></text>
21   </element>
22   <element name="text_time">
23      <rect><color red="0.1" green="0.5" blue="0.2" /></rect>
24      <text string="TIME REMAINING"><color red="0.8" green="0.8" blue="0.8" /></text>
25   </element>
26   <element name="text_field">
27      <rect><color red="0.1" green="0.5" blue="0.2" /></rect>
28      <text string="FIELD POSITION"><color red="0.8" green="0.8" blue="0.8" /></text>
29   </element>
30   <element name="text_visitor">
31      <rect><color red="0.1" green="0.5" blue="0.2" /></rect>
32      <text string="VISITOR"><color red="0.8" green="0.8" blue="0.8" /></text>
33   </element>
34
35   <element name="text_p1">
36      <rect><color red="0.06" green="0.3" blue="0.12" /></rect>
37      <text string="PL SEL:">
38         <bounds x="0.0" y="0.17" width="1.0" height="0.6" />
39         <color red="0.7" green="0.7" blue="0.8" />
40      </text>
41   </element>
42   <element name="text_p2" defstate="0">
43      <rect><color red="0.06" green="0.3" blue="0.12" /></rect>
44      <text state="0" string="RUN">
45         <bounds x="0.0" y="0.17" width="1.0" height="0.6" />
46         <color red="0.82" green="0.82" blue="0.82" />
47      </text>
48      <text state="1" string="PASS">
49         <bounds x="0.0" y="0.17" width="1.0" height="0.6" />
50         <color red="0.82" green="0.82" blue="0.82" />
51      </text>
52   </element>
53
54   <element name="digit" defstate="0">
55      <led7seg><color red="1.0" green="0.25" blue="0.26" /></led7seg>
56   </element>
57   <element name="seg" defstate="0">
58      <rect state="0"><color red="0.13" green="0.0325" blue="0.0338" /></rect>
59      <rect state="1"><color red="1.0" green="0.25" blue="0.26" /></rect>
60   </element>
61
62
63<!-- build screen -->
64
65   <view name="Internal Layout">
66      <bounds left="-9" right="393" top="-104" bottom="186" />
67      <bezel element="static_black">
68         <bounds left="-9" right="393" top="-104" bottom="186" />
69      </bezel>
70
71   <!-- bezel -->
72
73      <bezel element="static_green"><bounds left="-9" right="393" top="-110" bottom="-60" /></bezel>
74      <bezel element="static_green"><bounds left="-9" right="393" top="111" bottom="200" /></bezel>
75
76      <bezel element="static_white"><bounds x="-10" y="-84" width="404" height="3" /></bezel>
77      <bezel element="text_down"><bounds x="5" y="-92" width="66" height="19" /></bezel>
78      <bezel element="text_field"><bounds x="122" y="-92" width="140" height="19" /></bezel>
79      <bezel element="text_yards"><bounds x="286" y="-92" width="111" height="19" /></bezel>
80
81      <bezel element="static_white"><bounds x="-10" y="141" width="404" height="3" /></bezel>
82      <bezel element="text_home"><bounds x="5" y="133" width="66" height="19" /></bezel>
83      <bezel element="text_time"><bounds x="122" y="133" width="140" height="19" /></bezel>
84      <bezel element="text_visitor"><bounds x="306" y="133" width="80" height="19" /></bezel>
85
86      <bezel element="text_p1"><bounds x="316" y="161" width="40" height="16" /></bezel>
87      <bezel element="text_p2" inputtag="IN.0" inputmask="0x04">
88         <bounds x="354" y="161" width="35" height="16" />
89      </bezel>
90
91      <bezel element="static_white"><bounds left="-9" right="393" top="-61" bottom="-51" /></bezel>
92      <bezel element="static_white"><bounds left="-9" right="393" top="110" bottom="120" /></bezel>
93
94      <bezel element="static_white"><bounds x="-9" y="-52" width="4" height="163" /></bezel>
95      <bezel element="static_white"><bounds x="37" y="-52" width="2" height="163" /></bezel>
96      <bezel element="static_white"><bounds x="81" y="-52" width="2" height="163" /></bezel>
97      <bezel element="static_white"><bounds x="125" y="-52" width="2" height="163" /></bezel>
98      <bezel element="static_white"><bounds x="169" y="-52" width="2" height="163" /></bezel>
99      <bezel element="static_white"><bounds x="213" y="-52" width="2" height="163" /></bezel>
100      <bezel element="static_white"><bounds x="257" y="-52" width="2" height="163" /></bezel>
101      <bezel element="static_white"><bounds x="301" y="-52" width="2" height="163" /></bezel>
102      <bezel element="static_white"><bounds x="345" y="-52" width="2" height="163" /></bezel>
103      <bezel element="static_white"><bounds x="389" y="-52" width="4" height="163" /></bezel>
104
105      <bezel element="static_white"><bounds x="-8" y="2" width="4" height="1" /></bezel>
106      <bezel element="static_white"><bounds x="-8" y="29" width="4" height="1" /></bezel>
107      <bezel element="static_white"><bounds x="-8" y="56" width="4" height="1" /></bezel>
108
109      <bezel element="static_white"><bounds x="36" y="2" width="4" height="1" /></bezel>
110      <bezel element="static_white"><bounds x="36" y="29" width="4" height="1" /></bezel>
111      <bezel element="static_white"><bounds x="36" y="56" width="4" height="1" /></bezel>
112
113      <bezel element="static_white"><bounds x="80" y="2" width="4" height="1" /></bezel>
114      <bezel element="static_white"><bounds x="80" y="29" width="4" height="1" /></bezel>
115      <bezel element="static_white"><bounds x="80" y="56" width="4" height="1" /></bezel>
116
117      <bezel element="static_white"><bounds x="124" y="2" width="4" height="1" /></bezel>
118      <bezel element="static_white"><bounds x="124" y="29" width="4" height="1" /></bezel>
119      <bezel element="static_white"><bounds x="124" y="56" width="4" height="1" /></bezel>
120
121      <bezel element="static_white"><bounds x="168" y="2" width="4" height="1" /></bezel>
122      <bezel element="static_white"><bounds x="168" y="29" width="4" height="1" /></bezel>
123      <bezel element="static_white"><bounds x="168" y="56" width="4" height="1" /></bezel>
124
125      <bezel element="static_white"><bounds x="212" y="2" width="4" height="1" /></bezel>
126      <bezel element="static_white"><bounds x="212" y="29" width="4" height="1" /></bezel>
127      <bezel element="static_white"><bounds x="212" y="56" width="4" height="1" /></bezel>
128
129      <bezel element="static_white"><bounds x="256" y="2" width="4" height="1" /></bezel>
130      <bezel element="static_white"><bounds x="256" y="29" width="4" height="1" /></bezel>
131      <bezel element="static_white"><bounds x="256" y="56" width="4" height="1" /></bezel>
132
133      <bezel element="static_white"><bounds x="300" y="2" width="4" height="1" /></bezel>
134      <bezel element="static_white"><bounds x="300" y="29" width="4" height="1" /></bezel>
135      <bezel element="static_white"><bounds x="300" y="56" width="4" height="1" /></bezel>
136
137      <bezel element="static_white"><bounds x="344" y="2" width="4" height="1" /></bezel>
138      <bezel element="static_white"><bounds x="344" y="29" width="4" height="1" /></bezel>
139      <bezel element="static_white"><bounds x="344" y="56" width="4" height="1" /></bezel>
140
141      <bezel element="static_white"><bounds x="388" y="2" width="4" height="1" /></bezel>
142      <bezel element="static_white"><bounds x="388" y="29" width="4" height="1" /></bezel>
143      <bezel element="static_white"><bounds x="388" y="56" width="4" height="1" /></bezel>
144
145   <!-- leds -->
146
147      <bezel name="digit8" element="digit"><bounds x="3" y="-15.5" width="24" height="32" /></bezel>
148      <bezel name="8.8" element="seg"><bounds x="7" y="42.5" width="15" height="3" /></bezel>
149      <bezel name="8.9" element="seg"><bounds x="7" y="71.5" width="15" height="3" /></bezel>
150
151      <bezel name="digit7" element="digit"><bounds x="47" y="-15.5" width="24" height="32" /></bezel>
152      <bezel name="7.8" element="seg"><bounds x="51" y="42.5" width="15" height="3" /></bezel>
153      <bezel name="7.9" element="seg"><bounds x="51" y="71.5" width="15" height="3" /></bezel>
154
155      <bezel name="digit6" element="digit"><bounds x="91" y="-15.5" width="24" height="32" /></bezel>
156      <bezel name="6.8" element="seg"><bounds x="95" y="42.5" width="15" height="3" /></bezel>
157      <bezel name="6.9" element="seg"><bounds x="95" y="71.5" width="15" height="3" /></bezel>
158
159      <bezel name="digit5" element="digit"><bounds x="135" y="-15.5" width="24" height="32" /></bezel>
160      <bezel name="5.8" element="seg"><bounds x="139" y="42.5" width="15" height="3" /></bezel>
161      <bezel name="5.9" element="seg"><bounds x="139" y="71.5" width="15" height="3" /></bezel>
162
163      <bezel name="digit4" element="digit"><bounds x="179" y="-15.5" width="24" height="32" /></bezel>
164      <bezel name="4.8" element="seg"><bounds x="183" y="42.5" width="15" height="3" /></bezel>
165      <bezel name="4.9" element="seg"><bounds x="183" y="71.5" width="15" height="3" /></bezel>
166
167      <bezel name="digit3" element="digit"><bounds x="223" y="-15.5" width="24" height="32" /></bezel>
168      <bezel name="3.8" element="seg"><bounds x="227" y="42.5" width="15" height="3" /></bezel>
169      <bezel name="3.9" element="seg"><bounds x="227" y="71.5" width="15" height="3" /></bezel>
170
171      <bezel name="digit2" element="digit"><bounds x="267" y="-15.5" width="24" height="32" /></bezel>
172      <bezel name="2.8" element="seg"><bounds x="271" y="42.5" width="15" height="3" /></bezel>
173      <bezel name="2.9" element="seg"><bounds x="271" y="71.5" width="15" height="3" /></bezel>
174
175      <bezel name="digit1" element="digit"><bounds x="311" y="-15.5" width="24" height="32" /></bezel>
176      <bezel name="1.8" element="seg"><bounds x="315" y="42.5" width="15" height="3" /></bezel>
177      <bezel name="1.9" element="seg"><bounds x="315" y="71.5" width="15" height="3" /></bezel>
178
179      <bezel name="digit0" element="digit"><bounds x="355" y="-15.5" width="24" height="32" /></bezel>
180      <bezel name="0.8" element="seg"><bounds x="359" y="42.5" width="15" height="3" /></bezel>
181      <bezel name="0.9" element="seg"><bounds x="359" y="71.5" width="15" height="3" /></bezel>
182
183
184   </view>
185</mamelayout>
trunk/src/mame/layout/cnsector.lay
r253556r253557
1212      <led7seg><color red="1.0" green="0.25" blue="0.20" /></led7seg>
1313   </element>
1414
15   <element name="led" defstate="0">
15   <element name="lamp" defstate="0">
1616      <disk state="1"><color red="1.0" green="0.25" blue="0.20" /></disk>
1717      <disk state="0"><color red="0.2" green="0.0" blue="0.0" /></disk>
1818   </element>
r253556r253557
5656   </element>
5757
5858
59
5960<!-- build screen -->
6061
6162   <view name="Internal Layout">
r253556r253557
8687      <bezel element="text_depth"><bounds x="21" y="37" width="20" height="7" /></bezel>
8788      <bezel element="text_range"><bounds x="57" y="37" width="20" height="7" /></bezel>
8889
90
8991      <bezel name="digit5" element="digit">
9092         <bounds x="5" y="17" width="10" height="15" />
9193      </bezel>
r253556r253557
107109         <bounds x="77" y="17" width="10" height="15" />
108110      </bezel>
109111
112
110113   <!-- compass -->
111114
112115      <bezel element="static_gray"><bounds x="0" y="50" width="100" height="100" /></bezel>
113116      <bezel element="static_red"><bounds x="0" y="55" width="100" height="86" /></bezel>
114117
115      <bezel name="6.a" element="led"><bounds x="42" y="62" width="8" height="8" /></bezel>
116      <bezel name="7.a" element="led"><bounds x="42" y="126" width="8" height="8" /></bezel>
117      <bezel name="8.a" element="led"><bounds x="74" y="94" width="8" height="8" /></bezel>
118      <bezel name="9.a" element="led"><bounds x="10" y="94" width="8" height="8" /></bezel>
118      <bezel name="lamp60" element="lamp">
119         <bounds x="42" y="62" width="8" height="8" />
120      </bezel>
121      <bezel name="lamp61" element="lamp">
122         <bounds x="42" y="126" width="8" height="8" />
123      </bezel>
124      <bezel name="lamp62" element="lamp">
125         <bounds x="74" y="94" width="8" height="8" />
126      </bezel>
127      <bezel name="lamp63" element="lamp">
128         <bounds x="10" y="94" width="8" height="8" />
129      </bezel>
119130
120131      <bezel element="text_n"><bounds x="41" y="72" width="10" height="10" /></bezel>
121132      <bezel element="text_s"><bounds x="41" y="114" width="10" height="10" /></bezel>
122133      <bezel element="text_e"><bounds x="63" y="93" width="10" height="10" /></bezel>
123134      <bezel element="text_w"><bounds x="21" y="93" width="10" height="10" /></bezel>
124135
136
125137   <!-- crop borders -->
126138
127139      <bezel element="static_black"><bounds x="92" y="0" width="10" height="160" /></bezel>
128140      <bezel element="static_black"><bounds x="0" y="146" width="100" height="10" /></bezel>
129141
130
131142   </view>
132143</mamelayout>
trunk/src/mame/layout/lostreas.lay
r253556r253557
1<?xml version="1.0"?>
2<mamelayout version="2">
3
4<!-- define elements -->
5
6   <element name="static_blue"><rect><color red="0.1" green="0.25" blue="0.5" /></rect></element>
7   <element name="static_blue2"><rect><color red="0.04" green="0.1" blue="0.2" /></rect></element>
8   <element name="disk_cyan"><disk><color red="0.0" green="0.75" blue="1.0" /></disk></element>
9   <element name="disk_white"><disk><color red="0.8" green="0.9" blue="1.0" /></disk></element>
10
11   <element name="led" defstate="0">
12      <disk state="0"><color red="0.2" green="0.04" blue="0.046" /></disk>
13      <disk state="1"><color red="1.0" green="0.2" blue="0.23" /></disk>
14   </element>
15
16   <element name="text_1">
17      <rect><color red="0.1" green="0.25" blue="0.5" /></rect>
18      <text string="1"><color red="0.04" green="0.1" blue="0.2" /></text>
19   </element>
20   <element name="text_2">
21      <rect><color red="0.1" green="0.25" blue="0.5" /></rect>
22      <text string="2"><color red="0.04" green="0.1" blue="0.2" /></text>
23   </element>
24   <element name="text_3">
25      <rect><color red="0.1" green="0.25" blue="0.5" /></rect>
26      <text string="3"><color red="0.04" green="0.1" blue="0.2" /></text>
27   </element>
28   <element name="text_4">
29      <rect><color red="0.1" green="0.25" blue="0.5" /></rect>
30      <text string="4"><color red="0.04" green="0.1" blue="0.2" /></text>
31   </element>
32   <element name="text_5">
33      <rect><color red="0.1" green="0.25" blue="0.5" /></rect>
34      <text string="5"><color red="0.04" green="0.1" blue="0.2" /></text>
35   </element>
36   <element name="text_6">
37      <rect><color red="0.1" green="0.25" blue="0.5" /></rect>
38      <text string="6"><color red="0.04" green="0.1" blue="0.2" /></text>
39   </element>
40   <element name="text_7">
41      <rect><color red="0.1" green="0.25" blue="0.5" /></rect>
42      <text string="7"><color red="0.04" green="0.1" blue="0.2" /></text>
43   </element>
44   <element name="text_8">
45      <rect><color red="0.1" green="0.25" blue="0.5" /></rect>
46      <text string="8"><color red="0.04" green="0.1" blue="0.2" /></text>
47   </element>
48   <element name="text_9">
49      <rect><color red="0.1" green="0.25" blue="0.5" /></rect>
50      <text string="9"><color red="0.04" green="0.1" blue="0.2" /></text>
51   </element>
52   <element name="text_10">
53      <rect><color red="0.1" green="0.25" blue="0.5" /></rect>
54      <text string="10"><color red="0.04" green="0.1" blue="0.2" /></text>
55   </element>
56   <element name="text_11">
57      <rect><color red="0.1" green="0.25" blue="0.5" /></rect>
58      <text string="11"><color red="0.04" green="0.1" blue="0.2" /></text>
59   </element>
60   <element name="text_12">
61      <rect><color red="0.1" green="0.25" blue="0.5" /></rect>
62      <text string="12"><color red="0.04" green="0.1" blue="0.2" /></text>
63   </element>
64
65   <element name="text_100">
66      <rect><color red="0.1" green="0.25" blue="0.5" /></rect>
67      <text string="100"><color red="0.04" green="0.1" blue="0.2" /></text>
68   </element>
69   <element name="text_150">
70      <rect><color red="0.1" green="0.25" blue="0.5" /></rect>
71      <text string="150"><color red="0.04" green="0.1" blue="0.2" /></text>
72   </element>
73   <element name="text_200">
74      <rect><color red="0.1" green="0.25" blue="0.5" /></rect>
75      <text string="200"><color red="0.04" green="0.1" blue="0.2" /></text>
76   </element>
77   <element name="text_250">
78      <rect><color red="0.1" green="0.25" blue="0.5" /></rect>
79      <text string="250"><color red="0.04" green="0.1" blue="0.2" /></text>
80   </element>
81   <element name="text_300">
82      <rect><color red="0.1" green="0.25" blue="0.5" /></rect>
83      <text string="300"><color red="0.04" green="0.1" blue="0.2" /></text>
84   </element>
85   <element name="text_350">
86      <rect><color red="0.1" green="0.25" blue="0.5" /></rect>
87      <text string="350"><color red="0.04" green="0.1" blue="0.2" /></text>
88   </element>
89
90   <element name="text_air">
91      <rect><color red="0.1" green="0.25" blue="0.5" /></rect>
92      <text string="AIR"><color red="0.04" green="0.1" blue="0.2" /></text>
93   </element>
94   <element name="text_ss">
95      <rect><color red="0.1" green="0.25" blue="0.5" /></rect>
96      <text string="$$"><color red="0.04" green="0.1" blue="0.2" /></text>
97   </element>
98
99   <element name="text_n">
100      <rect><color red="0.0" green="0.75" blue="1.0" /></rect>
101      <text string="N"><color red="1" green="1" blue="1" /></text>
102   </element>
103   <element name="text_s">
104      <rect><color red="0.0" green="0.75" blue="1.0" /></rect>
105      <text string="S"><color red="1" green="1" blue="1" /></text>
106   </element>
107   <element name="text_w">
108      <rect><color red="0.0" green="0.75" blue="1.0" /></rect>
109      <text string="W"><color red="1" green="1" blue="1" /></text>
110   </element>
111   <element name="text_e">
112      <rect><color red="0.0" green="0.75" blue="1.0" /></rect>
113      <text string="E"><color red="1" green="1" blue="1" /></text>
114   </element>
115
116
117<!-- build screen -->
118
119   <view name="Internal Layout">
120      <bounds left="2.2" right="18.5" top="1" bottom="17.3" />
121      <bezel element="static_blue">
122         <bounds left="0" right="20" top="0" bottom="20" />
123      </bezel>
124
125   <!-- left side -->
126
127      <bezel element="text_12"><bounds x="2.5" y="4" width="2" height="0.5" /></bezel>
128      <bezel element="text_11"><bounds x="2.5" y="4.7" width="2" height="0.5" /></bezel>
129      <bezel element="text_10"><bounds x="2.5" y="6" width="2" height="0.5" /></bezel>
130      <bezel element="text_9"><bounds x="2.5" y="6.7" width="2" height="0.5" /></bezel>
131      <bezel element="text_8"><bounds x="2.5" y="8" width="2" height="0.5" /></bezel>
132      <bezel element="text_7"><bounds x="2.5" y="8.7" width="2" height="0.5" /></bezel>
133      <bezel element="text_6"><bounds x="2.5" y="10" width="2" height="0.5" /></bezel>
134      <bezel element="text_5"><bounds x="2.5" y="10.7" width="2" height="0.5" /></bezel>
135      <bezel element="text_4"><bounds x="2.5" y="12" width="2" height="0.5" /></bezel>
136      <bezel element="text_3"><bounds x="2.5" y="12.7" width="2" height="0.5" /></bezel>
137      <bezel element="text_2"><bounds x="2.5" y="14" width="2" height="0.5" /></bezel>
138      <bezel element="text_1"><bounds x="2.5" y="14.7" width="2" height="0.5" /></bezel>
139      <bezel element="text_air"><bounds x="1.5" y="15.7" width="4" height="0.5" /></bezel>
140
141      <bezel element="text_350"><bounds x="4.4" y="4.35" width="3" height="0.5" /></bezel>
142      <bezel element="text_300"><bounds x="4.4" y="6.35" width="3" height="0.5" /></bezel>
143      <bezel element="text_250"><bounds x="4.4" y="8.35" width="3" height="0.5" /></bezel>
144      <bezel element="text_200"><bounds x="4.4" y="10.35" width="3" height="0.5" /></bezel>
145      <bezel element="text_150"><bounds x="4.4" y="12.35" width="3" height="0.5" /></bezel>
146      <bezel element="text_100"><bounds x="4.4" y="14.35" width="3" height="0.5" /></bezel>
147      <bezel element="text_ss"><bounds x="4.4" y="15.7" width="3" height="0.5" /></bezel>
148
149      <bezel element="static_blue2"><bounds x="3.1" y="4.57" width="0.77" height="0.06" /></bezel>
150      <bezel element="static_blue2"><bounds x="3.1" y="6.57" width="0.77" height="0.06" /></bezel>
151      <bezel element="static_blue2"><bounds x="3.1" y="8.57" width="0.77" height="0.06" /></bezel>
152      <bezel element="static_blue2"><bounds x="3.1" y="10.57" width="0.77" height="0.06" /></bezel>
153      <bezel element="static_blue2"><bounds x="3.1" y="12.57" width="0.77" height="0.06" /></bezel>
154      <bezel element="static_blue2"><bounds x="3.1" y="14.57" width="0.77" height="0.06" /></bezel>
155      <bezel element="static_blue2"><bounds x="7" y="0" width="0.3" height="20" /></bezel>
156
157      <bezel name="0.5" element="led"><bounds x="4" y="4" width="1.2" height="1.2" /></bezel>
158      <bezel name="0.4" element="led"><bounds x="4" y="6" width="1.2" height="1.2" /></bezel>
159      <bezel name="0.3" element="led"><bounds x="4" y="8" width="1.2" height="1.2" /></bezel>
160      <bezel name="0.2" element="led"><bounds x="4" y="10" width="1.2" height="1.2" /></bezel>
161      <bezel name="0.1" element="led"><bounds x="4" y="12" width="1.2" height="1.2" /></bezel>
162      <bezel name="0.0" element="led"><bounds x="4" y="14" width="1.2" height="1.2" /></bezel>
163
164   <!-- compass -->
165
166      <bezel element="disk_white"><bounds x="8.1" y="2.1" width="9" height="9" /></bezel>
167      <bezel element="disk_cyan"><bounds x="8.5" y="2.5" width="8.2" height="8.2" /></bezel>
168
169      <bezel element="text_n"><bounds x="12" y="2.7" width="1.2" height="1.2" /></bezel>
170      <bezel element="text_s"><bounds x="12" y="9.3" width="1.2" height="1.2" /></bezel>
171      <bezel element="text_w"><bounds x="8.8" y="6" width="1.2" height="1.2" /></bezel>
172      <bezel element="text_e"><bounds x="15.2" y="6" width="1.2" height="1.2" /></bezel>
173
174      <bezel name="0.6" element="led"><bounds x="12" y="4" width="1.2" height="1.2" /></bezel>
175      <bezel name="0.7" element="led"><bounds x="12" y="8" width="1.2" height="1.2" /></bezel>
176      <bezel name="0.8" element="led"><bounds x="10" y="6" width="1.2" height="1.2" /></bezel>
177      <bezel name="0.9" element="led"><bounds x="14" y="6" width="1.2" height="1.2" /></bezel>
178      <bezel name="0.10" element="led"><bounds x="12" y="6" width="1.2" height="1.2" /></bezel>
179
180   </view>
181</mamelayout>
trunk/src/mame/layout/mathmagi.lay
r253556r253557
2727   </element>
2828
2929
30
3031<!-- build screen -->
3132
3233   <view name="Internal Layout">
r253556r253557
6162
6263   <!-- math symbols custom digit -->
6364
64      <bezel name="8.6" element="lamp_dash"><bounds x="21.5" y="17.25" width="7" height="0.5" /></bezel>
65      <bezel name="lamp87" element="lamp_dash"><bounds x="21.5" y="17.25" width="7" height="0.5" /></bezel>
6566
66      <bezel name="8.1" element="lamp_slash"><bounds x="24" y="9.5" width="5" height="7.5" /></bezel>
67      <bezel name="8.1" element="lamp_slash"><bounds x="21" y="17" width="5" height="7.5" /></bezel>
67      <bezel name="lamp82" element="lamp_slash"><bounds x="24" y="9.5" width="5" height="7.5" /></bezel>
68      <bezel name="lamp82" element="lamp_slash"><bounds x="21" y="17" width="5" height="7.5" /></bezel>
6869
69      <bezel name="8.2" element="lamp_backslash"><bounds x="21" y="9.5" width="5" height="7.5" /></bezel>
70      <bezel name="8.2" element="lamp_backslash"><bounds x="24" y="17" width="5" height="7.5" /></bezel>
70      <bezel name="lamp83" element="lamp_backslash"><bounds x="21" y="9.5" width="5" height="7.5" /></bezel>
71      <bezel name="lamp83" element="lamp_backslash"><bounds x="24" y="17" width="5" height="7.5" /></bezel>
7172
72      <bezel name="8.0" element="lamp_dot"><bounds x="24.25" y="12.25" width="1.5" height="1.5" /></bezel>
73      <bezel name="8.0" element="lamp_dot"><bounds x="24.25" y="21.75" width="1.5" height="1.5" /></bezel>
73      <bezel name="lamp81" element="lamp_dot"><bounds x="24.25" y="12.25" width="1.5" height="1.5" /></bezel>
74      <bezel name="lamp81" element="lamp_dot"><bounds x="24.25" y="21.75" width="1.5" height="1.5" /></bezel>
7475
7576   <!-- equals sign custom digit -->
7677
77      <bezel name="9.0" element="lamp_dash"><bounds x="51.5" y="14.5" width="7" height="0.5" /></bezel>
78      <bezel name="9.3" element="lamp_dash"><bounds x="51.5" y="20.0" width="7" height="0.5" /></bezel>
78      <bezel name="lamp91" element="lamp_dash"><bounds x="51.5" y="14.5" width="7" height="0.5" /></bezel>
79      <bezel name="lamp94" element="lamp_dash"><bounds x="51.5" y="20.0" width="7" height="0.5" /></bezel>
7980
8081   <!-- other lamps -->
8182
82      <bezel name="10.0" element="lamp_dot"><bounds x="1" y="1" width="4" height="4" /></bezel>
83      <bezel name="10.1" element="lamp_dot"><bounds x="26" y="1" width="4" height="4" /></bezel>
84      <bezel name="10.3" element="lamp_dot"><bounds x="51" y="1" width="4" height="4" /></bezel>
85      <bezel name="10.6" element="lamp_dot"><bounds x="76" y="1" width="4" height="4" /></bezel>
83      <bezel name="lamp101" element="lamp_dot"><bounds x="1" y="1" width="4" height="4" /></bezel>
84      <bezel name="lamp102" element="lamp_dot"><bounds x="26" y="1" width="4" height="4" /></bezel>
85      <bezel name="lamp104" element="lamp_dot"><bounds x="51" y="1" width="4" height="4" /></bezel>
86      <bezel name="lamp107" element="lamp_dot"><bounds x="76" y="1" width="4" height="4" /></bezel>
8687
8788
8889   </view>
trunk/src/mame/layout/zodiac.lay
r253556r253557
1<?xml version="1.0"?>
2<mamelayout version="2">
3
4<!-- define elements -->
5
6   <element name="static_black"><rect><color red="0" green="0" blue="0" /></rect></element>
7   <element name="disk_black"><disk><color red="0" green="0" blue="0" /></disk></element>
8   <element name="disk_red"><disk><color red="0.25" green="0.05" blue="0.02" /></disk></element>
9
10   <element name="led" defstate="0">
11      <disk state="0"><color red="0.2" green="0.04" blue="0.046" /></disk>
12      <disk state="1"><color red="1.0" green="0.2" blue="0.23" /></disk>
13   </element>
14
15   <element name="digit" defstate="0">
16      <led7seg><color red="1.0" green="0.15" blue="0.08" /></led7seg>
17   </element>
18
19   <element name="text_1"><text string="1"><color red="0.7" green="0.7" blue="0.7" /></text></element>
20   <element name="text_2"><text string="2"><color red="0.7" green="0.7" blue="0.7" /></text></element>
21   <element name="text_3"><text string="3"><color red="0.7" green="0.7" blue="0.7" /></text></element>
22   <element name="text_4"><text string="4"><color red="0.7" green="0.7" blue="0.7" /></text></element>
23   <element name="text_5"><text string="5"><color red="0.7" green="0.7" blue="0.7" /></text></element>
24   <element name="text_6"><text string="6"><color red="0.7" green="0.7" blue="0.7" /></text></element>
25   <element name="text_7"><text string="7"><color red="0.7" green="0.7" blue="0.7" /></text></element>
26   <element name="text_8"><text string="8"><color red="0.7" green="0.7" blue="0.7" /></text></element>
27   <element name="text_9"><text string="9"><color red="0.7" green="0.7" blue="0.7" /></text></element>
28   <element name="text_10"><text string="10"><color red="0.7" green="0.7" blue="0.7" /></text></element>
29   <element name="text_11"><text string="11"><color red="0.7" green="0.7" blue="0.7" /></text></element>
30   <element name="text_12"><text string="12"><color red="0.7" green="0.7" blue="0.7" /></text></element>
31
32
33<!-- build screen -->
34
35   <view name="Internal Layout">
36      <bounds left="-35" right="158" top="5" bottom="198" />
37      <bezel element="static_black">
38         <bounds left="-35" right="158" top="5" bottom="198" />
39      </bezel>
40
41      <bezel element="disk_red"><bounds x="-40" y="0" width="203" height="203" /></bezel>
42      <bezel element="disk_black"><bounds x="-15" y="25" width="153" height="153" /></bezel>
43
44      <bezel name="digit7" element="digit"><bounds x="20" y="70" width="10" height="15" /></bezel>
45      <bezel name="digit6" element="digit"><bounds x="30" y="70" width="10" height="15" /></bezel>
46      <bezel name="digit5" element="digit"><bounds x="40" y="70" width="10" height="15" /></bezel>
47      <bezel name="digit4" element="digit"><bounds x="50" y="70" width="10" height="15" /></bezel>
48      <bezel name="digit3" element="digit"><bounds x="60" y="70" width="10" height="15" /></bezel>
49      <bezel name="digit2" element="digit"><bounds x="70" y="70" width="10" height="15" /></bezel>
50      <bezel name="digit1" element="digit"><bounds x="80" y="70" width="10" height="15" /></bezel>
51      <bezel name="digit0" element="digit"><bounds x="90" y="70" width="10" height="15" /></bezel>
52
53      <bezel name="9.7" element="led"><bounds x="15" y="145" width="3" height="3" /></bezel>
54      <bezel name="9.2" element="led"><bounds x="40" y="160" width="3" height="3" /></bezel>
55      <bezel name="9.4" element="led"><bounds x="80" y="160" width="3" height="3" /></bezel>
56      <bezel name="9.5" element="led"><bounds x="105" y="145" width="3" height="3" /></bezel>
57      <bezel name="9.1" element="led"><bounds x="120" y="120" width="3" height="3" /></bezel>
58      <bezel name="9.3" element="led"><bounds x="120" y="80" width="3" height="3" /></bezel>
59
60      <bezel name="8.7" element="led"><bounds x="105" y="55" width="3" height="3" /></bezel>
61      <bezel name="8.2" element="led"><bounds x="80" y="40" width="3" height="3" /></bezel>
62      <bezel name="8.4" element="led"><bounds x="40" y="40" width="3" height="3" /></bezel>
63      <bezel name="8.5" element="led"><bounds x="15" y="55" width="3" height="3" /></bezel>
64      <bezel name="8.1" element="led"><bounds x="0" y="80" width="3" height="3" /></bezel>
65      <bezel name="8.3" element="led"><bounds x="0" y="120" width="3" height="3" /></bezel>
66
67      <bezel element="text_1"><bounds x="17" y="143" width="12" height="7" /></bezel>
68      <bezel element="text_2"><bounds x="42" y="158" width="12" height="7" /></bezel>
69      <bezel element="text_3"><bounds x="82" y="158" width="12" height="7" /></bezel>
70      <bezel element="text_4"><bounds x="107" y="143" width="12" height="7" /></bezel>
71      <bezel element="text_5"><bounds x="122" y="118" width="12" height="7" /></bezel>
72      <bezel element="text_6"><bounds x="122" y="78" width="12" height="7" /></bezel>
73
74      <bezel element="text_7"><bounds x="107" y="53" width="12" height="7" /></bezel>
75      <bezel element="text_8"><bounds x="82" y="38" width="12" height="7" /></bezel>
76      <bezel element="text_9"><bounds x="42" y="38" width="12" height="7" /></bezel>
77      <bezel element="text_10"><bounds x="17" y="53" width="12" height="7" /></bezel>
78      <bezel element="text_11"><bounds x="2" y="78" width="12" height="7" /></bezel>
79      <bezel element="text_12"><bounds x="2" y="118" width="12" height="7" /></bezel>
80
81
82   </view>
83</mamelayout>
trunk/src/mame/machine/xbox.cpp
r253556r253557
841841
842842ohci_function_device::ohci_function_device(running_machine &machine)
843843{
844   state = DefaultState;
845844   descriptors = auto_alloc_array(machine, UINT8, 1024);
846845   descriptors_pos = 0;
847846   address = 0;
r253556r253557
849848   controldirection = 0;
850849   controltype = 0;
851850   controlrecipient = 0;
852   configurationvalue = 0;
853851   remain = 0;
854852   position = nullptr;
855853   settingaddress = false;
r253556r253557
863861void ohci_function_device::add_device_descriptor(USBStandardDeviceDescriptor &descriptor)
864862{
865863   memcpy(descriptors + descriptors_pos, &descriptor, sizeof(descriptor));
866   descriptors_pos += descriptor.bLength;
864   descriptors_pos += sizeof(descriptor);
867865}
868866
869867void ohci_function_device::add_configuration_descriptor(USBStandardConfigurationDescriptor &descriptor)
870868{
871869   memcpy(descriptors + descriptors_pos, &descriptor, sizeof(descriptor));
872   descriptors_pos += descriptor.bLength;
870   descriptors_pos += sizeof(descriptor);
873871}
874872
875873void ohci_function_device::add_interface_descriptor(USBStandardInterfaceDescriptor &descriptor)
876874{
877875   memcpy(descriptors + descriptors_pos, &descriptor, sizeof(descriptor));
878   descriptors_pos += descriptor.bLength;
876   descriptors_pos += sizeof(descriptor);
879877}
880878
881879void ohci_function_device::add_endpoint_descriptor(USBStandardEndpointDescriptor &descriptor)
882880{
883881   memcpy(descriptors + descriptors_pos, &descriptor, sizeof(descriptor));
884   descriptors_pos += descriptor.bLength;
882   descriptors_pos += sizeof(descriptor);
885883}
886884
887885void ohci_function_device::execute_reset()
r253556r253557
892890
893891int ohci_function_device::execute_transfer(int address, int endpoint, int pid, UINT8 *buffer, int size)
894892{
895   int descriptortype;// descriptorindex;
896
897893   if (endpoint == 0) {
898894      if (pid == SetupPid) {
899         USBSetupPacket *p=(struct USBSetupPacket *)buffer;
895         struct USBSetupPacket *p=(struct USBSetupPacket *)buffer;
900896         // define direction 0:host->device 1:device->host
901897         controldirection = (p->bmRequestType & 128) >> 7;
902898         // case ==1, IN data stage and OUT status stage
r253556r253557
905901         controltype = (p->bmRequestType & 0x60) >> 5;
906902         controlrecipient = p->bmRequestType & 0x1f;
907903         position = nullptr;
908         // number of byte to transfer in data stage (0 no data stage)
909904         remain = p->wLength;
910         // if standard device request
911         if ((controltype == StandardType) && (controlrecipient == DeviceRecipient)) {
905         // if standard
906         if (controltype == 0) {
912907            switch (p->bRequest) {
913908            case GET_STATUS:
914909            case CLEAR_FEATURE:
r253556r253557
919914               settingaddress = true;
920915               break;
921916            case GET_DESCRIPTOR:
922               descriptortype = p->wValue >> 8;
923               //descriptorindex = p->wValue & 255;
924               if (descriptortype == DEVICE) { // device descriptor
917               if ((p->wValue >> 8) == DEVICE) { // device descriptor
918                  //p->wValue & 255;
925919                  position = descriptors;
926920                  remain = descriptors[0];
927921               }
928               else if (descriptortype == CONFIGURATION) { // configuration descriptor
922               else if ((p->wValue >> 8) == CONFIGURATION) { // configuration descriptor
929923                  position = descriptors + 18;
930924                  remain = descriptors[18+2];
931925               }
932               else if (descriptortype == INTERFACE) { // interface descriptor
926               else if ((p->wValue >> 8) == INTERFACE) { // interface descriptor
933927                  position = descriptors + 18 + 9;
934928                  remain = descriptors[18 + 9];
935929               }
936               else if (descriptortype == ENDPOINT) { // endpoint descriptor
930               else if ((p->wValue >> 8) == ENDPOINT) { // endpoint descriptor
937931                  position = descriptors + 18 + 9 + 9;
938932                  remain = descriptors[18 + 9 + 9];
939933               }
940               else
941                  remain = 0;
942934               if (remain > p->wLength)
943935                  remain = p->wLength;
944936               break;
945            case SET_CONFIGURATION:
946               if (p->wValue == 0)
947                  state = AddressState;
948               else {
949                  configurationvalue = p->wValue;
950                  state = ConfiguredState;
951               }
952               break;
953937            case SET_DESCRIPTOR:
954938            case GET_CONFIGURATION:
939            case SET_CONFIGURATION:
955940            case GET_INTERFACE:
956941            case SET_INTERFACE:
957942            case SYNCH_FRAME:
r253556r253557
959944               break;
960945            }
961946         }
962         else
963            return handle_nonstandard_request(p);
964947         size = 0;
965948      }
966949      else if (pid == InPid) {
967950         // if no data has been transferred (except for the setup stage)
968951         // and the lenght of this IN transaction is 0
969952         // assume this is the status stage
970         if ((size == 0) && (remain == 0)) {
953         if (size == 0) {
971954            if (settingaddress == true)
972955            {
973956               // set of address is active at end of status stage
974957               address = newaddress;
975958               settingaddress = false;
976               state = AddressState;
977959            }
978960            return 0;
979961         }
r253556r253557
1005987         }
1006988      }
1007989   }
1008   else
1009      return -1;
1010990   return size;
1011991}
1012992
1013int ohci_function_device::handle_nonstandard_request(USBSetupPacket *setup)
1014{
1015   if ((controltype == VendorType) && (controlrecipient == InterfaceRecipient))
1016   {
1017      if (setup->bRequest == GET_DESCRIPTOR)
1018      {
1019         if (setup->wValue == 0x4200)
1020         {
1021            position = nullptr;
1022            remain = 0;
1023         }
1024      }
1025   }
1026   return 0;
1027}
1028
1029993void xbox_base_state::usb_ohci_interrupts()
1030994{
1031995   if (((ohcist.hc_regs[HcInterruptStatus] & ohcist.hc_regs[HcInterruptEnable]) != 0) && ((ohcist.hc_regs[HcInterruptEnable] & MasterInterruptEnable) != 0))
r253556r253557
14251389IRQ_CALLBACK_MEMBER(xbox_base_state::irq_callback)
14261390{
14271391   int r = 0;
1428   r = xbox_base_devs.pic8259_1->acknowledge();
1392   r = xbox_base_devs.pic8259_2->acknowledge();
1393   if (r == 0)
1394   {
1395      r = xbox_base_devs.pic8259_1->acknowledge();
1396   }
14291397   if (debug_irq_active)
14301398      debug_generate_irq(debug_irq_number, false);
14311399   return r;
trunk/src/mame/mess.lst
r253556r253557
22862286// hh_tms1k
22872287mathmagi    // APF
22882288amaztron    // Coleco
2289zodiac      // Coleco
22902289cqback      // Coleco
22912290h2hbaseb    // Coleco
22922291h2hfootb    // Coleco
22932292tc4         // Coleco
2294cnfball2    // Conic
22952293ebball      // Entex
22962294ebball2     // Entex
22972295ebball3     // Entex
r253556r253557
23172315bankshot    // Parker Bros
23182316splitsec    // Parker Bros
23192317mmerlin     // Parker Bros
2320lostreas    // Parker Bros
23212318tandy12     // Tandy Radio Shack
23222319tbreakup    // Tomy
23232320phpball     // Tomy
trunk/src/mame/video/blmbycar.cpp
r253556r253557
7878}
7979
8080
81WRITE16_MEMBER(blmbycar_state::vram_0_w)
81WRITE16_MEMBER(blmbycar_state::blmbycar_vram_0_w)
8282{
8383   COMBINE_DATA(&m_vram_0[offset]);
8484   m_tilemap_0->mark_tile_dirty(offset / 2);
8585}
8686
87WRITE16_MEMBER(blmbycar_state::vram_1_w)
87WRITE16_MEMBER(blmbycar_state::blmbycar_vram_1_w)
8888{
8989   COMBINE_DATA(&m_vram_1[offset]);
9090   m_tilemap_1->mark_tile_dirty(offset / 2);
r253556r253557
192192
193193***************************************************************************/
194194
195UINT32 blmbycar_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
195UINT32 blmbycar_state::screen_update_blmbycar(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
196196{
197197   int i, layers_ctrl = -1;
198198
trunk/src/mame/video/chihiro.cpp
r253556r253557
25932593   printf("A:%08X MTHD:%08X D:%08X\n\r",address,maddress,data);
25942594#endif
25952595   if (maddress == 0x17fc) {
2596#if 0 // useful while debugging to see what coordinates have been used
2596#if 1 // useful while debugging to see what coordinates have been used
25972597      static int debugvc = 0;
25982598      if (debugvc)
25992599         if (data == 0)
26002600         {
2601            printf("%d %d\n\r", (int)primitive_type, vertex_first);
2601            //printf("%d %d\n\r", primitive_type, vertex_first);
26022602            for (int n = 0; n < vertex_first; n++)
26032603               printf("%d X:%f Y:%f Z:%f W:%f x:%f y:%f\n\r", n, vertex_software[n].attribute[0].fv[0], vertex_software[n].attribute[0].fv[1], vertex_software[n].attribute[0].fv[2], vertex_software[n].attribute[0].fv[3], vertex_xy[n].x, vertex_xy[n].y);
26042604         }
trunk/src/mame/video/glass.cpp
r253556r253557
3333      1  | xxxxxxxx -------- | not used
3434*/
3535
36TILE_GET_INFO_MEMBER(glass_state::get_tile_info_screen0)
36TILE_GET_INFO_MEMBER(glass_state::get_tile_info_glass_screen0)
3737{
3838   int data = m_videoram[tile_index << 1];
3939   int data2 = m_videoram[(tile_index << 1) + 1];
r253556r253557
4343}
4444
4545
46TILE_GET_INFO_MEMBER(glass_state::get_tile_info_screen1)
46TILE_GET_INFO_MEMBER(glass_state::get_tile_info_glass_screen1)
4747{
4848   int data = m_videoram[(0x1000 / 2) + (tile_index << 1)];
4949   int data2 = m_videoram[(0x1000 / 2) + (tile_index << 1) + 1];
r253556r253557
6767    B2B1B0 selects the picture (there are 8 pictures in each half of the ROM)
6868*/
6969
70WRITE16_MEMBER(glass_state::blitter_w)
70WRITE16_MEMBER(glass_state::glass_blitter_w)
7171{
7272   m_blitter_serial_buffer[m_current_bit] = data & 0x01;
7373   m_current_bit++;
r253556r253557
112112
113113***************************************************************************/
114114
115WRITE16_MEMBER(glass_state::vram_w)
115WRITE16_MEMBER(glass_state::glass_vram_w)
116116{
117117   COMBINE_DATA(&m_videoram[offset]);
118118   m_pant[offset >> 11]->mark_tile_dirty(((offset << 1) & 0x0fff) >> 2);
r253556r253557
127127
128128void glass_state::video_start()
129129{
130   m_pant[0] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(glass_state::get_tile_info_screen0),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
131   m_pant[1] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(glass_state::get_tile_info_screen1),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
130   m_pant[0] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(glass_state::get_tile_info_glass_screen0),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
131   m_pant[1] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(glass_state::get_tile_info_glass_screen1),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
132132   m_screen_bitmap = std::make_unique<bitmap_ind16>(320, 200);
133133
134134   save_item(NAME(*m_screen_bitmap));
r253556r253557
191191
192192****************************************************************************/
193193
194UINT32 glass_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
194UINT32 glass_state::screen_update_glass(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
195195{
196196   /* set scroll registers */
197197   m_pant[0]->set_scrolly(0, m_vregs[0]);
trunk/src/osd/modules/render/drawbgfx.cpp
r253556r253557
162162   m_s_texColor = bgfx::createUniform("s_texColor", bgfx::UniformType::Int1);
163163
164164   uint32_t flags = BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP | BGFX_TEXTURE_MIN_POINT | BGFX_TEXTURE_MAG_POINT | BGFX_TEXTURE_MIP_POINT;
165   m_texture_cache = bgfx::createTexture2D(CACHE_SIZE, CACHE_SIZE, 1, bgfx::TextureFormat::RGBA8, flags);
165   m_texture_cache = bgfx::createTexture2D(CACHE_SIZE, CACHE_SIZE, 1, bgfx::TextureFormat::BGRA8, flags);
166166
167167   const bgfx::Memory* memory = bgfx::alloc(sizeof(uint32_t) * CACHE_SIZE * CACHE_SIZE);
168168   memset(memory->data, 0, sizeof(uint32_t) * CACHE_SIZE * CACHE_SIZE);
r253556r253557
423423   const bgfx::Memory* mem = mame_texture_data_to_bgfx_texture_data(prim->flags & PRIMFLAG_TEXFORMAT_MASK,
424424      prim->texture.width, prim->texture.height, prim->texture.rowpixels, prim->texture.palette, prim->texture.base);
425425
426   bgfx::TextureHandle texture = bgfx::createTexture2D((uint16_t)prim->texture.width, (uint16_t)prim->texture.height, 1, bgfx::TextureFormat::RGBA8, texture_flags, mem);
426   bgfx::TextureHandle texture = bgfx::createTexture2D((uint16_t)prim->texture.width, (uint16_t)prim->texture.height, 1, bgfx::TextureFormat::BGRA8, texture_flags, mem);
427427
428428   bgfx::setTexture(0, m_s_texColor, texture);
429429
r253556r253557
629629static inline void copyline_palette16(UINT32 *dst, const UINT16 *src, int width, const rgb_t *palette)
630630{
631631   for (int x = 0; x < width; x++)
632   {
633      rgb_t srcpixel = palette[*src++];
634      *dst++ = 0xff000000 | (srcpixel.b() << 16) | (srcpixel.g() << 8) | srcpixel.r();
635   }
632      *dst++ = 0xff000000 | palette[*src++];
636633}
637634
638635
r253556r253557
643640static inline void copyline_palettea16(UINT32 *dst, const UINT16 *src, int width, const rgb_t *palette)
644641{
645642   for (int x = 0; x < width; x++)
646   {
647      rgb_t srcpixel = palette[*src++];
648      *dst++ = (srcpixel.a() << 24) | (srcpixel.b() << 16) | (srcpixel.g() << 8) | srcpixel.r();
649   }
643      *dst++ = palette[*src++];
650644}
651645
652646
r253556r253557
664658      for (x = 0; x < width; x++)
665659      {
666660         rgb_t srcpix = *src++;
667         *dst++ = 0xff000000 | palette[0x200 + srcpix.b()] | palette[0x100 + srcpix.g()] | palette[srcpix.r()];
661         *dst++ = 0xff000000 | palette[0x200 + srcpix.r()] | palette[0x100 + srcpix.g()] | palette[srcpix.b()];
668662      }
669663   }
670664
r253556r253557
672666   else
673667   {
674668      for (x = 0; x < width; x++)
675      {
676         rgb_t srcpix = *src++;
677         *dst++ = 0xff000000 | (srcpix.b() << 16) | (srcpix.g() << 8) | srcpix.r();
678      }
669         *dst++ = 0xff000000 | *src++;
679670   }
680671}
681672
r253556r253557
693684      for (x = 0; x < width; x++)
694685      {
695686         rgb_t srcpix = *src++;
696         *dst++ = (srcpix & 0xff000000) | palette[0x200 + srcpix.b()] | palette[0x100 + srcpix.g()] | palette[srcpix.r()];
687         *dst++ = (srcpix & 0xff000000) | palette[0x200 + srcpix.r()] | palette[0x100 + srcpix.g()] | palette[srcpix.b()];
697688      }
698689   }
699690
r253556r253557
701692   else
702693   {
703694      for (x = 0; x < width; x++)
704      {
705         rgb_t srcpix = *src++;
706         *dst++ = (srcpix.a() << 24) | (srcpix.b() << 16) | (srcpix.g() << 8) | srcpix.r();
707      }
695         *dst++ = *src++;
708696   }
709697}
710698
r253556r253557
746734   if (b < 0) b = 0;
747735   else if (b > 255) b = 255;
748736
749   return 0xff000000 | (b << 16) | (g << 8) | r;
737   return rgb_t(0xff, r, g, b);
750738}
751739
752740//============================================================
trunk/src/osd/modules/render/drawbgfx.h
r253556r253557
100100   rectangle_packer m_packer;
101101
102102   uint32_t m_white[16*16];
103   enum : uint16_t { CACHE_SIZE = 1024 };
104   enum : uint32_t { PACKABLE_SIZE = 128 };
105   enum : UINT32 { WHITE_HASH = 0x87654321 };
103   static const uint16_t CACHE_SIZE = 1024;
104   static const uint32_t PACKABLE_SIZE = 128;
105   static const UINT32 WHITE_HASH = 0x87654321;
106106};
107107
108#endif
108#endif
No newline at end of file
trunk/src/osd/modules/render/drawdd.cpp
r0r253557
1// license:BSD-3-Clause
2// copyright-holders:Aaron Giles
3//============================================================
4//
5//  drawdd.c - Win32 DirectDraw implementation
6//
7//============================================================
8
9// standard windows headers
10#define WIN32_LEAN_AND_MEAN
11#include <windows.h>
12#include <mmsystem.h>
13#include <ddraw.h>
14#undef interface
15
16// MAME headers
17#include "emu.h"
18#include "render.h"
19#include "rendutil.h"
20#include "rendersw.inc"
21
22// MAMEOS headers
23#include "winmain.h"
24#include "window.h"
25
26
27
28//============================================================
29//  TYPE DEFINITIONS
30//============================================================
31
32typedef HRESULT (WINAPI *directdrawcreateex_ptr)(GUID FAR *lpGuid, LPVOID *lplpDD, REFIID iid, IUnknown FAR *pUnkOuter);
33typedef HRESULT (WINAPI *directdrawenumerateex_ptr)(LPDDENUMCALLBACKEXA lpCallback, LPVOID lpContext, DWORD dwFlags);
34
35
36/* dd_info is the information about DirectDraw for the current screen */
37class renderer_dd : public osd_renderer
38{
39public:
40   renderer_dd(osd_window *window)
41   : osd_renderer(window, FLAG_NONE),
42      width(0),
43      height(0),
44      refresh(0),
45      //adapter(0),
46      adapter_ptr(NULL),
47      clearouter(0),
48      blitwidth(0), blitheight(0),
49      //lastdest
50      ddraw(NULL),
51      primary(NULL),
52      back(NULL),
53      blit(NULL),
54      clipper(NULL),
55      gamma(NULL),
56      //DDSURFACEDESC2          primarydesc;
57      //DDSURFACEDESC2          blitdesc;
58      //DDSURFACEDESC2          origmode;
59      //ddcaps(0),
60      //helcaps(0),
61      membuffer(NULL),
62      membuffersize(0)
63   { }
64
65   virtual ~renderer_dd() { }
66
67   virtual int create() override;
68   virtual render_primitive_list *get_primitives() override;
69   virtual int draw(const int update) override;
70   virtual void save() override {};
71   virtual void record() override {};
72   virtual void toggle_fsfx() override {};
73   virtual void destroy() override;
74
75   int                     width, height;              // current width, height
76   int                     refresh;                    // current refresh rate
77
78private:
79
80   inline void update_outer_rects();
81
82   // surface management
83   int ddraw_create();
84   int ddraw_create_surfaces();
85   void ddraw_delete();
86   void ddraw_delete_surfaces();
87   int ddraw_verify_caps();
88   int ddraw_test_cooperative();
89   HRESULT create_surface(DDSURFACEDESC2 *desc, IDirectDrawSurface7 **surface, const char *type);
90   int create_clipper();
91
92   // drawing helpers
93   void compute_blit_surface_size();
94   void blit_to_primary(int srcwidth, int srcheight);
95
96   // video modes
97   int config_adapter_mode();
98   void get_adapter_for_monitor(osd_monitor_info *monitor);
99   void pick_best_mode();
100
101   // various
102   void calc_fullscreen_margins(DWORD desc_width, DWORD desc_height, RECT *margins);
103
104
105   GUID                    adapter;                    // current display adapter
106   GUID *                  adapter_ptr;                // pointer to current display adapter
107   int                     clearouter;                 // clear the outer areas?
108
109   INT32                   blitwidth, blitheight;      // current blit width/height values
110   RECT                    lastdest;                   // last destination rectangle
111
112   IDirectDraw7 *          ddraw;                      // pointer to the DirectDraw object
113   IDirectDrawSurface7 *   primary;                    // pointer to the primary surface object
114   IDirectDrawSurface7 *   back;                       // pointer to the back buffer surface object
115   IDirectDrawSurface7 *   blit;                       // pointer to the blit surface object
116   IDirectDrawClipper *    clipper;                    // pointer to the clipper object
117   IDirectDrawGammaControl *gamma;                     // pointer to the gamma control object
118
119   DDSURFACEDESC2          primarydesc;                // description of the primary surface
120   DDSURFACEDESC2          blitdesc;                   // description of the blitting surface
121   DDSURFACEDESC2          origmode;                   // original video mode
122
123   DDCAPS                  ddcaps;                     // capabilities of the device
124   DDCAPS                  helcaps;                    // capabilities of the hardware
125
126   UINT8 *                 membuffer;                  // memory buffer for complex rendering
127   UINT32                  membuffersize;              // current size of the memory buffer
128};
129
130
131/* monitor_enum_info holds information during a monitor enumeration */
132struct monitor_enum_info
133{
134   osd_monitor_info *      monitor;                    // pointer to monitor we want
135   GUID                    guid;                       // GUID of the one we found
136   GUID *                  guid_ptr;                   // pointer to our GUID
137   int                     foundit;                    // TRUE if we found what we wanted
138};
139
140
141/* mode_enum_info holds information during a display mode enumeration */
142struct mode_enum_info
143{
144   renderer_dd *           renderer;
145   osd_window  *           window;
146   INT32                   minimum_width, minimum_height;
147   INT32                   target_width, target_height;
148   double                  target_refresh;
149   float                   best_score;
150};
151
152
153
154//============================================================
155//  GLOBALS
156//============================================================
157
158static HINSTANCE dllhandle;
159static directdrawcreateex_ptr directdrawcreateex;
160static directdrawenumerateex_ptr directdrawenumerateex;
161
162
163
164//============================================================
165//  INLINES
166//============================================================
167
168inline void renderer_dd::update_outer_rects()
169{
170   clearouter = (back != NULL) ? 3 : 1;
171}
172
173
174static inline int better_mode(int width0, int height0, int width1, int height1, float desired_aspect)
175{
176   float aspect0 = (float)width0 / (float)height0;
177   float aspect1 = (float)width1 / (float)height1;
178   return (fabs(desired_aspect - aspect0) < fabs(desired_aspect - aspect1)) ? 0 : 1;
179}
180
181
182
183//============================================================
184//  PROTOTYPES
185//============================================================
186
187// core functions
188static void drawdd_exit(void);
189
190
191
192//============================================================
193//  drawnone_create
194//============================================================
195
196static osd_renderer *drawdd_create(osd_window *window)
197{
198   return global_alloc(renderer_dd(window));
199}
200
201
202//============================================================
203//  drawdd_init
204//============================================================
205
206int drawdd_init(running_machine &machine, osd_draw_callbacks *callbacks)
207{
208   // dynamically grab the create function from ddraw.dll
209   dllhandle = LoadLibrary(TEXT("ddraw.dll"));
210   if (dllhandle == NULL)
211   {
212      osd_printf_verbose("DirectDraw: Unable to access ddraw.dll\n");
213      return 1;
214   }
215
216   // import the create function
217   directdrawcreateex = (directdrawcreateex_ptr)GetProcAddress(dllhandle, "DirectDrawCreateEx");
218   if (directdrawcreateex == NULL)
219   {
220      osd_printf_verbose("DirectDraw: Unable to find DirectDrawCreateEx\n");
221      FreeLibrary(dllhandle);
222      dllhandle = NULL;
223      return 1;
224   }
225
226   // import the enumerate function
227   directdrawenumerateex = (directdrawenumerateex_ptr)GetProcAddress(dllhandle, "DirectDrawEnumerateExA");
228   if (directdrawenumerateex == NULL)
229   {
230      osd_printf_verbose("DirectDraw: Unable to find DirectDrawEnumerateExA\n");
231      FreeLibrary(dllhandle);
232      dllhandle = NULL;
233      return 1;
234   }
235
236   // fill in the callbacks
237   memset(callbacks, 0, sizeof(*callbacks));
238   callbacks->exit = drawdd_exit;
239   callbacks->create = drawdd_create;
240
241   osd_printf_verbose("DirectDraw: Using DirectDraw 7\n");
242   return 0;
243}
244
245
246
247//============================================================
248//  drawdd_exit
249//============================================================
250
251static void drawdd_exit(void)
252{
253   if (dllhandle != NULL)
254      FreeLibrary(dllhandle);
255}
256
257
258
259//============================================================
260//  drawdd_window_init
261//============================================================
262
263int renderer_dd::create()
264{
265   // configure the adapter for the mode we want
266   if (config_adapter_mode())
267   {
268      osd_printf_error("Unable to configure adapter.\n");
269      goto error;
270   }
271
272   // create the ddraw object
273   if (ddraw_create())
274   {
275      osd_printf_error("Unable to create ddraw object.\n");
276      goto error;
277   }
278
279   return 0;
280
281error:
282   destroy();
283   osd_printf_error("Unable to initialize DirectDraw.\n");
284   return 1;
285}
286
287
288
289//============================================================
290//  drawdd_window_destroy
291//============================================================
292
293void renderer_dd::destroy()
294{
295   // delete the ddraw object
296   ddraw_delete();
297}
298
299
300
301//============================================================
302//  drawdd_window_get_primitives
303//============================================================
304
305render_primitive_list *renderer_dd::get_primitives()
306{
307   compute_blit_surface_size();
308   window().target()->set_bounds(blitwidth, blitheight, 0);
309   window().target()->set_max_update_rate((refresh == 0) ? origmode.dwRefreshRate : refresh);
310
311   return &window().target()->get_primitives();
312}
313
314
315
316//============================================================
317//  drawdd_window_draw
318//============================================================
319
320int renderer_dd::draw(const int update)
321{
322   render_primitive *prim;
323   int usemembuffer = FALSE;
324   HRESULT result;
325
326   // if we're updating, remember to erase the outer stuff
327   if (update)
328      update_outer_rects();
329
330   // if we have a ddraw object, check the cooperative level
331   if (ddraw_test_cooperative())
332      return 1;
333
334   // get the size; if we're too small, delete the existing surfaces
335   if (blitwidth > blitdesc.dwWidth || blitheight > blitdesc.dwHeight)
336      ddraw_delete_surfaces();
337
338   // if we need to create surfaces, do it now
339   if (blit == NULL && ddraw_create_surfaces() != 0)
340      return 1;
341
342   // select our surface and lock it
343   result = IDirectDrawSurface7_Lock(blit, NULL, &blitdesc, DDLOCK_WAIT, NULL);
344   if (result == DDERR_SURFACELOST)
345   {
346      osd_printf_verbose("DirectDraw: Lost surfaces; deleting and retrying next frame\n");
347      ddraw_delete_surfaces();
348      return 1;
349   }
350   if (result != DD_OK)
351   {
352      osd_printf_verbose("DirectDraw: Error %08X locking blit surface\n", (int)result);
353      return 1;
354   }
355
356   // render to it
357   window().m_primlist->acquire_lock();
358
359   // scan the list of primitives for tricky stuff
360   for (prim = window().m_primlist->first(); prim != NULL; prim = prim->next())
361      if (PRIMFLAG_GET_BLENDMODE(prim->flags) != BLENDMODE_NONE ||
362         (prim->texture.base != NULL && PRIMFLAG_GET_TEXFORMAT(prim->flags) == TEXFORMAT_ARGB32))
363      {
364         usemembuffer = TRUE;
365         break;
366      }
367
368   // if we're using the memory buffer, draw offscreen first and then copy
369   if (usemembuffer)
370   {
371      int x, y;
372
373      // based on the target format, use one of our standard renderers
374      switch (blitdesc.ddpfPixelFormat.dwRBitMask)
375      {
376         case 0x00ff0000:    software_renderer<UINT32, 0,0,0, 16,8,0>::draw_primitives(*window().m_primlist, membuffer, blitwidth, blitheight, blitwidth);  break;
377         case 0x000000ff:    software_renderer<UINT32, 0,0,0, 0,8,16>::draw_primitives(*window().m_primlist, membuffer, blitwidth, blitheight, blitwidth);  break;
378         case 0xf800:        software_renderer<UINT16, 3,2,3, 11,5,0>::draw_primitives(*window().m_primlist, membuffer, blitwidth, blitheight, blitwidth);  break;
379         case 0x7c00:        software_renderer<UINT16, 3,3,3, 10,5,0>::draw_primitives(*window().m_primlist, membuffer, blitwidth, blitheight, blitwidth);  break;
380         default:
381            osd_printf_verbose("DirectDraw: Unknown target mode: R=%08X G=%08X B=%08X\n", (int)blitdesc.ddpfPixelFormat.dwRBitMask, (int)blitdesc.ddpfPixelFormat.dwGBitMask, (int)blitdesc.ddpfPixelFormat.dwBBitMask);
382            break;
383      }
384
385      // handle copying to both 16bpp and 32bpp destinations
386      for (y = 0; y < blitheight; y++)
387      {
388         if (blitdesc.ddpfPixelFormat.dwRGBBitCount == 32)
389         {
390            UINT32 *src = (UINT32 *)membuffer + y * blitwidth;
391            UINT32 *dst = (UINT32 *)((UINT8 *)blitdesc.lpSurface + y * blitdesc.lPitch);
392            for (x = 0; x < blitwidth; x++)
393               *dst++ = *src++;
394         }
395         else if (blitdesc.ddpfPixelFormat.dwRGBBitCount == 16)
396         {
397            UINT16 *src = (UINT16 *)membuffer + y * blitwidth;
398            UINT16 *dst = (UINT16 *)((UINT8 *)blitdesc.lpSurface + y * blitdesc.lPitch);
399            for (x = 0; x < blitwidth; x++)
400               *dst++ = *src++;
401         }
402      }
403
404   }
405
406   // otherwise, draw directly
407   else
408   {
409      // based on the target format, use one of our standard renderers
410      switch (blitdesc.ddpfPixelFormat.dwRBitMask)
411      {
412         case 0x00ff0000:    software_renderer<UINT32, 0,0,0, 16,8,0, true>::draw_primitives(*window().m_primlist, blitdesc.lpSurface, blitwidth, blitheight, blitdesc.lPitch / 4); break;
413         case 0x000000ff:    software_renderer<UINT32, 0,0,0, 0,8,16, true>::draw_primitives(*window().m_primlist, blitdesc.lpSurface, blitwidth, blitheight, blitdesc.lPitch / 4); break;
414         case 0xf800:        software_renderer<UINT16, 3,2,3, 11,5,0, true>::draw_primitives(*window().m_primlist, blitdesc.lpSurface, blitwidth, blitheight, blitdesc.lPitch / 2); break;
415         case 0x7c00:        software_renderer<UINT16, 3,3,3, 10,5,0, true>::draw_primitives(*window().m_primlist, blitdesc.lpSurface, blitwidth, blitheight, blitdesc.lPitch / 2); break;
416         default:
417            osd_printf_verbose("DirectDraw: Unknown target mode: R=%08X G=%08X B=%08X\n", (int)blitdesc.ddpfPixelFormat.dwRBitMask, (int)blitdesc.ddpfPixelFormat.dwGBitMask, (int)blitdesc.ddpfPixelFormat.dwBBitMask);
418            break;
419      }
420   }
421   window().m_primlist->release_lock();
422
423   // unlock and blit
424   result = IDirectDrawSurface7_Unlock(blit, NULL);
425   if (result != DD_OK) osd_printf_verbose("DirectDraw: Error %08X unlocking blit surface\n", (int)result);
426
427   // sync to VBLANK
428   if ((video_config.waitvsync || video_config.syncrefresh) && window().machine().video().throttled() && (!window().fullscreen() || back == NULL))
429   {
430      result = IDirectDraw7_WaitForVerticalBlank(ddraw, DDWAITVB_BLOCKBEGIN, NULL);
431      if (result != DD_OK) osd_printf_verbose("DirectDraw: Error %08X waiting for VBLANK\n", (int)result);
432   }
433
434   // complete the blitting
435   blit_to_primary(blitwidth, blitheight);
436   return 0;
437}
438
439
440
441//============================================================
442//  ddraw_create
443//============================================================
444
445int renderer_dd::ddraw_create()
446{
447   HRESULT result;
448   int verify;
449
450   // if a device exists, free it
451   if (ddraw != NULL)
452      ddraw_delete();
453
454   // create the DirectDraw object
455   result = (*directdrawcreateex)(adapter_ptr, (LPVOID *)&ddraw, WRAP_REFIID(IID_IDirectDraw7), NULL);
456   if (result != DD_OK)
457   {
458      osd_printf_verbose("DirectDraw: Error %08X during DirectDrawCreateEx call\n", (int)result);
459      goto error;
460   }
461
462   // verify the caps
463   verify = ddraw_verify_caps();
464   if (verify == 2)
465   {
466      osd_printf_error("DirectDraw: Error - Device does not meet minimum requirements for DirectDraw rendering\n");
467      goto error;
468   }
469   if (verify == 1)
470      osd_printf_verbose("DirectDraw: Warning - Device may not perform well for DirectDraw rendering\n");
471
472   // set the cooperative level
473   // for non-window modes, we will use full screen here
474   result = IDirectDraw7_SetCooperativeLevel(ddraw, win_window_list->m_hwnd, DDSCL_SETFOCUSWINDOW);
475   if (result != DD_OK)
476   {
477      osd_printf_verbose("DirectDraw: Error %08X during IDirectDraw7_SetCooperativeLevel(FOCUSWINDOW) call\n", (int)result);
478      goto error;
479   }
480   result = IDirectDraw7_SetCooperativeLevel(ddraw, window().m_hwnd, DDSCL_SETDEVICEWINDOW | (window().fullscreen() ? DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE : DDSCL_NORMAL));
481   if (result != DD_OK)
482   {
483      osd_printf_verbose("DirectDraw: Error %08X during IDirectDraw7_SetCooperativeLevel(DEVICEWINDOW) call\n", (int)result);
484      goto error;
485   }
486
487   // full screen mode: set the resolution
488   if (window().fullscreen() && video_config.switchres)
489   {
490      result = IDirectDraw7_SetDisplayMode(ddraw, width, height, 32, refresh, 0);
491      if (result != DD_OK)
492      {
493         osd_printf_verbose("DirectDraw: Error %08X attempting to set video mode %dx%d@%d call\n", (int)result, width, height, refresh);
494         goto error;
495      }
496   }
497
498   return ddraw_create_surfaces();
499
500error:
501   ddraw_delete();
502   return 1;
503}
504
505
506
507//============================================================
508//  ddraw_create_surfaces
509//============================================================
510
511int renderer_dd::ddraw_create_surfaces()
512{
513   HRESULT result;
514
515   // make a description of the primary surface
516   memset(&primarydesc, 0, sizeof(primarydesc));
517   primarydesc.dwSize = sizeof(primarydesc);
518   primarydesc.dwFlags = DDSD_CAPS;
519   primarydesc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
520
521   // for triple-buffered full screen mode, allocate flipping surfaces
522   if (window().fullscreen() && video_config.triplebuf)
523   {
524      primarydesc.dwFlags |= DDSD_BACKBUFFERCOUNT;
525      primarydesc.ddsCaps.dwCaps |= DDSCAPS_FLIP | DDSCAPS_COMPLEX;
526      primarydesc.dwBackBufferCount = 2;
527   }
528
529   // create the primary surface and report errors
530   result = create_surface(&primarydesc, &primary, "primary");
531   if (result != DD_OK) goto error;
532
533   // full screen mode: get the back surface
534   back = NULL;
535   if (window().fullscreen() && video_config.triplebuf)
536   {
537      DDSCAPS2 caps = { DDSCAPS_BACKBUFFER };
538      result = IDirectDrawSurface7_GetAttachedSurface(primary, &caps, &back);
539      if (result != DD_OK)
540      {
541         osd_printf_verbose("DirectDraw: Error %08X getting attached back surface\n", (int)result);
542         goto error;
543      }
544   }
545
546   // now make a description of our blit surface, based on the primary surface
547   if (blitwidth == 0 || blitheight == 0)
548      compute_blit_surface_size();
549   blitdesc = primarydesc;
550   blitdesc.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT | DDSD_CAPS;
551   blitdesc.dwWidth = blitwidth;
552   blitdesc.dwHeight = blitheight;
553   blitdesc.ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY;
554
555   // then create the blit surface, fall back to system memory if video mem doesn't work
556   result = create_surface(&blitdesc, &blit, "blit");
557   if (result != DD_OK)
558   {
559      blitdesc.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY;
560      result = create_surface(&blitdesc, &blit, "blit");
561   }
562   if (result != DD_OK) goto error;
563
564   // create a memory buffer for offscreen drawing
565   if (membuffersize < blitwidth * blitheight * 4)
566   {
567      membuffersize = blitwidth * blitheight * 4;
568      global_free_array(membuffer);
569      membuffer = global_alloc_array_nothrow(UINT8, membuffersize);
570   }
571   if (membuffer == NULL)
572      goto error;
573
574   // create a clipper for windowed mode
575   if (!window().fullscreen() && create_clipper())
576      goto error;
577
578   // full screen mode: set the gamma
579   if (window().fullscreen())
580   {
581      // only set the gamma if it's not 1.0f
582      windows_options &options = downcast<windows_options &>(window().machine().options());
583      float brightness = options.full_screen_brightness();
584      float contrast = options.full_screen_contrast();
585      float fgamma = options.full_screen_gamma();
586      if (brightness != 1.0f || contrast != 1.0f || fgamma != 1.0f)
587      {
588         // see if we can get a GammaControl object
589         result = IDirectDrawSurface_QueryInterface(primary, WRAP_REFIID(IID_IDirectDrawGammaControl), (void **)&gamma);
590         if (result != DD_OK)
591         {
592            osd_printf_warning("DirectDraw: Warning - device does not support full screen gamma correction.\n");
593            this->gamma = NULL;
594         }
595
596         // proceed if we can
597         if (this->gamma != NULL)
598         {
599            DDGAMMARAMP ramp;
600            int i;
601
602            // create a standard ramp and set it
603            for (i = 0; i < 256; i++)
604               ramp.red[i] = ramp.green[i] = ramp.blue[i] = apply_brightness_contrast_gamma(i, brightness, contrast, fgamma) << 8;
605
606            // attempt to set it
607            result = IDirectDrawGammaControl_SetGammaRamp(this->gamma, 0, &ramp);
608            if (result != DD_OK)
609               osd_printf_verbose("DirectDraw: Error %08X attempting to set gamma correction.\n", (int)result);
610         }
611      }
612   }
613
614   // force some updates
615   update_outer_rects();
616   return 0;
617
618error:
619   ddraw_delete_surfaces();
620   return 1;
621}
622
623
624
625//============================================================
626//  ddraw_delete
627//============================================================
628
629void renderer_dd::ddraw_delete()
630{
631   // free surfaces
632   ddraw_delete_surfaces();
633
634   // restore resolutions
635   if (ddraw != NULL)
636      IDirectDraw7_RestoreDisplayMode(ddraw);
637
638   // reset cooperative level
639   if (ddraw != NULL && window().m_hwnd != NULL)
640      IDirectDraw7_SetCooperativeLevel(ddraw, window().m_hwnd, DDSCL_NORMAL);
641
642   // release the DirectDraw object itself
643   if (ddraw != NULL)
644      IDirectDraw7_Release(ddraw);
645   ddraw = NULL;
646}
647
648
649
650//============================================================
651//  ddraw_delete_surfaces
652//============================================================
653
654void renderer_dd::ddraw_delete_surfaces()
655{
656   // release the gamma control
657   if (gamma != NULL)
658      IDirectDrawGammaControl_Release(gamma);
659   gamma = NULL;
660
661   // release the clipper
662   if (clipper != NULL)
663      IDirectDrawClipper_Release(clipper);
664   clipper = NULL;
665
666   // free the memory buffer
667   global_free_array(membuffer);
668   membuffer = NULL;
669   membuffersize = 0;
670
671   // release the blit surface
672   if (blit != NULL)
673      IDirectDrawSurface7_Release(blit);
674   blit = NULL;
675
676   // release the back surface
677   if (back != NULL)
678      IDirectDrawSurface7_Release(back);
679   back = NULL;
680
681   // release the primary surface
682   if (primary != NULL)
683      IDirectDrawSurface7_Release(primary);
684   primary = NULL;
685}
686
687
688
689//============================================================
690//  ddraw_verify_caps
691//============================================================
692
693int renderer_dd::ddraw_verify_caps()
694{
695   int retval = 0;
696   HRESULT result;
697
698   // get the capabilities
699   ddcaps.dwSize = sizeof(ddcaps);
700   helcaps.dwSize = sizeof(helcaps);
701   result = IDirectDraw7_GetCaps(ddraw, &ddcaps, &helcaps);
702   if (result != DD_OK)
703   {
704      osd_printf_verbose("DirectDraw: Error %08X during IDirectDraw7_GetCaps call\n", (int)result);
705      return 1;
706   }
707
708   // determine if hardware stretching is available
709   if ((ddcaps.dwCaps & DDCAPS_BLTSTRETCH) == 0)
710   {
711      osd_printf_verbose("DirectDraw: Warning - Device does not support hardware stretching\n");
712      retval = 1;
713   }
714
715   return retval;
716}
717
718
719
720//============================================================
721//  ddraw_test_cooperative
722//============================================================
723
724int renderer_dd::ddraw_test_cooperative()
725{
726   HRESULT result;
727
728   // check our current status; if we lost the device, punt to GDI
729   result = IDirectDraw7_TestCooperativeLevel(ddraw);
730   switch (result)
731   {
732      // punt to GDI if someone else has exclusive mode
733      case DDERR_NOEXCLUSIVEMODE:
734      case DDERR_EXCLUSIVEMODEALREADYSET:
735         ddraw_delete_surfaces();
736         return 1;
737
738      // if we're ok, but we don't have a primary surface, create one
739      default:
740      case DD_OK:
741         if (primary == NULL)
742            return ddraw_create_surfaces();
743         return 0;
744   }
745}
746
747
748
749//============================================================
750//  create_surface
751//============================================================
752
753HRESULT renderer_dd::create_surface(DDSURFACEDESC2 *desc, IDirectDrawSurface7 **surface, const char *type)
754{
755   HRESULT result;
756
757   // create the surface as requested
758   result = IDirectDraw7_CreateSurface(ddraw, desc, surface, NULL);
759   if (result != DD_OK)
760   {
761      osd_printf_verbose("DirectDraw: Error %08X creating %s surface\n", (int)result, type);
762      return result;
763   }
764
765   // get a description of the primary surface
766   result = IDirectDrawSurface7_GetSurfaceDesc(*surface, desc);
767   if (result != DD_OK)
768   {
769      osd_printf_verbose("DirectDraw: Error %08X getting %s surface desciption\n", (int)result, type);
770      IDirectDrawSurface7_Release(*surface);
771      *surface = NULL;
772      return result;
773   }
774
775   // print out the good stuff
776   osd_printf_verbose("DirectDraw: %s surface created: %dx%dx%d (R=%08X G=%08X B=%08X)\n",
777            type,
778            (int)desc->dwWidth,
779            (int)desc->dwHeight,
780            (int)desc->ddpfPixelFormat.dwRGBBitCount,
781            (UINT32)desc->ddpfPixelFormat.dwRBitMask,
782            (UINT32)desc->ddpfPixelFormat.dwGBitMask,
783            (UINT32)desc->ddpfPixelFormat.dwBBitMask);
784   return result;
785}
786
787
788
789//============================================================
790//  create_clipper
791//============================================================
792
793int renderer_dd::create_clipper()
794{
795   HRESULT result;
796
797   // create a clipper for the primary surface
798   result = IDirectDraw7_CreateClipper(ddraw, 0, &clipper, NULL);
799   if (result != DD_OK)
800   {
801      osd_printf_verbose("DirectDraw: Error %08X creating clipper\n", (int)result);
802      return 1;
803   }
804
805   // set the clipper's hwnd
806   result = IDirectDrawClipper_SetHWnd(clipper, 0, window().m_hwnd);
807   if (result != DD_OK)
808   {
809      osd_printf_verbose("DirectDraw: Error %08X setting clipper hwnd\n", (int)result);
810      return 1;
811   }
812
813   // set the clipper on the primary surface
814   result = IDirectDrawSurface7_SetClipper(primary, clipper);
815   if (result != DD_OK)
816   {
817      osd_printf_verbose("DirectDraw: Error %08X setting clipper on primary surface\n", (int)result);
818      return 1;
819   }
820   return 0;
821}
822
823
824
825//============================================================
826//  compute_blit_surface_size
827//============================================================
828
829void renderer_dd::compute_blit_surface_size()
830{
831   INT32 newwidth, newheight;
832   int xscale, yscale;
833   RECT client;
834
835   // start with the minimum size
836   window().target()->compute_minimum_size(newwidth, newheight);
837
838   // get the window's client rectangle
839   GetClientRect(window().m_hwnd, &client);
840
841   // hardware stretch case: apply prescale
842   if (video_config.hwstretch)
843   {
844      int prescale = (window().prescale() < 1) ? 1 : window().prescale();
845
846      // clamp the prescale to something smaller than the target bounds
847      xscale = prescale;
848      while (xscale > 1 && newwidth * xscale > rect_width(&client))
849         xscale--;
850      yscale = prescale;
851      while (yscale > 1 && newheight * yscale > rect_height(&client))
852         yscale--;
853   }
854
855   // non stretch case
856   else
857   {
858      INT32 target_width = rect_width(&client);
859      INT32 target_height = rect_height(&client);
860      float desired_aspect = 1.0f;
861
862      // compute the appropriate visible area if we're trying to keepaspect
863      if (video_config.keepaspect)
864      {
865         osd_monitor_info *monitor = window().winwindow_video_window_monitor(NULL);
866         window().target()->compute_visible_area(target_width, target_height, monitor->aspect(), window().target()->orientation(), target_width, target_height);
867         desired_aspect = (float)target_width / (float)target_height;
868      }
869
870      // compute maximum integral scaling to fit the window
871      xscale = (target_width + 2) / newwidth;
872      yscale = (target_height + 2) / newheight;
873
874      // try a little harder to keep the aspect ratio if desired
875      if (video_config.keepaspect)
876      {
877         // if we could stretch more in the X direction, and that makes a better fit, bump the xscale
878         while (newwidth * (xscale + 1) <= rect_width(&client) &&
879            better_mode(newwidth * xscale, newheight * yscale, newwidth * (xscale + 1), newheight * yscale, desired_aspect))
880            xscale++;
881
882         // if we could stretch more in the Y direction, and that makes a better fit, bump the yscale
883         while (newheight * (yscale + 1) <= rect_height(&client) &&
884            better_mode(newwidth * xscale, newheight * yscale, newwidth * xscale, newheight * (yscale + 1), desired_aspect))
885            yscale++;
886
887         // now that we've maxed out, see if backing off the maximally stretched one makes a better fit
888         if (rect_width(&client) - newwidth * xscale < rect_height(&client) - newheight * yscale)
889         {
890            while (xscale > 1 && better_mode(newwidth * xscale, newheight * yscale, newwidth * (xscale - 1), newheight * yscale, desired_aspect))
891               xscale--;
892         }
893         else
894         {
895            while (yscale > 1 && better_mode(newwidth * xscale, newheight * yscale, newwidth * xscale, newheight * (yscale - 1), desired_aspect))
896               yscale--;
897         }
898      }
899   }
900
901   // ensure at least a scale factor of 1
902   if (xscale == 0) xscale = 1;
903   if (yscale == 0) yscale = 1;
904
905   // apply the final scale
906   newwidth *= xscale;
907   newheight *= yscale;
908   if (newwidth != blitwidth || newheight != blitheight)
909   {
910      // force some updates
911      update_outer_rects();
912      osd_printf_verbose("DirectDraw: New blit size = %dx%d\n", newwidth, newheight);
913   }
914   blitwidth = newwidth;
915   blitheight = newheight;
916}
917
918
919
920//============================================================
921//  calc_fullscreen_margins
922//============================================================
923
924void renderer_dd::calc_fullscreen_margins(DWORD desc_width, DWORD desc_height, RECT *margins)
925{
926   margins->left = 0;
927   margins->top = 0;
928   margins->right = desc_width;
929   margins->bottom = desc_height;
930
931   if (window().win_has_menu())
932   {
933      static int height_with_menubar = 0;
934      if (height_with_menubar == 0)
935      {
936         RECT with_menu = { 100, 100, 200, 200 };
937         RECT without_menu = { 100, 100, 200, 200 };
938         AdjustWindowRect(&with_menu, WS_OVERLAPPED, TRUE);
939         AdjustWindowRect(&without_menu, WS_OVERLAPPED, FALSE);
940         height_with_menubar = (with_menu.bottom - with_menu.top) - (without_menu.bottom - without_menu.top);
941      }
942      margins->top = height_with_menubar;
943   }
944}
945
946
947
948//============================================================
949//  blit_to_primary
950//============================================================
951
952void renderer_dd::blit_to_primary(int srcwidth, int srcheight)
953{
954   IDirectDrawSurface7 *target = (back != NULL) ? back : primary;
955   osd_monitor_info *monitor = window().winwindow_video_window_monitor(NULL);
956   DDBLTFX blitfx = { sizeof(DDBLTFX) };
957   RECT clear, outer, dest, source;
958   INT32 dstwidth, dstheight;
959   HRESULT result;
960
961   // compute source rect
962   source.left = source.top = 0;
963   source.right = srcwidth;
964   source.bottom = srcheight;
965
966   // compute outer rect -- windowed version
967   if (!window().fullscreen())
968   {
969      GetClientRect(window().m_hwnd, &outer);
970      ClientToScreen(window().m_hwnd, &((LPPOINT)&outer)[0]);
971      ClientToScreen(window().m_hwnd, &((LPPOINT)&outer)[1]);
972
973      // adjust to be relative to the monitor
974      osd_rect pos = monitor->position_size();
975      outer.left -= pos.left();
976      outer.right -= pos.left();
977      outer.top -= pos.top();
978      outer.bottom -= pos.top();
979   }
980
981   // compute outer rect -- full screen version
982   else
983   {
984      calc_fullscreen_margins(primarydesc.dwWidth, primarydesc.dwHeight, &outer);
985   }
986
987   // if we're respecting the aspect ratio, we need to adjust to fit
988   dstwidth = rect_width(&outer);
989   dstheight = rect_height(&outer);
990   if (!video_config.hwstretch)
991   {
992      // trim the source if necessary
993      if (rect_width(&outer) < srcwidth)
994      {
995         source.left += (srcwidth - rect_width(&outer)) / 2;
996         source.right = source.left + rect_width(&outer);
997      }
998      if (rect_height(&outer) < srcheight)
999      {
1000         source.top += (srcheight - rect_height(&outer)) / 2;
1001         source.bottom = source.top + rect_height(&outer);
1002      }
1003
1004      // match the destination and source sizes
1005      dstwidth = srcwidth = source.right - source.left;
1006      dstheight = srcheight = source.bottom - source.top;
1007   }
1008   else if (video_config.keepaspect)
1009   {
1010      // compute the appropriate visible area
1011      window().target()->compute_visible_area(rect_width(&outer), rect_height(&outer), monitor->aspect(), window().target()->orientation(), dstwidth, dstheight);
1012   }
1013
1014   // center within
1015   dest.left = outer.left + (rect_width(&outer) - dstwidth) / 2;
1016   dest.right = dest.left + dstwidth;
1017   dest.top = outer.top + (rect_height(&outer) - dstheight) / 2;
1018   dest.bottom = dest.top + dstheight;
1019
1020   // compare against last destination; if different, force a redraw
1021   if (dest.left != lastdest.left || dest.right != lastdest.right || dest.top != lastdest.top || dest.bottom != lastdest.bottom)
1022   {
1023      lastdest = dest;
1024      update_outer_rects();
1025   }
1026
1027   // clear outer rects if we need to
1028   if (clearouter != 0)
1029   {
1030      clearouter--;
1031
1032      // clear the left edge
1033      if (dest.left > outer.left)
1034      {
1035         clear = outer;
1036         clear.right = dest.left;
1037         result = IDirectDrawSurface_Blt(target, &clear, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &blitfx);
1038         if (result != DD_OK) osd_printf_verbose("DirectDraw: Error %08X clearing the screen\n", (int)result);
1039      }
1040
1041      // clear the right edge
1042      if (dest.right < outer.right)
1043      {
1044         clear = outer;
1045         clear.left = dest.right;
1046         result = IDirectDrawSurface_Blt(target, &clear, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &blitfx);
1047         if (result != DD_OK) osd_printf_verbose("DirectDraw: Error %08X clearing the screen\n", (int)result);
1048      }
1049
1050      // clear the top edge
1051      if (dest.top > outer.top)
1052      {
1053         clear = outer;
1054         clear.bottom = dest.top;
1055         result = IDirectDrawSurface_Blt(target, &clear, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &blitfx);
1056         if (result != DD_OK) osd_printf_verbose("DirectDraw: Error %08X clearing the screen\n", (int)result);
1057      }
1058
1059      // clear the bottom edge
1060      if (dest.bottom < outer.bottom)
1061      {
1062         clear = outer;
1063         clear.top = dest.bottom;
1064         result = IDirectDrawSurface_Blt(target, &clear, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &blitfx);
1065         if (result != DD_OK) osd_printf_verbose("DirectDraw: Error %08X clearing the screen\n", (int)result);
1066      }
1067   }
1068
1069   // do the blit
1070   result = IDirectDrawSurface7_Blt(target, &dest, blit, &source, DDBLT_WAIT, NULL);
1071   if (result != DD_OK) osd_printf_verbose("DirectDraw: Error %08X blitting to the screen\n", (int)result);
1072
1073   // page flip if triple buffered
1074   if (window().fullscreen() && back != NULL)
1075   {
1076      result = IDirectDrawSurface7_Flip(primary, NULL, DDFLIP_WAIT);
1077      if (result != DD_OK) osd_printf_verbose("DirectDraw: Error %08X waiting for VBLANK\n", (int)result);
1078   }
1079}
1080
1081
1082
1083//============================================================
1084//  config_adapter_mode
1085//============================================================
1086
1087int renderer_dd::config_adapter_mode()
1088{
1089   DDDEVICEIDENTIFIER2 identifier;
1090   HRESULT result;
1091
1092   // choose the monitor number
1093   get_adapter_for_monitor(window().monitor());
1094
1095   // create a temporary DirectDraw object
1096   result = (*directdrawcreateex)(adapter_ptr, (LPVOID *)&ddraw, WRAP_REFIID(IID_IDirectDraw7), NULL);
1097   if (result != DD_OK)
1098   {
1099      osd_printf_verbose("DirectDraw: Error %08X during DirectDrawCreateEx call\n", (int)result);
1100      return 1;
1101   }
1102
1103   // get the identifier
1104   result = IDirectDraw7_GetDeviceIdentifier(ddraw, &identifier, 0);
1105   if (result != DD_OK)
1106   {
1107      osd_printf_error("Error getting identifier for device\n");
1108      return 1;
1109   }
1110   osd_printf_verbose("DirectDraw: Configuring device %s\n", identifier.szDescription);
1111
1112   // get the current display mode
1113   memset(&origmode, 0, sizeof(origmode));
1114   origmode.dwSize = sizeof(origmode);
1115   result = IDirectDraw7_GetDisplayMode(ddraw, &origmode);
1116   if (result != DD_OK)
1117   {
1118      osd_printf_verbose("DirectDraw: Error %08X getting current display mode\n", (int)result);
1119      IDirectDraw7_Release(ddraw);
1120      return 1;
1121   }
1122
1123   // choose a resolution: full screen mode case
1124   if (window().fullscreen())
1125   {
1126      // default to the current mode exactly
1127      width = origmode.dwWidth;
1128      height = origmode.dwHeight;
1129      refresh = origmode.dwRefreshRate;
1130
1131      // if we're allowed to switch resolutions, override with something better
1132      if (video_config.switchres)
1133         pick_best_mode();
1134   }
1135
1136   // release the DirectDraw object
1137   IDirectDraw7_Release(ddraw);
1138   ddraw = NULL;
1139
1140   // if we're not changing resolutions, make sure we have a resolution we can handle
1141   if (!window().fullscreen() || !video_config.switchres)
1142   {
1143      switch (origmode.ddpfPixelFormat.dwRBitMask)
1144      {
1145         case 0x00ff0000:
1146         case 0x000000ff:
1147         case 0xf800:
1148         case 0x7c00:
1149            break;
1150
1151         default:
1152            osd_printf_verbose("DirectDraw: Unknown target mode: R=%08X G=%08X B=%08X\n", (int)origmode.ddpfPixelFormat.dwRBitMask, (int)origmode.ddpfPixelFormat.dwGBitMask, (int)origmode.ddpfPixelFormat.dwBBitMask);
1153            return 1;
1154      }
1155   }
1156
1157   return 0;
1158}
1159
1160
1161
1162//============================================================
1163//  monitor_enum_callback
1164//============================================================
1165
1166static BOOL WINAPI monitor_enum_callback(GUID FAR *guid, LPSTR description, LPSTR name, LPVOID context, HMONITOR hmonitor)
1167{
1168   monitor_enum_info *einfo = (monitor_enum_info *)context;
1169
1170   // do we match the desired monitor?
1171   if (hmonitor == *((HMONITOR *)einfo->monitor->oshandle()) || (hmonitor == NULL && einfo->monitor->is_primary()))
1172   {
1173      einfo->guid_ptr = (guid != NULL) ? &einfo->guid : NULL;
1174      if (guid != NULL)
1175         einfo->guid = *guid;
1176      einfo->foundit = TRUE;
1177   }
1178   return 1;
1179}
1180
1181
1182
1183//============================================================
1184//  get_adapter_for_monitor
1185//============================================================
1186
1187void renderer_dd::get_adapter_for_monitor(osd_monitor_info *monitor)
1188{
1189   monitor_enum_info einfo;
1190   HRESULT result;
1191
1192   // try to find our monitor
1193   memset(&einfo, 0, sizeof(einfo));
1194   einfo.monitor = monitor;
1195   result = (*directdrawenumerateex)(monitor_enum_callback, &einfo, DDENUM_ATTACHEDSECONDARYDEVICES);
1196   if (result != DD_OK) osd_printf_verbose("DirectDraw: Error %08X during DirectDrawEnumerateEx call\n", (int)result);
1197
1198   // set up the adapter
1199   if (einfo.foundit && einfo.guid_ptr != NULL)
1200   {
1201      adapter = einfo.guid;
1202      adapter_ptr = &adapter;
1203   }
1204   else
1205      adapter_ptr = NULL;
1206}
1207
1208
1209
1210//============================================================
1211//  enum_modes_callback
1212//============================================================
1213
1214static HRESULT WINAPI enum_modes_callback(LPDDSURFACEDESC2 desc, LPVOID context)
1215{
1216   float size_score, refresh_score, final_score;
1217   mode_enum_info *einfo = (mode_enum_info *)context;
1218   renderer_dd *dd = einfo->renderer;
1219
1220   // skip non-32 bit modes
1221   if (desc->ddpfPixelFormat.dwRGBBitCount != 32)
1222      return DDENUMRET_OK;
1223
1224   // compute initial score based on difference between target and current
1225   size_score = 1.0f / (1.0f + fabs((float)((INT32)desc->dwWidth - einfo->target_width)) + fabs((float)((INT32)desc->dwHeight - einfo->target_height)));
1226
1227   // if the mode is too small, give a big penalty
1228   if (desc->dwWidth < einfo->minimum_width || desc->dwHeight < einfo->minimum_height)
1229      size_score *= 0.01f;
1230
1231   // if mode is smaller than we'd like, it only scores up to 0.1
1232   if (desc->dwWidth < einfo->target_width || desc->dwHeight < einfo->target_height)
1233      size_score *= 0.1f;
1234
1235   // if we're looking for a particular mode, that's a winner
1236   if (desc->dwWidth == einfo->window->m_win_config.width && desc->dwHeight == einfo->window->m_win_config.height)
1237      size_score = 2.0f;
1238
1239   // compute refresh score
1240   refresh_score = 1.0f / (1.0f + fabs((double)desc->dwRefreshRate - einfo->target_refresh));
1241
1242   // if refresh is smaller than we'd like, it only scores up to 0.1
1243   if ((double)desc->dwRefreshRate < einfo->target_refresh)
1244      refresh_score *= 0.1f;
1245
1246   // if we're looking for a particular refresh, make sure it matches
1247   if (desc->dwRefreshRate == einfo->window->m_win_config.refresh)
1248      refresh_score = 2.0f;
1249
1250   // weight size and refresh equally
1251   final_score = size_score + refresh_score;
1252
1253   // best so far?
1254   osd_printf_verbose("  %4dx%4d@%3dHz -> %f\n", (int)desc->dwWidth, (int)desc->dwHeight, (int)desc->dwRefreshRate, final_score * 1000.0f);
1255   if (final_score > einfo->best_score)
1256   {
1257      einfo->best_score = final_score;
1258      dd->width = desc->dwWidth;
1259      dd->height = desc->dwHeight;
1260      dd->refresh = desc->dwRefreshRate;
1261   }
1262   return DDENUMRET_OK;
1263}
1264
1265
1266
1267//============================================================
1268//  pick_best_mode
1269//============================================================
1270
1271void renderer_dd::pick_best_mode()
1272{
1273   mode_enum_info einfo;
1274   HRESULT result;
1275
1276   // determine the minimum width/height for the selected target
1277   // note: technically we should not be calling this from an alternate window
1278   // thread; however, it is only done during init time, and the init code on
1279   // the main thread is waiting for us to finish, so it is safe to do so here
1280   window().target()->compute_minimum_size(einfo.minimum_width, einfo.minimum_height);
1281
1282   // use those as the target for now
1283   einfo.target_width = einfo.minimum_width * MAX(1, window().prescale());
1284   einfo.target_height = einfo.minimum_height * MAX(1, window().prescale());
1285
1286   // determine the refresh rate of the primary screen
1287   einfo.target_refresh = 60.0;
1288   const screen_device *primary_screen = window().machine().config().first_screen();
1289   if (primary_screen != NULL)
1290      einfo.target_refresh = ATTOSECONDS_TO_HZ(primary_screen->refresh_attoseconds());
1291   printf("Target refresh = %f\n", einfo.target_refresh);
1292
1293   // if we're not stretching, allow some slop on the minimum since we can handle it
1294   if (!video_config.hwstretch)
1295   {
1296      einfo.minimum_width -= 4;
1297      einfo.minimum_height -= 4;
1298   }
1299
1300   // if we are stretching, aim for a mode approximately 2x the game's resolution
1301   else if (window().prescale() <= 1)
1302   {
1303      einfo.target_width *= 2;
1304      einfo.target_height *= 2;
1305   }
1306
1307   // fill in the rest of the data
1308   einfo.window = &window();
1309   einfo.renderer = this;
1310   einfo.best_score = 0.0f;
1311
1312   // enumerate the modes
1313   osd_printf_verbose("DirectDraw: Selecting video mode...\n");
1314   result = IDirectDraw7_EnumDisplayModes(ddraw, DDEDM_REFRESHRATES, NULL, &einfo, enum_modes_callback);
1315   if (result != DD_OK) osd_printf_verbose("DirectDraw: Error %08X during EnumDisplayModes call\n", (int)result);
1316   osd_printf_verbose("DirectDraw: Mode selected = %4dx%4d@%3dHz\n", width, height, refresh);
1317}
trunk/src/osd/sdl/video.h
r253556r253557
181181
182182   int                 fullstretch;    // FXIME: implement in windows!
183183
184   // ddraw options
185   int                 hwstretch;                  // stretch using the hardware
186
184187   // d3d, accel, opengl
185188   int                 filter;                     // enable filtering
186189   //int                 filter;         // enable filtering, disabled if glsl_filter>0
trunk/src/osd/windows/video.cpp
r253556r253557
373373      video_config.mode = VIDEO_MODE_D3D;
374374   else if (strcmp(stemp, "auto") == 0)
375375      video_config.mode = VIDEO_MODE_D3D;
376   else if (strcmp(stemp, "ddraw") == 0)
377      video_config.mode = VIDEO_MODE_DDRAW;
376378   else if (strcmp(stemp, "gdi") == 0)
377379      video_config.mode = VIDEO_MODE_GDI;
378380   else if (strcmp(stemp, "bgfx") == 0)
r253556r253557
397399   video_config.triplebuf     = options().triple_buffer();
398400   video_config.switchres     = options().switch_res();
399401
402   // ddraw options: extract the data
403   video_config.hwstretch     = options().hwstretch();
404
400405   if (video_config.prescale < 1 || video_config.prescale > 3)
401406   {
402407      osd_printf_warning("Invalid prescale option, reverting to '1'\n");
trunk/src/osd/windows/video.h
r253556r253557
2121enum {
2222   VIDEO_MODE_NONE,
2323   VIDEO_MODE_GDI,
24   VIDEO_MODE_DDRAW,
2425   VIDEO_MODE_BGFX,
2526#if (USE_OPENGL)
2627   VIDEO_MODE_OPENGL,
r253556r253557
177178
178179   int                 fullstretch;    // FXIME: implement in windows!
179180
181   // ddraw options
182   int                 hwstretch;                  // stretch using the hardware
183
180184   // d3d, accel, opengl
181185   int                 filter;                     // enable filtering
182186   //int                 filter;         // enable filtering, disabled if glsl_filter>0
trunk/src/osd/windows/window.cpp
r253556r253557
3636
3737extern int drawnone_init(running_machine &machine, osd_draw_callbacks *callbacks);
3838extern int drawgdi_init(running_machine &machine, osd_draw_callbacks *callbacks);
39extern int drawdd_init(running_machine &machine, osd_draw_callbacks *callbacks);
3940extern int drawd3d_init(running_machine &machine, osd_draw_callbacks *callbacks);
4041extern int drawbgfx_init(running_machine &machine, osd_draw_callbacks *callbacks);
4142#if (USE_OPENGL)
r253556r253557
218219      if (drawd3d_init(machine(), &draw))
219220         video_config.mode = VIDEO_MODE_GDI;
220221   }
222   if (video_config.mode == VIDEO_MODE_DDRAW)
223   {
224      if (drawdd_init(machine(), &draw))
225         video_config.mode = VIDEO_MODE_GDI;
226   }
221227   if (video_config.mode == VIDEO_MODE_GDI)
222228      drawgdi_init(machine(), &draw);
223229   if (video_config.mode == VIDEO_MODE_BGFX)
trunk/src/osd/windows/winmain.cpp
r253556r253557
526526void windows_osd_interface::video_register()
527527{
528528   video_options_add("gdi", NULL);
529   video_options_add("ddraw", NULL);
529530   video_options_add("d3d", NULL);
530531   video_options_add("bgfx", NULL);
531532   //video_options_add("auto", NULL); // making d3d video default one


Previous 199869 Revisions Next


© 1997-2024 The MAME Team