Previous 199869 Revisions Next

r33790 Monday 8th December, 2014 at 11:05:16 UTC by Luca Bruno
version: provide a bare version-only constant

This commits add a new global constant containing only the version number,
without build date.
This is useful for tools built around MAME, which would use it to track
capability changes for compatibility layers.

Signed-off-by: Luca Bruno <lucab@debian.org>
[hash]vsmile_cart.xml
[src]version.c
[src/emu]emucore.h mame.h rendlay.c rendlay.h
[src/emu/bus/ieee488]c2040fdc.c
[src/emu/cpu/arcompact]arcompact.h arcompactdasm.c
[src/emu/cpu/m68000]m68kdasm.c
[src/emu/cpu/tms0980]tms0980.c tms0980.h
[src/emu/debug]dvmemory.c
[src/emu/machine]64h156.c fdc_pll.c fdc_pll.h machine.mak pci.c pci.h r10788.c r10788.h
[src/emu/video]gf6800gt.c* gf6800gt.h* gf7600gs.c gf7600gs.h video.mak
[src/lib/formats]victor9k_dsk.c
[src/mame]mame.lst mame.mak
[src/mame/drivers]dooyong.c gts1.c gundealr.c lindbergh.c prehisle.c snowbros.c
[src/mame/includes]snowbros.h
[src/mame/layout]gts1.lay
[src/mess]mess.lst mess.mak
[src/mess/drivers]apf.c apple2e.c cnsector.c comp4.c excali64.c leapster.c mathmagi.c merlin.c microvsn.c simon.c starwbc.c stopthie.c ticalc1x.c victor9k.c vii.c
[src/mess/includes]victor9k.h
[src/mess/layout]mathmagi.lay wizatron.lay
[src/mess/machine]super80.c victor9k_fdc.c victor9k_fdc.h victor9kb.c
[src/mess/video]apple2.c
[src/osd/sdl]input.c

trunk/hash/vsmile_cart.xml
r242301r242302
731731      <publisher>VTech</publisher>
732732      <part name="cart" interface="vsmile_cart">
733733         <dataarea name="rom" size="8388608">
734            <rom name="52-92124.bin" size="8388608" crc="ce21b7ba" sha1="e992b113f014614db34b81bb22357847cef79a16" offset="0" />
734            <rom name="092124.bin" size="8388608" crc="ce21b7ba" sha1="e992b113f014614db34b81bb22357847cef79a16" offset="0" />
735735         </dataarea>
736736      </part>
737737   </software>
738738
739   <software name="arieldk" cloneof="ariel" supported="no">
740      <description>Den Lille Havfrue - Ariels majestætiske rejse! (Den)</description>
741      <year>200?</year>
742      <publisher>VTech</publisher>
743      <part name="cart" interface="vsmile_cart">
744         <dataarea name="rom" size="8388608">
745            <rom name="52-92133.bin" size="8388608" crc="182b5973" sha1="7f356a9890c7ea20c81db94f81037355b8cfb2c9" offset="0" />
746         </dataarea>
747      </part>
748   </software>
749
750   <software name="arielsw" cloneof="ariel" supported="no">
751      <description>Den Lilla Sjöjungfrun - Ariels majestätiska resa! (Swe)</description>
752      <year>200?</year>
753      <publisher>VTech</publisher>
754      <part name="cart" interface="vsmile_cart">
755         <dataarea name="rom" size="8388608">
756            <rom name="52-92134.bin" size="8388608" crc="e567db85" sha1="ca52eaca6cf1b361fd4b1ae2b2380095c612668d" offset="0" />
757         </dataarea>
758      </part>
759   </software>
760
761739<!-- loads if mapped as Batman TV -->
762740   <software name="bobbday" supported="no">
763741      <description>Bob the Builder - Bob's Busy Day (USA)</description>
r242301r242302
781759      </part>
782760   </software>
783761
784   <software name="bobbdaydk" cloneof="bobbday" supported="no">
785      <description>Byggemand Bob - Bobs travle dag (Den)</description>
786      <year>200?</year>
787      <publisher>VTech</publisher>
788      <part name="cart" interface="vsmile_cart">
789         <dataarea name="rom" size="8388608">
790            <rom name="52-92313.bin" size="8388608" crc="37498231" sha1="2966ba75fc4430ee5d9dc7003d7f7e54e5546382" offset="0" />
791         </dataarea>
792      </part>
793   </software>
794
795   <software name="bobbdaysw" cloneof="bobbday" supported="no">
796      <description>Byggare Bob - Bobs stressiga dag (Swe)</description>
797      <year>200?</year>
798      <publisher>VTech</publisher>
799      <part name="cart" interface="vsmile_cart">
800         <dataarea name="rom" size="8388608">
801            <rom name="52-92314.bin" size="8388608" crc="ac343df7" sha1="77dafa48ca0e015728c5ead844dd729e87eb6182" offset="0" />
802         </dataarea>
803      </part>
804   </software>
805
806762<!-- loads if mapped as Batman TV -->
807763   <software name="cars" supported="no">
808764      <description>Cars - Rev It Up in Radiator Springs (USA)</description>
r242301r242302
937893      </part>
938894   </software>
939895
940   <software name="lionking" supported="no">
941      <description>Løvernes Konge - Simbas store eventyr (Den)</description>
942      <year>200?</year>
943      <publisher>VTech</publisher>
944      <part name="cart" interface="vsmile_cart">
945         <dataarea name="rom" size="8388608">
946            <rom name="52-92113.bin" size="8388608" crc="924efa89" sha1="fd111f99ef101d318a66a728927d379559dc0106" offset="0" />
947         </dataarea>
948      </part>
949   </software>
950
951896   <software name="manny" supported="no">
952897      <description>Meister Manny's Werkzeugkiste (Ger)</description>
953898      <year>200?</year>
r242301r242302
11741119      <publisher>VTech</publisher>
11751120      <part name="cart" interface="vsmile_cart">
11761121         <dataarea name="rom" size="8388608">
1177            <rom name="52-92224.bin" size="8388608" crc="c6fbdb94" sha1="887f1d2acadc6902d386488577654a6786d802a9" offset="0" />
1122            <rom name="092224.bin" size="8388608" crc="c6fbdb94" sha1="887f1d2acadc6902d386488577654a6786d802a9" offset="0" />
11781123         </dataarea>
11791124      </part>
11801125   </software>
11811126
1182   <software name="toystor2sw" cloneof="toystor2" supported="no">
1183      <description>Toy Story 2 - Operation: Rädda Woody! (Swe)</description>
1184      <year>200?</year>
1185      <publisher>VTech</publisher>
1186      <part name="cart" interface="vsmile_cart">
1187         <dataarea name="rom" size="8388608">
1188            <rom name="52-92234.bin" size="8388608" crc="a6aa6d6b" sha1="ca576d994441ffaac96e015f5a9309e0326280e1" offset="0" />
1189         </dataarea>
1190      </part>
1191   </software>
1192
11931127   <software name="walle" supported="no">
11941128      <description>Wall-E (Ger)</description>
11951129      <year>200?</year>
11961130      <publisher>VTech</publisher>
11971131      <part name="cart" interface="vsmile_cart">
11981132         <dataarea name="rom" size="8388608">
1199            <rom name="52-92844.bin" size="8388608" crc="f4be4391" sha1="5e43c9dd4759218578d1a8364540db8bc6bc6416" offset="0" />
1133            <rom name="092844.bin" size="8388608" crc="f4be4391" sha1="5e43c9dd4759218578d1a8364540db8bc6bc6416" offset="0" />
12001134         </dataarea>
12011135      </part>
12021136   </software>
12031137
1204   <software name="wallesw" cloneof="walle" supported="no">
1205      <description>Wall-E (Swe)</description>
1206      <year>200?</year>
1207      <publisher>VTech</publisher>
1208      <part name="cart" interface="vsmile_cart">
1209         <dataarea name="rom" size="8388608">
1210            <rom name="52-92854.bin" size="8388608" crc="860194d2" sha1="3d5f40a0f523c9b090a826fef45a6bc63a58d519" offset="0" />
1211         </dataarea>
1212      </part>
1213   </software>
1214
12151138   <software name="pooh" supported="no">
12161139      <description>Winnie Puhh - Die Honigjagd (Ger)</description>
12171140      <year>200?</year>
12181141      <publisher>VTech</publisher>
12191142      <part name="cart" interface="vsmile_cart">
12201143         <dataarea name="rom" size="8388608">
1221            <rom name="52-92064.bin" size="8388608" crc="38a17e7e" sha1="434849ba8867d0bfb16b0fb5abfec86286390c07" offset="0" />
1144            <rom name="092064.bin" size="8388608" crc="38a17e7e" sha1="434849ba8867d0bfb16b0fb5abfec86286390c07" offset="0" />
12221145         </dataarea>
12231146      </part>
12241147   </software>
r242301r242302
12821205      </part>
12831206   </software>
12841207
1285   <software name="poohvb" supported="no">
1286      <description>Nalle Puhs Aeventyr i Sjumilaskogen (Swe) (V.Smile Baby)</description>
1287      <year>200?</year>
1288      <publisher>VTech</publisher>
1289      <part name="cart" interface="vsmile_cart">
1290         <dataarea name="rom" size="8388608">
1291            <rom name="52-99034.bin" size="8388608" crc="5dbe1c20" sha1="51f56cedbe99fc7438429a4c02c08f65d2313790" offset="0" />
1292         </dataarea>
1293      </part>
1294   </software>
12951208
1296
12971209<!-- V.Smile Motion -->
12981210<!-- To be split into a separate list -->
12991211   <software name="cindervm" supported="no">
trunk/src/emu/bus/ieee488/c2040fdc.c
r242301r242302
232232      return true;
233233
234234   if(bit && cur_live.write_position < ARRAY_LENGTH(cur_live.write_buffer))
235      cur_live.write_buffer[cur_live.write_position++] = cur_live.tm - m_period;
235      cur_live.write_buffer[cur_live.write_position++] = cur_live.tm;
236236
237237   if (LOG) logerror("%s write bit %u (%u)\n", cur_live.tm.as_string(), cur_live.bit_counter, bit);
238238
r242301r242302
653653   cur_live.rw_sel = m_rw_sel;
654654   cur_live.pi = m_pi;
655655
656   pll_reset(cur_live.tm, attotime::from_double(0));
656   pll_reset(cur_live.tm, attotime::from_hz(0));
657657   checkpoint_live = cur_live;
658658   pll_save_checkpoint();
659659
trunk/src/emu/cpu/arcompact/arcompact.h
r242301r242302
3636
3737   // device_disasm_interface overrides
3838   virtual UINT32 disasm_min_opcode_bytes() const { return 2; }
39   virtual UINT32 disasm_max_opcode_bytes() const { return 8; }
39   virtual UINT32 disasm_max_opcode_bytes() const { return 4; }
4040   virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options);
4141
4242private:
trunk/src/emu/cpu/arcompact/arcompactdasm.c
r242301r242302
2424
2525/*****************************************************************************/
2626
27#define DASM_OPS_16 char *output, offs_t pc, UINT16 op, const UINT8* oprom
28#define DASM_OPS_32 char *output, offs_t pc, UINT32 op, const UINT8* oprom
29#define DASM_PARAMS output, pc, op, oprom
3027
31#define LIMM_REG 62
28static const char *basic[0x20] =
29{
30   /* opcode below are 32-bit mode */
31   /* 00 */ "Bcc",
32   /* 01 */ "BLcc/BRcc",
33   /* 02 */ "LD r+o",
34   /* 03 */ "ST r+o",
35   /* 04 */ "op a,b,c (basecase)", // basecase ops
36   /* 05 */ "op a,b,c (05 ARC ext)", // ARC processor specific extensions
37   /* 06 */ "op a,b,c (06 ARC ext)",
38   /* 07 */ "op a,b,c (07 User ext)", // User speciifc extensions
39   /* 08 */ "op a,b,c (08 User ext)",
40   /* 09 */ "op a,b,c (09 Market ext)", // Market specific extensions
41   /* 0a */ "op a,b,c (0a Market ext)",
42   /* 0b */ "op a,b,c (0b Market ext)",
43   /* opcodes below are 16-bit mode */
44   /* 0c */ "Load/Add reg-reg",
45   /* 0d */ "Add/Sub/Shft imm",
46   /* 0e */ "Mov/Cmp/Add",
47   /* 0f */ "op_S b,b,c", // single ops
48   /* 10 */ "LD_S",
49   /* 11 */ "LDB_S",
50   /* 12 */ "LDW_S",
51   /* 13 */ "LSW_S.X",
52   /* 14 */ "ST_S",
53   /* 15 */ "STB_S",
54   /* 16 */ "STW_S",
55   /* 17 */ "Shift/Sub/Bit",
56   /* 18 */ "Stack Instr",
57   /* 19 */ "GP Instr",
58   /* 1a */ "PCL Instr",
59   /* 1b */ "MOV_S",
60   /* 1c */ "ADD_S/CMP_S",
61   /* 1d */ "BRcc_S",
62   /* 1e */ "Bcc_S",
63   /* 1f */ "BL_S"
64};
3265
33#define GET_LIMM_32 \
34   limm = oprom[6] | (oprom[7] << 8); \
35   limm |= (oprom[4] << 16) | (oprom[5] << 24); \
36
37int arcompact_handle04_00_dasm(DASM_OPS_32);
38int arcompact_handle04_01_dasm(DASM_OPS_32);
39int arcompact_handle04_02_dasm(DASM_OPS_32);
40int arcompact_handle04_03_dasm(DASM_OPS_32);
41int arcompact_handle04_04_dasm(DASM_OPS_32);
42int arcompact_handle04_05_dasm(DASM_OPS_32);
43int arcompact_handle04_06_dasm(DASM_OPS_32);
44int arcompact_handle04_07_dasm(DASM_OPS_32);
45int arcompact_handle04_08_dasm(DASM_OPS_32);
46int arcompact_handle04_09_dasm(DASM_OPS_32);
47int arcompact_handle04_0a_dasm(DASM_OPS_32);
48int arcompact_handle04_0b_dasm(DASM_OPS_32);
49int arcompact_handle04_0c_dasm(DASM_OPS_32);
50int arcompact_handle04_0d_dasm(DASM_OPS_32);
51int arcompact_handle04_0e_dasm(DASM_OPS_32);
52int arcompact_handle04_0f_dasm(DASM_OPS_32);
53int arcompact_handle04_10_dasm(DASM_OPS_32);
54int arcompact_handle04_11_dasm(DASM_OPS_32);
55int arcompact_handle04_12_dasm(DASM_OPS_32);
56int arcompact_handle04_13_dasm(DASM_OPS_32);
57int arcompact_handle04_14_dasm(DASM_OPS_32);
58int arcompact_handle04_15_dasm(DASM_OPS_32);
59int arcompact_handle04_16_dasm(DASM_OPS_32);
60int arcompact_handle04_17_dasm(DASM_OPS_32);
61int arcompact_handle04_18_dasm(DASM_OPS_32);
62int arcompact_handle04_19_dasm(DASM_OPS_32);
63int arcompact_handle04_1a_dasm(DASM_OPS_32);
64int arcompact_handle04_1b_dasm(DASM_OPS_32);
65int arcompact_handle04_1c_dasm(DASM_OPS_32);
66int arcompact_handle04_1d_dasm(DASM_OPS_32);
67int arcompact_handle04_1e_dasm(DASM_OPS_32);
68int arcompact_handle04_1f_dasm(DASM_OPS_32);
69int arcompact_handle04_20_dasm(DASM_OPS_32);
70int arcompact_handle04_21_dasm(DASM_OPS_32);
71int arcompact_handle04_22_dasm(DASM_OPS_32);
72int arcompact_handle04_23_dasm(DASM_OPS_32);
73int arcompact_handle04_24_dasm(DASM_OPS_32);
74int arcompact_handle04_25_dasm(DASM_OPS_32);
75int arcompact_handle04_26_dasm(DASM_OPS_32);
76int arcompact_handle04_27_dasm(DASM_OPS_32);
77int arcompact_handle04_28_dasm(DASM_OPS_32);
78int arcompact_handle04_29_dasm(DASM_OPS_32);
79int arcompact_handle04_2a_dasm(DASM_OPS_32);
80int arcompact_handle04_2b_dasm(DASM_OPS_32);
81int arcompact_handle04_2c_dasm(DASM_OPS_32);
82int arcompact_handle04_2d_dasm(DASM_OPS_32);
83int arcompact_handle04_2e_dasm(DASM_OPS_32);
84int arcompact_handle04_2f_dasm(DASM_OPS_32);
85int arcompact_handle04_30_dasm(DASM_OPS_32);
86int arcompact_handle04_31_dasm(DASM_OPS_32);
87int arcompact_handle04_32_dasm(DASM_OPS_32);
88int arcompact_handle04_33_dasm(DASM_OPS_32);
89int arcompact_handle04_34_dasm(DASM_OPS_32);
90int arcompact_handle04_35_dasm(DASM_OPS_32);
91int arcompact_handle04_36_dasm(DASM_OPS_32);
92int arcompact_handle04_37_dasm(DASM_OPS_32);
93int arcompact_handle04_38_dasm(DASM_OPS_32);
94int arcompact_handle04_39_dasm(DASM_OPS_32);
95int arcompact_handle04_3a_dasm(DASM_OPS_32);
96int arcompact_handle04_3b_dasm(DASM_OPS_32);
97int arcompact_handle04_3c_dasm(DASM_OPS_32);
98int arcompact_handle04_3d_dasm(DASM_OPS_32);
99int arcompact_handle04_3e_dasm(DASM_OPS_32);
100int arcompact_handle04_3f_dasm(DASM_OPS_32);
101
102int arcompact_handle04_2f_00_dasm(DASM_OPS_32);
103int arcompact_handle04_2f_01_dasm(DASM_OPS_32);
104int arcompact_handle04_2f_02_dasm(DASM_OPS_32);
105int arcompact_handle04_2f_03_dasm(DASM_OPS_32);
106int arcompact_handle04_2f_04_dasm(DASM_OPS_32);
107int arcompact_handle04_2f_05_dasm(DASM_OPS_32);
108int arcompact_handle04_2f_06_dasm(DASM_OPS_32);
109int arcompact_handle04_2f_07_dasm(DASM_OPS_32);
110int arcompact_handle04_2f_08_dasm(DASM_OPS_32);
111int arcompact_handle04_2f_09_dasm(DASM_OPS_32);
112int arcompact_handle04_2f_0a_dasm(DASM_OPS_32);
113int arcompact_handle04_2f_0b_dasm(DASM_OPS_32);
114int arcompact_handle04_2f_0c_dasm(DASM_OPS_32);
115int arcompact_handle04_2f_0d_dasm(DASM_OPS_32);
116int arcompact_handle04_2f_0e_dasm(DASM_OPS_32);
117int arcompact_handle04_2f_0f_dasm(DASM_OPS_32);
118int arcompact_handle04_2f_10_dasm(DASM_OPS_32);
119int arcompact_handle04_2f_11_dasm(DASM_OPS_32);
120int arcompact_handle04_2f_12_dasm(DASM_OPS_32);
121int arcompact_handle04_2f_13_dasm(DASM_OPS_32);
122int arcompact_handle04_2f_14_dasm(DASM_OPS_32);
123int arcompact_handle04_2f_15_dasm(DASM_OPS_32);
124int arcompact_handle04_2f_16_dasm(DASM_OPS_32);
125int arcompact_handle04_2f_17_dasm(DASM_OPS_32);
126int arcompact_handle04_2f_18_dasm(DASM_OPS_32);
127int arcompact_handle04_2f_19_dasm(DASM_OPS_32);
128int arcompact_handle04_2f_1a_dasm(DASM_OPS_32);
129int arcompact_handle04_2f_1b_dasm(DASM_OPS_32);
130int arcompact_handle04_2f_1c_dasm(DASM_OPS_32);
131int arcompact_handle04_2f_1d_dasm(DASM_OPS_32);
132int arcompact_handle04_2f_1e_dasm(DASM_OPS_32);
133int arcompact_handle04_2f_1f_dasm(DASM_OPS_32);
134int arcompact_handle04_2f_20_dasm(DASM_OPS_32);
135int arcompact_handle04_2f_21_dasm(DASM_OPS_32);
136int arcompact_handle04_2f_22_dasm(DASM_OPS_32);
137int arcompact_handle04_2f_23_dasm(DASM_OPS_32);
138int arcompact_handle04_2f_24_dasm(DASM_OPS_32);
139int arcompact_handle04_2f_25_dasm(DASM_OPS_32);
140int arcompact_handle04_2f_26_dasm(DASM_OPS_32);
141int arcompact_handle04_2f_27_dasm(DASM_OPS_32);
142int arcompact_handle04_2f_28_dasm(DASM_OPS_32);
143int arcompact_handle04_2f_29_dasm(DASM_OPS_32);
144int arcompact_handle04_2f_2a_dasm(DASM_OPS_32);
145int arcompact_handle04_2f_2b_dasm(DASM_OPS_32);
146int arcompact_handle04_2f_2c_dasm(DASM_OPS_32);
147int arcompact_handle04_2f_2d_dasm(DASM_OPS_32);
148int arcompact_handle04_2f_2e_dasm(DASM_OPS_32);
149int arcompact_handle04_2f_2f_dasm(DASM_OPS_32);
150int arcompact_handle04_2f_30_dasm(DASM_OPS_32);
151int arcompact_handle04_2f_31_dasm(DASM_OPS_32);
152int arcompact_handle04_2f_32_dasm(DASM_OPS_32);
153int arcompact_handle04_2f_33_dasm(DASM_OPS_32);
154int arcompact_handle04_2f_34_dasm(DASM_OPS_32);
155int arcompact_handle04_2f_35_dasm(DASM_OPS_32);
156int arcompact_handle04_2f_36_dasm(DASM_OPS_32);
157int arcompact_handle04_2f_37_dasm(DASM_OPS_32);
158int arcompact_handle04_2f_38_dasm(DASM_OPS_32);
159int arcompact_handle04_2f_39_dasm(DASM_OPS_32);
160int arcompact_handle04_2f_3a_dasm(DASM_OPS_32);
161int arcompact_handle04_2f_3b_dasm(DASM_OPS_32);
162int arcompact_handle04_2f_3c_dasm(DASM_OPS_32);
163int arcompact_handle04_2f_3d_dasm(DASM_OPS_32);
164int arcompact_handle04_2f_3e_dasm(DASM_OPS_32);
165int arcompact_handle04_2f_3f_dasm(DASM_OPS_32);
166
167int arcompact_handle04_2f_3f_00_dasm(DASM_OPS_32);
168int arcompact_handle04_2f_3f_01_dasm(DASM_OPS_32);
169int arcompact_handle04_2f_3f_02_dasm(DASM_OPS_32);
170int arcompact_handle04_2f_3f_03_dasm(DASM_OPS_32);
171int arcompact_handle04_2f_3f_04_dasm(DASM_OPS_32);
172int arcompact_handle04_2f_3f_05_dasm(DASM_OPS_32);
173int arcompact_handle04_2f_3f_06_dasm(DASM_OPS_32);
174int arcompact_handle04_2f_3f_07_dasm(DASM_OPS_32);
175int arcompact_handle04_2f_3f_08_dasm(DASM_OPS_32);
176int arcompact_handle04_2f_3f_09_dasm(DASM_OPS_32);
177int arcompact_handle04_2f_3f_0a_dasm(DASM_OPS_32);
178int arcompact_handle04_2f_3f_0b_dasm(DASM_OPS_32);
179int arcompact_handle04_2f_3f_0c_dasm(DASM_OPS_32);
180int arcompact_handle04_2f_3f_0d_dasm(DASM_OPS_32);
181int arcompact_handle04_2f_3f_0e_dasm(DASM_OPS_32);
182int arcompact_handle04_2f_3f_0f_dasm(DASM_OPS_32);
183int arcompact_handle04_2f_3f_10_dasm(DASM_OPS_32);
184int arcompact_handle04_2f_3f_11_dasm(DASM_OPS_32);
185int arcompact_handle04_2f_3f_12_dasm(DASM_OPS_32);
186int arcompact_handle04_2f_3f_13_dasm(DASM_OPS_32);
187int arcompact_handle04_2f_3f_14_dasm(DASM_OPS_32);
188int arcompact_handle04_2f_3f_15_dasm(DASM_OPS_32);
189int arcompact_handle04_2f_3f_16_dasm(DASM_OPS_32);
190int arcompact_handle04_2f_3f_17_dasm(DASM_OPS_32);
191int arcompact_handle04_2f_3f_18_dasm(DASM_OPS_32);
192int arcompact_handle04_2f_3f_19_dasm(DASM_OPS_32);
193int arcompact_handle04_2f_3f_1a_dasm(DASM_OPS_32);
194int arcompact_handle04_2f_3f_1b_dasm(DASM_OPS_32);
195int arcompact_handle04_2f_3f_1c_dasm(DASM_OPS_32);
196int arcompact_handle04_2f_3f_1d_dasm(DASM_OPS_32);
197int arcompact_handle04_2f_3f_1e_dasm(DASM_OPS_32);
198int arcompact_handle04_2f_3f_1f_dasm(DASM_OPS_32);
199int arcompact_handle04_2f_3f_20_dasm(DASM_OPS_32);
200int arcompact_handle04_2f_3f_21_dasm(DASM_OPS_32);
201int arcompact_handle04_2f_3f_22_dasm(DASM_OPS_32);
202int arcompact_handle04_2f_3f_23_dasm(DASM_OPS_32);
203int arcompact_handle04_2f_3f_24_dasm(DASM_OPS_32);
204int arcompact_handle04_2f_3f_25_dasm(DASM_OPS_32);
205int arcompact_handle04_2f_3f_26_dasm(DASM_OPS_32);
206int arcompact_handle04_2f_3f_27_dasm(DASM_OPS_32);
207int arcompact_handle04_2f_3f_28_dasm(DASM_OPS_32);
208int arcompact_handle04_2f_3f_29_dasm(DASM_OPS_32);
209int arcompact_handle04_2f_3f_2a_dasm(DASM_OPS_32);
210int arcompact_handle04_2f_3f_2b_dasm(DASM_OPS_32);
211int arcompact_handle04_2f_3f_2c_dasm(DASM_OPS_32);
212int arcompact_handle04_2f_3f_2d_dasm(DASM_OPS_32);
213int arcompact_handle04_2f_3f_2e_dasm(DASM_OPS_32);
214int arcompact_handle04_2f_3f_2f_dasm(DASM_OPS_32);
215int arcompact_handle04_2f_3f_30_dasm(DASM_OPS_32);
216int arcompact_handle04_2f_3f_31_dasm(DASM_OPS_32);
217int arcompact_handle04_2f_3f_32_dasm(DASM_OPS_32);
218int arcompact_handle04_2f_3f_33_dasm(DASM_OPS_32);
219int arcompact_handle04_2f_3f_34_dasm(DASM_OPS_32);
220int arcompact_handle04_2f_3f_35_dasm(DASM_OPS_32);
221int arcompact_handle04_2f_3f_36_dasm(DASM_OPS_32);
222int arcompact_handle04_2f_3f_37_dasm(DASM_OPS_32);
223int arcompact_handle04_2f_3f_38_dasm(DASM_OPS_32);
224int arcompact_handle04_2f_3f_39_dasm(DASM_OPS_32);
225int arcompact_handle04_2f_3f_3a_dasm(DASM_OPS_32);
226int arcompact_handle04_2f_3f_3b_dasm(DASM_OPS_32);
227int arcompact_handle04_2f_3f_3c_dasm(DASM_OPS_32);
228int arcompact_handle04_2f_3f_3d_dasm(DASM_OPS_32);
229int arcompact_handle04_2f_3f_3e_dasm(DASM_OPS_32);
230int arcompact_handle04_2f_3f_3f_dasm(DASM_OPS_32);
231
232int arcompact_handle05_00_dasm(DASM_OPS_32);
233int arcompact_handle05_01_dasm(DASM_OPS_32);
234int arcompact_handle05_02_dasm(DASM_OPS_32);
235int arcompact_handle05_03_dasm(DASM_OPS_32);
236int arcompact_handle05_04_dasm(DASM_OPS_32);
237int arcompact_handle05_05_dasm(DASM_OPS_32);
238int arcompact_handle05_06_dasm(DASM_OPS_32);
239int arcompact_handle05_07_dasm(DASM_OPS_32);
240int arcompact_handle05_08_dasm(DASM_OPS_32);
241int arcompact_handle05_09_dasm(DASM_OPS_32);
242int arcompact_handle05_0a_dasm(DASM_OPS_32);
243int arcompact_handle05_0b_dasm(DASM_OPS_32);
244int arcompact_handle05_0c_dasm(DASM_OPS_32);
245int arcompact_handle05_0d_dasm(DASM_OPS_32);
246int arcompact_handle05_0e_dasm(DASM_OPS_32);
247int arcompact_handle05_0f_dasm(DASM_OPS_32);
248int arcompact_handle05_10_dasm(DASM_OPS_32);
249int arcompact_handle05_11_dasm(DASM_OPS_32);
250int arcompact_handle05_12_dasm(DASM_OPS_32);
251int arcompact_handle05_13_dasm(DASM_OPS_32);
252int arcompact_handle05_14_dasm(DASM_OPS_32);
253int arcompact_handle05_15_dasm(DASM_OPS_32);
254int arcompact_handle05_16_dasm(DASM_OPS_32);
255int arcompact_handle05_17_dasm(DASM_OPS_32);
256int arcompact_handle05_18_dasm(DASM_OPS_32);
257int arcompact_handle05_19_dasm(DASM_OPS_32);
258int arcompact_handle05_1a_dasm(DASM_OPS_32);
259int arcompact_handle05_1b_dasm(DASM_OPS_32);
260int arcompact_handle05_1c_dasm(DASM_OPS_32);
261int arcompact_handle05_1d_dasm(DASM_OPS_32);
262int arcompact_handle05_1e_dasm(DASM_OPS_32);
263int arcompact_handle05_1f_dasm(DASM_OPS_32);
264int arcompact_handle05_20_dasm(DASM_OPS_32);
265int arcompact_handle05_21_dasm(DASM_OPS_32);
266int arcompact_handle05_22_dasm(DASM_OPS_32);
267int arcompact_handle05_23_dasm(DASM_OPS_32);
268int arcompact_handle05_24_dasm(DASM_OPS_32);
269int arcompact_handle05_25_dasm(DASM_OPS_32);
270int arcompact_handle05_26_dasm(DASM_OPS_32);
271int arcompact_handle05_27_dasm(DASM_OPS_32);
272int arcompact_handle05_28_dasm(DASM_OPS_32);
273int arcompact_handle05_29_dasm(DASM_OPS_32);
274int arcompact_handle05_2a_dasm(DASM_OPS_32);
275int arcompact_handle05_2b_dasm(DASM_OPS_32);
276int arcompact_handle05_2c_dasm(DASM_OPS_32);
277int arcompact_handle05_2d_dasm(DASM_OPS_32);
278int arcompact_handle05_2e_dasm(DASM_OPS_32);
279int arcompact_handle05_2f_dasm(DASM_OPS_32);
280int arcompact_handle05_30_dasm(DASM_OPS_32);
281int arcompact_handle05_31_dasm(DASM_OPS_32);
282int arcompact_handle05_32_dasm(DASM_OPS_32);
283int arcompact_handle05_33_dasm(DASM_OPS_32);
284int arcompact_handle05_34_dasm(DASM_OPS_32);
285int arcompact_handle05_35_dasm(DASM_OPS_32);
286int arcompact_handle05_36_dasm(DASM_OPS_32);
287int arcompact_handle05_37_dasm(DASM_OPS_32);
288int arcompact_handle05_38_dasm(DASM_OPS_32);
289int arcompact_handle05_39_dasm(DASM_OPS_32);
290int arcompact_handle05_3a_dasm(DASM_OPS_32);
291int arcompact_handle05_3b_dasm(DASM_OPS_32);
292int arcompact_handle05_3c_dasm(DASM_OPS_32);
293int arcompact_handle05_3d_dasm(DASM_OPS_32);
294int arcompact_handle05_3e_dasm(DASM_OPS_32);
295int arcompact_handle05_3f_dasm(DASM_OPS_32);
296
297
298int arcompact_handle0c_00_dasm(DASM_OPS_16);
299int arcompact_handle0c_01_dasm(DASM_OPS_16);
300int arcompact_handle0c_02_dasm(DASM_OPS_16);
301int arcompact_handle0c_03_dasm(DASM_OPS_16);
302
303int arcompact_handle0d_00_dasm(DASM_OPS_16);
304int arcompact_handle0d_01_dasm(DASM_OPS_16);
305int arcompact_handle0d_02_dasm(DASM_OPS_16);
306int arcompact_handle0d_03_dasm(DASM_OPS_16);
307
308int arcompact_handle0e_00_dasm(DASM_OPS_16);
309int arcompact_handle0e_01_dasm(DASM_OPS_16);
310int arcompact_handle0e_02_dasm(DASM_OPS_16);
311int arcompact_handle0e_03_dasm(DASM_OPS_16);
312
313int arcompact_handle17_00_dasm(DASM_OPS_16);
314int arcompact_handle17_01_dasm(DASM_OPS_16);
315int arcompact_handle17_02_dasm(DASM_OPS_16);
316int arcompact_handle17_03_dasm(DASM_OPS_16);
317int arcompact_handle17_04_dasm(DASM_OPS_16);
318int arcompact_handle17_05_dasm(DASM_OPS_16);
319int arcompact_handle17_06_dasm(DASM_OPS_16);
320int arcompact_handle17_07_dasm(DASM_OPS_16);
321
322int arcompact_handle18_00_dasm(DASM_OPS_16);
323int arcompact_handle18_01_dasm(DASM_OPS_16);
324int arcompact_handle18_02_dasm(DASM_OPS_16);
325int arcompact_handle18_03_dasm(DASM_OPS_16);
326int arcompact_handle18_04_dasm(DASM_OPS_16);
327
328int arcompact_handle18_05_dasm(DASM_OPS_16);
329int arcompact_handle18_05_00_dasm(DASM_OPS_16);
330int arcompact_handle18_05_01_dasm(DASM_OPS_16);
331int arcompact_handle18_05_02_dasm(DASM_OPS_16);
332int arcompact_handle18_05_03_dasm(DASM_OPS_16);
333int arcompact_handle18_05_04_dasm(DASM_OPS_16);
334int arcompact_handle18_05_05_dasm(DASM_OPS_16);
335int arcompact_handle18_05_06_dasm(DASM_OPS_16);
336int arcompact_handle18_05_07_dasm(DASM_OPS_16);
337
338int arcompact_handle18_06_dasm(DASM_OPS_16);
339int arcompact_handle18_06_00_dasm(DASM_OPS_16);
340int arcompact_handle18_06_01_dasm(DASM_OPS_16);
341int arcompact_handle18_06_02_dasm(DASM_OPS_16);
342int arcompact_handle18_06_03_dasm(DASM_OPS_16);
343int arcompact_handle18_06_04_dasm(DASM_OPS_16);
344int arcompact_handle18_06_05_dasm(DASM_OPS_16);
345int arcompact_handle18_06_06_dasm(DASM_OPS_16);
346int arcompact_handle18_06_07_dasm(DASM_OPS_16);
347int arcompact_handle18_06_08_dasm(DASM_OPS_16);
348int arcompact_handle18_06_09_dasm(DASM_OPS_16);
349int arcompact_handle18_06_0a_dasm(DASM_OPS_16);
350int arcompact_handle18_06_0b_dasm(DASM_OPS_16);
351int arcompact_handle18_06_0c_dasm(DASM_OPS_16);
352int arcompact_handle18_06_0d_dasm(DASM_OPS_16);
353int arcompact_handle18_06_0e_dasm(DASM_OPS_16);
354int arcompact_handle18_06_0f_dasm(DASM_OPS_16);
355int arcompact_handle18_06_10_dasm(DASM_OPS_16);
356int arcompact_handle18_06_11_dasm(DASM_OPS_16);
357int arcompact_handle18_06_12_dasm(DASM_OPS_16);
358int arcompact_handle18_06_13_dasm(DASM_OPS_16);
359int arcompact_handle18_06_14_dasm(DASM_OPS_16);
360int arcompact_handle18_06_15_dasm(DASM_OPS_16);
361int arcompact_handle18_06_16_dasm(DASM_OPS_16);
362int arcompact_handle18_06_17_dasm(DASM_OPS_16);
363int arcompact_handle18_06_18_dasm(DASM_OPS_16);
364int arcompact_handle18_06_19_dasm(DASM_OPS_16);
365int arcompact_handle18_06_1a_dasm(DASM_OPS_16);
366int arcompact_handle18_06_1b_dasm(DASM_OPS_16);
367int arcompact_handle18_06_1c_dasm(DASM_OPS_16);
368int arcompact_handle18_06_1d_dasm(DASM_OPS_16);
369int arcompact_handle18_06_1e_dasm(DASM_OPS_16);
370int arcompact_handle18_06_1f_dasm(DASM_OPS_16);
371
372int arcompact_handle18_07_dasm(DASM_OPS_16);
373int arcompact_handle18_07_00_dasm(DASM_OPS_16);
374int arcompact_handle18_07_01_dasm(DASM_OPS_16);
375int arcompact_handle18_07_02_dasm(DASM_OPS_16);
376int arcompact_handle18_07_03_dasm(DASM_OPS_16);
377int arcompact_handle18_07_04_dasm(DASM_OPS_16);
378int arcompact_handle18_07_05_dasm(DASM_OPS_16);
379int arcompact_handle18_07_06_dasm(DASM_OPS_16);
380int arcompact_handle18_07_07_dasm(DASM_OPS_16);
381int arcompact_handle18_07_08_dasm(DASM_OPS_16);
382int arcompact_handle18_07_09_dasm(DASM_OPS_16);
383int arcompact_handle18_07_0a_dasm(DASM_OPS_16);
384int arcompact_handle18_07_0b_dasm(DASM_OPS_16);
385int arcompact_handle18_07_0c_dasm(DASM_OPS_16);
386int arcompact_handle18_07_0d_dasm(DASM_OPS_16);
387int arcompact_handle18_07_0e_dasm(DASM_OPS_16);
388int arcompact_handle18_07_0f_dasm(DASM_OPS_16);
389int arcompact_handle18_07_10_dasm(DASM_OPS_16);
390int arcompact_handle18_07_11_dasm(DASM_OPS_16);
391int arcompact_handle18_07_12_dasm(DASM_OPS_16);
392int arcompact_handle18_07_13_dasm(DASM_OPS_16);
393int arcompact_handle18_07_14_dasm(DASM_OPS_16);
394int arcompact_handle18_07_15_dasm(DASM_OPS_16);
395int arcompact_handle18_07_16_dasm(DASM_OPS_16);
396int arcompact_handle18_07_17_dasm(DASM_OPS_16);
397int arcompact_handle18_07_18_dasm(DASM_OPS_16);
398int arcompact_handle18_07_19_dasm(DASM_OPS_16);
399int arcompact_handle18_07_1a_dasm(DASM_OPS_16);
400int arcompact_handle18_07_1b_dasm(DASM_OPS_16);
401int arcompact_handle18_07_1c_dasm(DASM_OPS_16);
402int arcompact_handle18_07_1d_dasm(DASM_OPS_16);
403int arcompact_handle18_07_1e_dasm(DASM_OPS_16);
404int arcompact_handle18_07_1f_dasm(DASM_OPS_16);
405
406int arcompact_handle19_00_dasm(DASM_OPS_16);
407int arcompact_handle19_01_dasm(DASM_OPS_16);
408int arcompact_handle19_02_dasm(DASM_OPS_16);
409int arcompact_handle19_03_dasm(DASM_OPS_16);
410
411int arcompact_handle1c_00_dasm(DASM_OPS_16);
412int arcompact_handle1c_01_dasm(DASM_OPS_16);
413
414int arcompact_handle1d_00_dasm(DASM_OPS_16);
415int arcompact_handle1d_01_dasm(DASM_OPS_16);
416
417int arcompact_handle1e_00_dasm(DASM_OPS_16);
418int arcompact_handle1e_01_dasm(DASM_OPS_16);
419int arcompact_handle1e_02_dasm(DASM_OPS_16);
420int arcompact_handle1e_03_dasm(DASM_OPS_16);
421
422int arcompact_handle1e_03_00_dasm(DASM_OPS_16);
423int arcompact_handle1e_03_01_dasm(DASM_OPS_16);
424int arcompact_handle1e_03_02_dasm(DASM_OPS_16);
425int arcompact_handle1e_03_03_dasm(DASM_OPS_16);
426int arcompact_handle1e_03_04_dasm(DASM_OPS_16);
427int arcompact_handle1e_03_05_dasm(DASM_OPS_16);
428int arcompact_handle1e_03_06_dasm(DASM_OPS_16);
429int arcompact_handle1e_03_07_dasm(DASM_OPS_16);
430
431
432
43366// condition codes (basic ones are the same as arc
43467static const char *conditions[0x20] =
43568{
r242301r242302
487120   /* 0f */ "<BBIT1>"
488121};
489122
123static const char *table18[0x8] =
124{
125   /* 00 */ "LD_S (SP)",
126   /* 01 */ "LDB_S (SP)",
127   /* 02 */ "ST_S (SP)",
128   /* 03 */ "STB_S (SP)",
129   /* 04 */ "ADD_S (SP)",
130   /* 05 */ "ADD_S/SUB_S (SP)",
131   /* 06 */ "POP_S (SP)",
132   /* 07 */ "PUSH_S (SP)",
490133
134};
491135
492
493
494136static const char *table0f[0x20] =
495137{
496138   /* 00 */ "SOPs", // Sub Operation (another table..) ( table0f_00 )
r242301r242302
519161   /* 17 */ "0x17 <illegal>",
520162   /* 18 */ "ASL_S (multiple)",
521163   /* 19 */ "LSR_S (multiple)",
522/* 1a */ "ASR_S (multiple)",
523/* 1b */ "ASL_S (single)",
524/* 1c */ "LSR_S (single)",
525/* 1d */ "ASR_S (single)",
526/* 1e */ "TRAP (not a5?)",
527/* 1f */ "BRK_S" // 0x7fff only?
164   /* 1a */ "ASR_S (multiple)",
165   /* 1b */ "ASL_S (single)",
166   /* 1c */ "LSR_S (single)",
167   /* 1d */ "ASR_S (single)",
168   /* 1e */ "TRAP (not a5?)",
169   /* 1f */ "BRK_S" // 0x7fff only?
528170};
529171
530172static const char *table0f_00[0x8] =
r242301r242302
553195
554196#define ARCOMPACT_OPERATION ((op & 0xf800) >> 11)
555197
556
557int arcompact_handle00_dasm(DASM_OPS_32)
198CPU_DISASSEMBLE(arcompact)
558199{
559   if (op & 0x00010000)
560   { // Branch Unconditionally Far
561      // 00000 ssssssssss 1  SSSSSSSSSS N R TTTT
562      INT32 address = (op & 0x07fe0000) >> 17;
563      address |= ((op & 0x0000ffc0) >> 6) << 10;
564      address |= ((op & 0x0000000f) >> 0) << 20;
565      if (address & 0x800000) address = -(address & 0x7fffff);
200   int size = 2;
566201
567      print("B %08x (%08x)", pc + (address * 2) + 2, op & ~0xffffffcf);
568   }
569   else
570   { // Branch Conditionally
571      // 00000 ssssssssss 0 SSSSSSSSSS N QQQQQ
572      INT32 address = (op & 0x07fe0000) >> 17;
573      address |= ((op & 0x0000ffc0) >> 6) << 10;
574      if (address & 0x800000) address = -(address & 0x7fffff);
202   UINT32 op = oprom[2] | (oprom[3] << 8);
203   output = buffer;
575204
576      UINT8 condition = op & 0x0000001f;
205   UINT8 instruction = ARCOMPACT_OPERATION;
577206
578      print("B(%s) %08x (%08x)", conditions[condition], pc + (address * 2) + 2, op & ~0xffffffdf);
579   }
580   return 4;
581}
582
583int arcompact_handle01_dasm(DASM_OPS_32)
584{
585   int size = 4;
586
587   if (op & 0x00010000)
207   if (instruction < 0x0c)
588208   {
589      if (op & 0x00000010)
590      { // Branch on Compare / Bit Test - Register-Immediate
591         // 00001 bbb sssssss 1 S BBB UUUUUU N 1 iiii
592         UINT8 subinstr = op & 0x0000000f;
593         INT32 address = (op & 0x00fe0000) >> 17;
594         address |= ((op & 0x00008000) >> 15) << 7;
595         if (address & 0x80) address = -(address & 0x7f);
209      size = 4;
210      op <<= 16;
211      op |= oprom[0] | (oprom[1] << 8);
596212
597
598         print("%s (reg-imm) %08x (%08x)", table01_01_0x[subinstr], pc + (address * 2) + 4, op & ~0xf8fe800f);
599
600
601      }
602      else
213      switch (instruction)
603214      {
604         // Branch on Compare / Bit Test - Register-Register
605         // 00001 bbb sssssss 1 S BBB CCCCCC N 0 iiii
606         UINT8 subinstr = op & 0x0000000f;
607         INT32 address = (op & 0x00fe0000) >> 17;
608         address |= ((op & 0x00008000) >> 15) << 7;
609         if (address & 0x80) address = -(address & 0x7f);
215         case 0x00:
216            if (op & 0x00010000)
217            { // Branch Unconditionally Far
218              // 00000 ssssssssss 1  SSSSSSSSSS N R TTTT
219               INT32 address =   (op & 0x07fe0000) >> 17;
220               address |=        ((op & 0x0000ffc0) >> 6) << 10;
221               address |=        ((op & 0x0000000f) >> 0) << 20;
222               if (address & 0x800000) address = -(address&0x7fffff);   
610223
611         int c = (op & 0x00000fc0)>> 6;
612         int b = (op & 0x07000000) >> 24;
613         b |=   ((op & 0x00007000) >> 12) << 3;
614
615         op &= ~0x07007fe0;
616
617         if ((b != LIMM_REG) && (c != LIMM_REG))
618         {
619            print("%s (reg-reg) (r%d) (r%d) %08x (%08x)", table01_01_0x[subinstr], b, c, pc + (address * 2) + 4, op & ~0xf8fe800f);
620         }
621         else
622         {
623            UINT32 limm;
624            GET_LIMM_32;
625            size = 8;
626
627            if ((b == LIMM_REG) && (c != LIMM_REG))
628            {
629               print("%s (reg-reg) (%08x) (r%d) %08x (%08x)", table01_01_0x[subinstr], limm, c, pc + (address * 2) + 4, op & ~0xf8fe800f);
224               print("B %08x (%08x)",  pc + (address *2) + 2, op & ~0xffffffcf );
630225            }
631            else if ((c == LIMM_REG) && (b != LIMM_REG))
632            {
633               print("%s (reg-reg) (r%d) (%08x) %08x (%08x)", table01_01_0x[subinstr], b, limm, pc + (address * 2) + 4, op & ~0xf8fe800f);
634            }
635226            else
636            {
637               // b and c are LIMM? invalid??
638               print("%s (reg-reg) (%08x) (%08x) (illegal?) %08x (%08x)", table01_01_0x[subinstr], limm, limm, pc + (address * 2) + 4, op & ~0xf8fe800f);
227            { // Branch Conditionally
228              // 00000 ssssssssss 0 SSSSSSSSSS N QQQQQ
229               INT32 address =   (op & 0x07fe0000) >> 17;
230               address |=        ((op & 0x0000ffc0) >> 6) << 10;
231               if (address & 0x800000) address = -(address&0x7fffff);   
639232
640            }
641         }
233               UINT8 condition = op & 0x0000001f;
642234
643      }
235               print("B(%s) %08x (%08x)", conditions[condition], pc + (address *2) + 2, op & ~0xffffffdf );
644236
645   }
646   else
647   {
648      if (op & 0x00020000)
649      { // Branch and Link Unconditionally Far
650         // 00001 sssssssss 10  SSSSSSSSSS N R TTTT
651         INT32 address =   (op & 0x07fc0000) >> 17;
652         address |=        ((op & 0x0000ffc0) >> 6) << 10;
653         address |=        ((op & 0x0000000f) >> 0) << 20;
654         if (address & 0x800000) address = -(address&0x7fffff);   
237            }
655238
656         print("BL %08x (%08x)",  pc + (address *2) + 2, op & ~0xffffffcf );
657      }
658      else
659      { // Branch and Link Conditionally
660         // 00001 sssssssss 00 SSSSSSSSSS N QQQQQ
661         INT32 address =   (op & 0x07fc0000) >> 17;
662         address |=        ((op & 0x0000ffc0) >> 6) << 10;
663         if (address & 0x800000) address = -(address&0x7fffff);   
239            break;
664240
665         UINT8 condition = op & 0x0000001f;
241         case 0x01:
242            if (op & 0x00010000)
243            {
244               if (op & 0x00000010)
245               { // Branch on Compare / Bit Test - Register-Immediate
246                  // 00001 bbb sssssss 1 S BBB UUUUUU N 1 iiii
247                  UINT8 subinstr = op & 0x0000000f;
248                  INT32 address =    (op & 0x00fe0000) >> 17;
249                  address |=        ((op & 0x00008000) >> 15) << 7;
250                  if (address & 0x80) address = -(address&0x7f);   
666251
667         print("BL(%s) %08x (%08x)", conditions[condition], pc + (address *2) + 2, op & ~0xffffffdf );
252                 
253                  print("%s (reg-imm) %08x (%08x)", table01_01_0x[subinstr], pc + (address *2) + 4, op & ~0xf8fe800f);
668254
669      }
670255
671   }
672   return size;
673}
256               }
257               else
258               {
259                  // Branch on Compare / Bit Test - Register-Register
260                  // 00001 bbb sssssss 1 S BBB CCCCCC N 0 iiii
261                  UINT8 subinstr = op & 0x0000000f;
262                  INT32 address =    (op & 0x00fe0000) >> 17;
263                  address |=        ((op & 0x00008000) >> 15) << 7;
264                  if (address & 0x80) address = -(address&0x7f);   
674265
675int arcompact_handle02_dasm(DASM_OPS_32)
676{
677   // bitpos
678   // 11111 111 11111111 0 000 0 00 00 0 000000
679   // fedcb a98 76543210 f edc b a9 87 6 543210
680   // fields
681   // 00010 bbb ssssssss S BBB D aa ZZ X AAAAAA
682#if 0   
683   int A = (op & 0x0000003f >> 0);  op &= ~0x0000003f;
684   int X = (op & 0x00000040 >> 6);  op &= ~0x00000040;
685   int Z = (op & 0x00000180 >> 7);  op &= ~0x00000180;
686   int a = (op & 0x00000600 >> 9);  op &= ~0x00000600;
687   int D = (op & 0x00000800 >> 11); op &= ~0x00000800;
688   int B = (op & 0x00007000 >> 12); op &= ~0x00007000;
689   int S = (op & 0x00008000 >> 15); op &= ~0x00008000;
690   int s = (op & 0x00ff0000 >> 16); op &= ~0x00ff0000;
691   int b = (op & 0x07000000 >> 24); op &= ~0x07000000;
692#endif
266                  print("%s (reg-reg) %08x (%08x)", table01_01_0x[subinstr], pc + (address *2) + 4, op & ~0xf8fe800f);
693267
694   print("LD r+o (%08x)", op );
695   return 4;
696}
268               }
697269
698int arcompact_handle03_dasm(DASM_OPS_32)
699{
700   // bitpos
701   // 11111 111 11111111 0 000 000000 0 00 00 0
702   // fedcb a98 76543210 f edc ba9876 5 43 21 0
703   // fields
704   // 00011 bbb ssssssss S BBB CCCCCC D aa ZZ R
270            }
271            else
272            {
273               if (op & 0x00020000)
274               { // Branch and Link Unconditionally Far
275                 // 00001 sssssssss 10  SSSSSSSSSS N R TTTT
276                  INT32 address =   (op & 0x07fc0000) >> 17;
277                  address |=        ((op & 0x0000ffc0) >> 6) << 10;
278                  address |=        ((op & 0x0000000f) >> 0) << 20;
279                  if (address & 0x800000) address = -(address&0x7fffff);   
705280
706   print("ST r+o (%08x)", op );
707   return 4;
708}
281                  print("BL %08x (%08x)",  pc + (address *2) + 2, op & ~0xffffffcf );
282               }
283               else
284               { // Branch and Link Conditionally
285                 // 00001 sssssssss 00 SSSSSSSSSS N QQQQQ
286                  INT32 address =   (op & 0x07fc0000) >> 17;
287                  address |=        ((op & 0x0000ffc0) >> 6) << 10;
288                  if (address & 0x800000) address = -(address&0x7fffff);   
709289
710int arcompact_handle04_dasm(DASM_OPS_32)
711{
712   int size = 4;
713   // General Operations
290                  UINT8 condition = op & 0x0000001f;
714291
715   // bitpos
716   // 11111 111 11 111111 0 000 000000 0 00000
717   // fedcb a98 76 543210 f edc ba9876 5 43210
718   //
719   // 00100 bbb 00 iiiiii F BBB CCCCCC A AAAAA   General Operations *UN*Conditional Register to Register
720   // 00100 bbb 01 iiiiii F BBB UUUUUU A AAAAA   General Operations *UN*Conditional Register (Unsigned 6-bit IMM)
721   // 00100 bbb 10 iiiiii F BBB ssssss S SSSSS   General Operations *UN*Conditional Register (Signed 12-bit IMM)
722   
723   // 00100 bbb 11 iiiiii F BBB CCCCCC 0 QQQQQ   General Operations Conditional Register
724   // 00100 bbb 11 iiiiii F BBB UUUUUU 1 QQQQQ   General Operations Conditional Register (Unsigned 6-bit IMM)
725   UINT8 subinstr = (op & 0x003f0000) >> 16;
726   op &= ~0x003f0000;
292                  print("BL(%s) %08x (%08x)", conditions[condition], pc + (address *2) + 2, op & ~0xffffffdf );
727293
728   switch (subinstr)
729   {
730      case 0x00: size = arcompact_handle04_00_dasm(DASM_PARAMS); break; // ADD
731      case 0x01: size = arcompact_handle04_01_dasm(DASM_PARAMS); break; // ADC
732      case 0x02: size = arcompact_handle04_02_dasm(DASM_PARAMS); break; // SUB
733      case 0x03: size = arcompact_handle04_03_dasm(DASM_PARAMS); break; // SBC
734      case 0x04: size = arcompact_handle04_04_dasm(DASM_PARAMS); break; // AND
735      case 0x05: size = arcompact_handle04_05_dasm(DASM_PARAMS); break; // OR
736      case 0x06: size = arcompact_handle04_06_dasm(DASM_PARAMS); break; // BIC
737      case 0x07: size = arcompact_handle04_07_dasm(DASM_PARAMS); break; // XOR
738      case 0x08: size = arcompact_handle04_08_dasm(DASM_PARAMS); break; // MAX
739      case 0x09: size = arcompact_handle04_09_dasm(DASM_PARAMS); break; // MIN
740      case 0x0a: size = arcompact_handle04_0a_dasm(DASM_PARAMS); break; // MOV
741      case 0x0b: size = arcompact_handle04_0b_dasm(DASM_PARAMS); break; // TST
742      case 0x0c: size = arcompact_handle04_0c_dasm(DASM_PARAMS); break; // CMP
743      case 0x0d: size = arcompact_handle04_0d_dasm(DASM_PARAMS); break; // RCMP
744      case 0x0e: size = arcompact_handle04_0e_dasm(DASM_PARAMS); break; // RSUB
745      case 0x0f: size = arcompact_handle04_0f_dasm(DASM_PARAMS); break; // BSET
746      case 0x10: size = arcompact_handle04_10_dasm(DASM_PARAMS); break; // BCLR
747      case 0x11: size = arcompact_handle04_11_dasm(DASM_PARAMS); break; // BTST
748      case 0x12: size = arcompact_handle04_12_dasm(DASM_PARAMS); break; // BXOR
749      case 0x13: size = arcompact_handle04_13_dasm(DASM_PARAMS); break; // BMSK
750      case 0x14: size = arcompact_handle04_14_dasm(DASM_PARAMS); break; // ADD1
751      case 0x15: size = arcompact_handle04_15_dasm(DASM_PARAMS); break; // ADD2
752      case 0x16: size = arcompact_handle04_16_dasm(DASM_PARAMS); break; // ADD3
753      case 0x17: size = arcompact_handle04_17_dasm(DASM_PARAMS); break; // SUB1
754      case 0x18: size = arcompact_handle04_18_dasm(DASM_PARAMS); break; // SUB2
755      case 0x19: size = arcompact_handle04_19_dasm(DASM_PARAMS); break; // SUB3
756      case 0x1a: size = arcompact_handle04_1a_dasm(DASM_PARAMS); break; // MPY *
757      case 0x1b: size = arcompact_handle04_1b_dasm(DASM_PARAMS); break; // MPYH *
758      case 0x1c: size = arcompact_handle04_1c_dasm(DASM_PARAMS); break; // MPYHU *
759      case 0x1d: size = arcompact_handle04_1d_dasm(DASM_PARAMS); break; // MPYU *
760      case 0x1e: size = arcompact_handle04_1e_dasm(DASM_PARAMS); break; // illegal
761      case 0x1f: size = arcompact_handle04_1f_dasm(DASM_PARAMS); break; // illegal
762      case 0x20: size = arcompact_handle04_20_dasm(DASM_PARAMS); break; // Jcc
763      case 0x21: size = arcompact_handle04_21_dasm(DASM_PARAMS); break; // Jcc.D
764      case 0x22: size = arcompact_handle04_22_dasm(DASM_PARAMS); break; // JLcc
765      case 0x23: size = arcompact_handle04_23_dasm(DASM_PARAMS); break; // JLcc.D
766      case 0x24: size = arcompact_handle04_24_dasm(DASM_PARAMS); break; // illegal
767      case 0x25: size = arcompact_handle04_25_dasm(DASM_PARAMS); break; // illegal
768      case 0x26: size = arcompact_handle04_26_dasm(DASM_PARAMS); break; // illegal
769      case 0x27: size = arcompact_handle04_27_dasm(DASM_PARAMS); break; // illegal
770      case 0x28: size = arcompact_handle04_28_dasm(DASM_PARAMS); break; // LPcc
771      case 0x29: size = arcompact_handle04_29_dasm(DASM_PARAMS); break; // FLAG
772      case 0x2a: size = arcompact_handle04_2a_dasm(DASM_PARAMS); break; // LR
773      case 0x2b: size = arcompact_handle04_2b_dasm(DASM_PARAMS); break; // SR
774      case 0x2c: size = arcompact_handle04_2c_dasm(DASM_PARAMS); break; // illegal
775      case 0x2d: size = arcompact_handle04_2d_dasm(DASM_PARAMS); break; // illegal
776      case 0x2e: size = arcompact_handle04_2e_dasm(DASM_PARAMS); break; // illegal
777      case 0x2f: size = arcompact_handle04_2f_dasm(DASM_PARAMS); break; // Sub Opcode
778      case 0x30: size = arcompact_handle04_30_dasm(DASM_PARAMS); break; // LD r-r
779      case 0x31: size = arcompact_handle04_31_dasm(DASM_PARAMS); break; // LD r-r
780      case 0x32: size = arcompact_handle04_32_dasm(DASM_PARAMS); break; // LD r-r
781      case 0x33: size = arcompact_handle04_33_dasm(DASM_PARAMS); break; // LD r-r
782      case 0x34: size = arcompact_handle04_34_dasm(DASM_PARAMS); break; // LD r-r
783      case 0x35: size = arcompact_handle04_35_dasm(DASM_PARAMS); break; // LD r-r
784      case 0x36: size = arcompact_handle04_36_dasm(DASM_PARAMS); break; // LD r-r
785      case 0x37: size = arcompact_handle04_37_dasm(DASM_PARAMS); break; // LD r-r
786      case 0x38: size = arcompact_handle04_38_dasm(DASM_PARAMS); break; // illegal
787      case 0x39: size = arcompact_handle04_39_dasm(DASM_PARAMS); break; // illegal
788      case 0x3a: size = arcompact_handle04_3a_dasm(DASM_PARAMS); break; // illegal
789      case 0x3b: size = arcompact_handle04_3b_dasm(DASM_PARAMS); break; // illegal
790      case 0x3c: size = arcompact_handle04_3c_dasm(DASM_PARAMS); break; // illegal
791      case 0x3d: size = arcompact_handle04_3d_dasm(DASM_PARAMS); break; // illegal
792      case 0x3e: size = arcompact_handle04_3e_dasm(DASM_PARAMS); break; // illegal
793      case 0x3f: size = arcompact_handle04_3f_dasm(DASM_PARAMS); break; // illegal
794   }
294               }
795295
796   return size;
797}
296            }
297            break;
798298
799int arcompact_handle04_00_dasm(DASM_OPS_32)  { print("ADD (%08x)", op); return 4;}
800int arcompact_handle04_01_dasm(DASM_OPS_32)  { print("ADC (%08x)", op); return 4;}
801int arcompact_handle04_02_dasm(DASM_OPS_32)  { print("SUB (%08x)", op); return 4;}
802int arcompact_handle04_03_dasm(DASM_OPS_32)  { print("SBC (%08x)", op); return 4;}
803int arcompact_handle04_04_dasm(DASM_OPS_32)  { print("AND (%08x)", op); return 4;}
804int arcompact_handle04_05_dasm(DASM_OPS_32)  { print("OR (%08x)", op); return 4;}
805int arcompact_handle04_06_dasm(DASM_OPS_32)  { print("BIC (%08x)", op); return 4;}
806int arcompact_handle04_07_dasm(DASM_OPS_32)  { print("XOR (%08x)", op); return 4;}
807int arcompact_handle04_08_dasm(DASM_OPS_32)  { print("MAX (%08x)", op); return 4;}
808int arcompact_handle04_09_dasm(DASM_OPS_32)  { print("MIN (%08x)", op); return 4;}
809int arcompact_handle04_0a_dasm(DASM_OPS_32)  { print("MOV (%08x)", op); return 4;}
810int arcompact_handle04_0b_dasm(DASM_OPS_32)  { print("TST (%08x)", op); return 4;}
811int arcompact_handle04_0c_dasm(DASM_OPS_32)  { print("CMP (%08x)", op); return 4;}
812int arcompact_handle04_0d_dasm(DASM_OPS_32)  { print("RCMP (%08x)", op); return 4;}
813int arcompact_handle04_0e_dasm(DASM_OPS_32)  { print("RSUB (%08x)", op); return 4;}
814int arcompact_handle04_0f_dasm(DASM_OPS_32)  { print("BSET (%08x)", op); return 4;}
815int arcompact_handle04_10_dasm(DASM_OPS_32)  { print("BCLR (%08x)", op); return 4;}
816int arcompact_handle04_11_dasm(DASM_OPS_32)  { print("BTST (%08x)", op); return 4;}
817int arcompact_handle04_12_dasm(DASM_OPS_32)  { print("BXOR (%08x)", op); return 4;}
818int arcompact_handle04_13_dasm(DASM_OPS_32)  { print("BMSK (%08x)", op); return 4;}
819int arcompact_handle04_14_dasm(DASM_OPS_32)  { print("ADD1 (%08x)", op); return 4;}
820int arcompact_handle04_15_dasm(DASM_OPS_32)  { print("ADD2 (%08x)", op); return 4;}
821int arcompact_handle04_16_dasm(DASM_OPS_32)  { print("ADD3 (%08x)", op); return 4;}
822int arcompact_handle04_17_dasm(DASM_OPS_32)  { print("SUB1 (%08x)", op); return 4;}
823int arcompact_handle04_18_dasm(DASM_OPS_32)  { print("SUB2 (%08x)", op); return 4;}
824int arcompact_handle04_19_dasm(DASM_OPS_32)  { print("SUB3 (%08x)", op); return 4;}
825int arcompact_handle04_1a_dasm(DASM_OPS_32)  { print("MPY (%08x)", op); return 4;} // *
826int arcompact_handle04_1b_dasm(DASM_OPS_32)  { print("MPYH (%08x)", op); return 4;} // *
827int arcompact_handle04_1c_dasm(DASM_OPS_32)  { print("MPYHU (%08x)", op); return 4;} // *
828int arcompact_handle04_1d_dasm(DASM_OPS_32)  { print("MPYU (%08x)", op); return 4;} // *
829int arcompact_handle04_1e_dasm(DASM_OPS_32)  { print("<illegal 0x04_1e> (%08x)", op); return 4;}
830int arcompact_handle04_1f_dasm(DASM_OPS_32)  { print("<illegal 0x04_1f> (%08x)", op); return 4;}
299         default:
300            print("%s (%08x)", basic[instruction], op & ~0xf8000000 );
301            break;
831302
303      }
832304
833
834int arcompact_handle04_20_dasm(DASM_OPS_32)
835{
836   // todo, other bits (in none long immediate mode at least)
837
838   int size = 4;
839   int C = (op & 0x00000fc0) >> 6;
840   UINT8 condition = op & 0x0000001f;
841
842   op &= ~0x00000fc0;
843   
844   if (C == LIMM_REG)
845   {
846      UINT32 limm;
847      GET_LIMM_32;
848      size = 8;
849305     
850      print("J(%s) %08x (%08x)", conditions[condition], limm, op);
851306   }
852307   else
853   {
854      print("J(%s) (r%d) (%08x)", conditions[condition], C, op);
855   }
308   {   
309      size = 2;
856310
857   return size;
858}
859
860
861
862int arcompact_handle04_21_dasm(DASM_OPS_32)  { print("Jcc.D (%08x)", op); return 4;}
863int arcompact_handle04_22_dasm(DASM_OPS_32)  { print("JLcc (%08x)", op); return 4;}
864int arcompact_handle04_23_dasm(DASM_OPS_32)  { print("JLcc.D (%08x)", op); return 4;}
865int arcompact_handle04_24_dasm(DASM_OPS_32)  { print("<illegal 0x04_24> (%08x)", op); return 4;}
866int arcompact_handle04_25_dasm(DASM_OPS_32)  { print("<illegal 0x04_25> (%08x)", op); return 4;}
867int arcompact_handle04_26_dasm(DASM_OPS_32)  { print("<illegal 0x04_26> (%08x)", op); return 4;}
868int arcompact_handle04_27_dasm(DASM_OPS_32)  { print("<illegal 0x04_27> (%08x)", op); return 4;}
869int arcompact_handle04_28_dasm(DASM_OPS_32)  { print("LPcc (%08x)", op); return 4;}
870int arcompact_handle04_29_dasm(DASM_OPS_32)  { print("FLAG (%08x)", op); return 4;}
871int arcompact_handle04_2a_dasm(DASM_OPS_32)  { print("LR (%08x)", op); return 4;}
872int arcompact_handle04_2b_dasm(DASM_OPS_32)  { print("SR (%08x)", op); return 4;}
873int arcompact_handle04_2c_dasm(DASM_OPS_32)  { print("<illegal 0x04_2c> (%08x)", op); return 4;}
874int arcompact_handle04_2d_dasm(DASM_OPS_32)  { print("<illegal 0x04_2d> (%08x)", op); return 4;}
875int arcompact_handle04_2e_dasm(DASM_OPS_32)  { print("<illegal 0x04_2e> (%08x)", op); return 4;}
876
877int arcompact_handle04_2f_dasm(DASM_OPS_32)
878{
879   int size = 4;
880   UINT8 subinstr2 = (op & 0x0000003f) >> 0;
881   op &= ~0x0000003f;
882
883   switch (subinstr2)
884   {
885      case 0x00: size = arcompact_handle04_2f_00_dasm(DASM_PARAMS); break; // ASL
886      case 0x01: size = arcompact_handle04_2f_01_dasm(DASM_PARAMS); break; // ASR
887      case 0x02: size = arcompact_handle04_2f_02_dasm(DASM_PARAMS); break; // LSR
888      case 0x03: size = arcompact_handle04_2f_03_dasm(DASM_PARAMS); break; // ROR
889      case 0x04: size = arcompact_handle04_2f_04_dasm(DASM_PARAMS); break; // RCC
890      case 0x05: size = arcompact_handle04_2f_05_dasm(DASM_PARAMS); break; // SEXB
891      case 0x06: size = arcompact_handle04_2f_06_dasm(DASM_PARAMS); break; // SEXW
892      case 0x07: size = arcompact_handle04_2f_07_dasm(DASM_PARAMS); break; // EXTB
893      case 0x08: size = arcompact_handle04_2f_08_dasm(DASM_PARAMS); break; // EXTW
894      case 0x09: size = arcompact_handle04_2f_09_dasm(DASM_PARAMS); break; // ABS
895      case 0x0a: size = arcompact_handle04_2f_0a_dasm(DASM_PARAMS); break; // NOT
896      case 0x0b: size = arcompact_handle04_2f_0b_dasm(DASM_PARAMS); break; // RLC
897      case 0x0c: size = arcompact_handle04_2f_0c_dasm(DASM_PARAMS); break; // EX
898      case 0x0d: size = arcompact_handle04_2f_0d_dasm(DASM_PARAMS); break; // illegal
899      case 0x0e: size = arcompact_handle04_2f_0e_dasm(DASM_PARAMS); break; // illegal
900      case 0x0f: size = arcompact_handle04_2f_0f_dasm(DASM_PARAMS); break; // illegal
901      case 0x10: size = arcompact_handle04_2f_10_dasm(DASM_PARAMS); break; // illegal
902      case 0x11: size = arcompact_handle04_2f_11_dasm(DASM_PARAMS); break; // illegal
903      case 0x12: size = arcompact_handle04_2f_12_dasm(DASM_PARAMS); break; // illegal
904      case 0x13: size = arcompact_handle04_2f_13_dasm(DASM_PARAMS); break; // illegal
905      case 0x14: size = arcompact_handle04_2f_14_dasm(DASM_PARAMS); break; // illegal
906      case 0x15: size = arcompact_handle04_2f_15_dasm(DASM_PARAMS); break; // illegal
907      case 0x16: size = arcompact_handle04_2f_16_dasm(DASM_PARAMS); break; // illegal
908      case 0x17: size = arcompact_handle04_2f_17_dasm(DASM_PARAMS); break; // illegal
909      case 0x18: size = arcompact_handle04_2f_18_dasm(DASM_PARAMS); break; // illegal
910      case 0x19: size = arcompact_handle04_2f_19_dasm(DASM_PARAMS); break; // illegal
911      case 0x1a: size = arcompact_handle04_2f_1a_dasm(DASM_PARAMS); break; // illegal
912      case 0x1b: size = arcompact_handle04_2f_1b_dasm(DASM_PARAMS); break; // illegal
913      case 0x1c: size = arcompact_handle04_2f_1c_dasm(DASM_PARAMS); break; // illegal
914      case 0x1d: size = arcompact_handle04_2f_1d_dasm(DASM_PARAMS); break; // illegal
915      case 0x1e: size = arcompact_handle04_2f_1e_dasm(DASM_PARAMS); break; // illegal
916      case 0x1f: size = arcompact_handle04_2f_1f_dasm(DASM_PARAMS); break; // illegal
917      case 0x20: size = arcompact_handle04_2f_20_dasm(DASM_PARAMS); break; // illegal
918      case 0x21: size = arcompact_handle04_2f_21_dasm(DASM_PARAMS); break; // illegal
919      case 0x22: size = arcompact_handle04_2f_22_dasm(DASM_PARAMS); break; // illegal
920      case 0x23: size = arcompact_handle04_2f_23_dasm(DASM_PARAMS); break; // illegal
921      case 0x24: size = arcompact_handle04_2f_24_dasm(DASM_PARAMS); break; // illegal
922      case 0x25: size = arcompact_handle04_2f_25_dasm(DASM_PARAMS); break; // illegal
923      case 0x26: size = arcompact_handle04_2f_26_dasm(DASM_PARAMS); break; // illegal
924      case 0x27: size = arcompact_handle04_2f_27_dasm(DASM_PARAMS); break; // illegal
925      case 0x28: size = arcompact_handle04_2f_28_dasm(DASM_PARAMS); break; // illegal
926      case 0x29: size = arcompact_handle04_2f_29_dasm(DASM_PARAMS); break; // illegal
927      case 0x2a: size = arcompact_handle04_2f_2a_dasm(DASM_PARAMS); break; // illegal
928      case 0x2b: size = arcompact_handle04_2f_2b_dasm(DASM_PARAMS); break; // illegal
929      case 0x2c: size = arcompact_handle04_2f_2c_dasm(DASM_PARAMS); break; // illegal
930      case 0x2d: size = arcompact_handle04_2f_2d_dasm(DASM_PARAMS); break; // illegal
931      case 0x2e: size = arcompact_handle04_2f_2e_dasm(DASM_PARAMS); break; // illegal
932      case 0x2f: size = arcompact_handle04_2f_2f_dasm(DASM_PARAMS); break; // illegal
933      case 0x30: size = arcompact_handle04_2f_30_dasm(DASM_PARAMS); break; // illegal
934      case 0x31: size = arcompact_handle04_2f_31_dasm(DASM_PARAMS); break; // illegal
935      case 0x32: size = arcompact_handle04_2f_32_dasm(DASM_PARAMS); break; // illegal
936      case 0x33: size = arcompact_handle04_2f_33_dasm(DASM_PARAMS); break; // illegal
937      case 0x34: size = arcompact_handle04_2f_34_dasm(DASM_PARAMS); break; // illegal
938      case 0x35: size = arcompact_handle04_2f_35_dasm(DASM_PARAMS); break; // illegal
939      case 0x36: size = arcompact_handle04_2f_36_dasm(DASM_PARAMS); break; // illegal
940      case 0x37: size = arcompact_handle04_2f_37_dasm(DASM_PARAMS); break; // illegal
941      case 0x38: size = arcompact_handle04_2f_38_dasm(DASM_PARAMS); break; // illegal
942      case 0x39: size = arcompact_handle04_2f_39_dasm(DASM_PARAMS); break; // illegal
943      case 0x3a: size = arcompact_handle04_2f_3a_dasm(DASM_PARAMS); break; // illegal
944      case 0x3b: size = arcompact_handle04_2f_3b_dasm(DASM_PARAMS); break; // illegal
945      case 0x3c: size = arcompact_handle04_2f_3c_dasm(DASM_PARAMS); break; // illegal
946      case 0x3d: size = arcompact_handle04_2f_3d_dasm(DASM_PARAMS); break; // illegal
947      case 0x3e: size = arcompact_handle04_2f_3e_dasm(DASM_PARAMS); break; // illegal
948      case 0x3f: size = arcompact_handle04_2f_3f_dasm(DASM_PARAMS); break; // ZOPs (Zero Operand Opcodes)
949   }
950
951   return size;
952}
953
954
955int arcompact_handle04_2f_00_dasm(DASM_OPS_32)  { print("ASL (%08x)", op); return 4;} // ASL
956int arcompact_handle04_2f_01_dasm(DASM_OPS_32)  { print("ASR (%08x)", op); return 4;} // ASR
957int arcompact_handle04_2f_02_dasm(DASM_OPS_32)  { print("LSR (%08x)", op); return 4;} // LSR
958int arcompact_handle04_2f_03_dasm(DASM_OPS_32)  { print("ROR (%08x)", op); return 4;} // ROR
959int arcompact_handle04_2f_04_dasm(DASM_OPS_32)  { print("RCC (%08x)", op); return 4;} // RCC
960int arcompact_handle04_2f_05_dasm(DASM_OPS_32)  { print("SEXB (%08x)", op); return 4;} // SEXB
961int arcompact_handle04_2f_06_dasm(DASM_OPS_32)  { print("SEXW (%08x)", op); return 4;} // SEXW
962int arcompact_handle04_2f_07_dasm(DASM_OPS_32)  { print("EXTB (%08x)", op); return 4;} // EXTB
963int arcompact_handle04_2f_08_dasm(DASM_OPS_32)  { print("EXTW (%08x)", op); return 4;} // EXTW
964int arcompact_handle04_2f_09_dasm(DASM_OPS_32)  { print("ABS (%08x)", op); return 4;} // ABS
965int arcompact_handle04_2f_0a_dasm(DASM_OPS_32)  { print("NOT (%08x)", op); return 4;} // NOT
966int arcompact_handle04_2f_0b_dasm(DASM_OPS_32)  { print("RLC (%08x)", op); return 4;} // RLC
967int arcompact_handle04_2f_0c_dasm(DASM_OPS_32)  { print("EX (%08x)", op); return 4;} // EX
968int arcompact_handle04_2f_0d_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_0d> (%08x)", op); return 4;}
969int arcompact_handle04_2f_0e_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_0e> (%08x)", op); return 4;}
970int arcompact_handle04_2f_0f_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_0f> (%08x)", op); return 4;}
971int arcompact_handle04_2f_10_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_10> (%08x)", op); return 4;}
972int arcompact_handle04_2f_11_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_11> (%08x)", op); return 4;}
973int arcompact_handle04_2f_12_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_12> (%08x)", op); return 4;}
974int arcompact_handle04_2f_13_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_13> (%08x)", op); return 4;}
975int arcompact_handle04_2f_14_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_14> (%08x)", op); return 4;}
976int arcompact_handle04_2f_15_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_15> (%08x)", op); return 4;}
977int arcompact_handle04_2f_16_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_16> (%08x)", op); return 4;}
978int arcompact_handle04_2f_17_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_17> (%08x)", op); return 4;}
979int arcompact_handle04_2f_18_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_18> (%08x)", op); return 4;}
980int arcompact_handle04_2f_19_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_19> (%08x)", op); return 4;}
981int arcompact_handle04_2f_1a_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_1a> (%08x)", op); return 4;}
982int arcompact_handle04_2f_1b_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_1b> (%08x)", op); return 4;}
983int arcompact_handle04_2f_1c_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_1c> (%08x)", op); return 4;}
984int arcompact_handle04_2f_1d_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_1d> (%08x)", op); return 4;}
985int arcompact_handle04_2f_1e_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_1e> (%08x)", op); return 4;}
986int arcompact_handle04_2f_1f_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_1f> (%08x)", op); return 4;}
987int arcompact_handle04_2f_20_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_20> (%08x)", op); return 4;}
988int arcompact_handle04_2f_21_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_21> (%08x)", op); return 4;}
989int arcompact_handle04_2f_22_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_22> (%08x)", op); return 4;}
990int arcompact_handle04_2f_23_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_23> (%08x)", op); return 4;}
991int arcompact_handle04_2f_24_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_24> (%08x)", op); return 4;}
992int arcompact_handle04_2f_25_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_25> (%08x)", op); return 4;}
993int arcompact_handle04_2f_26_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_26> (%08x)", op); return 4;}
994int arcompact_handle04_2f_27_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_27> (%08x)", op); return 4;}
995int arcompact_handle04_2f_28_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_28> (%08x)", op); return 4;}
996int arcompact_handle04_2f_29_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_29> (%08x)", op); return 4;}
997int arcompact_handle04_2f_2a_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_2a> (%08x)", op); return 4;}
998int arcompact_handle04_2f_2b_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_2b> (%08x)", op); return 4;}
999int arcompact_handle04_2f_2c_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_2c> (%08x)", op); return 4;}
1000int arcompact_handle04_2f_2d_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_2d> (%08x)", op); return 4;}
1001int arcompact_handle04_2f_2e_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_2e> (%08x)", op); return 4;}
1002int arcompact_handle04_2f_2f_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_2f> (%08x)", op); return 4;}
1003int arcompact_handle04_2f_30_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_30> (%08x)", op); return 4;}
1004int arcompact_handle04_2f_31_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_31> (%08x)", op); return 4;}
1005int arcompact_handle04_2f_32_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_32> (%08x)", op); return 4;}
1006int arcompact_handle04_2f_33_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_33> (%08x)", op); return 4;}
1007int arcompact_handle04_2f_34_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_34> (%08x)", op); return 4;}
1008int arcompact_handle04_2f_35_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_35> (%08x)", op); return 4;}
1009int arcompact_handle04_2f_36_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_36> (%08x)", op); return 4;}
1010int arcompact_handle04_2f_37_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_37> (%08x)", op); return 4;}
1011int arcompact_handle04_2f_38_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_38> (%08x)", op); return 4;}
1012int arcompact_handle04_2f_39_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_39> (%08x)", op); return 4;}
1013int arcompact_handle04_2f_3a_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3a> (%08x)", op); return 4;}
1014int arcompact_handle04_2f_3b_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3b> (%08x)", op); return 4;}
1015int arcompact_handle04_2f_3c_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3c> (%08x)", op); return 4;}
1016int arcompact_handle04_2f_3d_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3d> (%08x)", op); return 4;}
1017int arcompact_handle04_2f_3e_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3e> (%08x)", op); return 4;}
1018
1019int arcompact_handle04_2f_3f_dasm(DASM_OPS_32)
1020{
1021   int size = 4;
1022   UINT8 subinstr3 = (op & 0x07000000) >> 24;
1023   subinstr3 |= ((op & 0x00007000) >> 12) << 3;
1024
1025   op &= ~0x07007000;
1026
1027   switch (subinstr3)
1028   {
1029      case 0x00: size = arcompact_handle04_2f_3f_00_dasm(DASM_PARAMS); break; // illegal
1030      case 0x01: size = arcompact_handle04_2f_3f_01_dasm(DASM_PARAMS); break; // SLEEP
1031      case 0x02: size = arcompact_handle04_2f_3f_02_dasm(DASM_PARAMS); break; // SWI / TRAP9
1032      case 0x03: size = arcompact_handle04_2f_3f_03_dasm(DASM_PARAMS); break; // SYNC
1033      case 0x04: size = arcompact_handle04_2f_3f_04_dasm(DASM_PARAMS); break; // RTIE
1034      case 0x05: size = arcompact_handle04_2f_3f_05_dasm(DASM_PARAMS); break; // BRK
1035      case 0x06: size = arcompact_handle04_2f_3f_06_dasm(DASM_PARAMS); break; // illegal
1036      case 0x07: size = arcompact_handle04_2f_3f_07_dasm(DASM_PARAMS); break; // illegal
1037      case 0x08: size = arcompact_handle04_2f_3f_08_dasm(DASM_PARAMS); break; // illegal
1038      case 0x09: size = arcompact_handle04_2f_3f_09_dasm(DASM_PARAMS); break; // illegal
1039      case 0x0a: size = arcompact_handle04_2f_3f_0a_dasm(DASM_PARAMS); break; // illegal
1040      case 0x0b: size = arcompact_handle04_2f_3f_0b_dasm(DASM_PARAMS); break; // illegal
1041      case 0x0c: size = arcompact_handle04_2f_3f_0c_dasm(DASM_PARAMS); break; // illegal
1042      case 0x0d: size = arcompact_handle04_2f_3f_0d_dasm(DASM_PARAMS); break; // illegal
1043      case 0x0e: size = arcompact_handle04_2f_3f_0e_dasm(DASM_PARAMS); break; // illegal
1044      case 0x0f: size = arcompact_handle04_2f_3f_0f_dasm(DASM_PARAMS); break; // illegal
1045      case 0x10: size = arcompact_handle04_2f_3f_10_dasm(DASM_PARAMS); break; // illegal
1046      case 0x11: size = arcompact_handle04_2f_3f_11_dasm(DASM_PARAMS); break; // illegal
1047      case 0x12: size = arcompact_handle04_2f_3f_12_dasm(DASM_PARAMS); break; // illegal
1048      case 0x13: size = arcompact_handle04_2f_3f_13_dasm(DASM_PARAMS); break; // illegal
1049      case 0x14: size = arcompact_handle04_2f_3f_14_dasm(DASM_PARAMS); break; // illegal
1050      case 0x15: size = arcompact_handle04_2f_3f_15_dasm(DASM_PARAMS); break; // illegal
1051      case 0x16: size = arcompact_handle04_2f_3f_16_dasm(DASM_PARAMS); break; // illegal
1052      case 0x17: size = arcompact_handle04_2f_3f_17_dasm(DASM_PARAMS); break; // illegal
1053      case 0x18: size = arcompact_handle04_2f_3f_18_dasm(DASM_PARAMS); break; // illegal
1054      case 0x19: size = arcompact_handle04_2f_3f_19_dasm(DASM_PARAMS); break; // illegal
1055      case 0x1a: size = arcompact_handle04_2f_3f_1a_dasm(DASM_PARAMS); break; // illegal
1056      case 0x1b: size = arcompact_handle04_2f_3f_1b_dasm(DASM_PARAMS); break; // illegal
1057      case 0x1c: size = arcompact_handle04_2f_3f_1c_dasm(DASM_PARAMS); break; // illegal
1058      case 0x1d: size = arcompact_handle04_2f_3f_1d_dasm(DASM_PARAMS); break; // illegal
1059      case 0x1e: size = arcompact_handle04_2f_3f_1e_dasm(DASM_PARAMS); break; // illegal
1060      case 0x1f: size = arcompact_handle04_2f_3f_1f_dasm(DASM_PARAMS); break; // illegal
1061      case 0x20: size = arcompact_handle04_2f_3f_20_dasm(DASM_PARAMS); break; // illegal
1062      case 0x21: size = arcompact_handle04_2f_3f_21_dasm(DASM_PARAMS); break; // illegal
1063      case 0x22: size = arcompact_handle04_2f_3f_22_dasm(DASM_PARAMS); break; // illegal
1064      case 0x23: size = arcompact_handle04_2f_3f_23_dasm(DASM_PARAMS); break; // illegal
1065      case 0x24: size = arcompact_handle04_2f_3f_24_dasm(DASM_PARAMS); break; // illegal
1066      case 0x25: size = arcompact_handle04_2f_3f_25_dasm(DASM_PARAMS); break; // illegal
1067      case 0x26: size = arcompact_handle04_2f_3f_26_dasm(DASM_PARAMS); break; // illegal
1068      case 0x27: size = arcompact_handle04_2f_3f_27_dasm(DASM_PARAMS); break; // illegal
1069      case 0x28: size = arcompact_handle04_2f_3f_28_dasm(DASM_PARAMS); break; // illegal
1070      case 0x29: size = arcompact_handle04_2f_3f_29_dasm(DASM_PARAMS); break; // illegal
1071      case 0x2a: size = arcompact_handle04_2f_3f_2a_dasm(DASM_PARAMS); break; // illegal
1072      case 0x2b: size = arcompact_handle04_2f_3f_2b_dasm(DASM_PARAMS); break; // illegal
1073      case 0x2c: size = arcompact_handle04_2f_3f_2c_dasm(DASM_PARAMS); break; // illegal
1074      case 0x2d: size = arcompact_handle04_2f_3f_2d_dasm(DASM_PARAMS); break; // illegal
1075      case 0x2e: size = arcompact_handle04_2f_3f_2e_dasm(DASM_PARAMS); break; // illegal
1076      case 0x2f: size = arcompact_handle04_2f_3f_2f_dasm(DASM_PARAMS); break; // illegal
1077      case 0x30: size = arcompact_handle04_2f_3f_30_dasm(DASM_PARAMS); break; // illegal
1078      case 0x31: size = arcompact_handle04_2f_3f_31_dasm(DASM_PARAMS); break; // illegal
1079      case 0x32: size = arcompact_handle04_2f_3f_32_dasm(DASM_PARAMS); break; // illegal
1080      case 0x33: size = arcompact_handle04_2f_3f_33_dasm(DASM_PARAMS); break; // illegal
1081      case 0x34: size = arcompact_handle04_2f_3f_34_dasm(DASM_PARAMS); break; // illegal
1082      case 0x35: size = arcompact_handle04_2f_3f_35_dasm(DASM_PARAMS); break; // illegal
1083      case 0x36: size = arcompact_handle04_2f_3f_36_dasm(DASM_PARAMS); break; // illegal
1084      case 0x37: size = arcompact_handle04_2f_3f_37_dasm(DASM_PARAMS); break; // illegal
1085      case 0x38: size = arcompact_handle04_2f_3f_38_dasm(DASM_PARAMS); break; // illegal
1086      case 0x39: size = arcompact_handle04_2f_3f_39_dasm(DASM_PARAMS); break; // illegal
1087      case 0x3a: size = arcompact_handle04_2f_3f_3a_dasm(DASM_PARAMS); break; // illegal
1088      case 0x3b: size = arcompact_handle04_2f_3f_3b_dasm(DASM_PARAMS); break; // illegal
1089      case 0x3c: size = arcompact_handle04_2f_3f_3c_dasm(DASM_PARAMS); break; // illegal
1090      case 0x3d: size = arcompact_handle04_2f_3f_3d_dasm(DASM_PARAMS); break; // illegal
1091      case 0x3e: size = arcompact_handle04_2f_3f_3e_dasm(DASM_PARAMS); break; // illegal
1092      case 0x3f: size = arcompact_handle04_2f_3f_3f_dasm(DASM_PARAMS); break; // illegal
1093   }
1094
1095   return size;
1096}
1097
1098int arcompact_handle04_2f_3f_00_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_00> (%08x)", op); return 4;}
1099int arcompact_handle04_2f_3f_01_dasm(DASM_OPS_32)  { print("SLEEP (%08x)", op); return 4;}
1100int arcompact_handle04_2f_3f_02_dasm(DASM_OPS_32)  { print("SWI / TRAP0 (%08x)", op); return 4;}
1101int arcompact_handle04_2f_3f_03_dasm(DASM_OPS_32)  { print("SYNC (%08x)", op); return 4;}
1102int arcompact_handle04_2f_3f_04_dasm(DASM_OPS_32)  { print("RTIE (%08x)", op); return 4;}
1103int arcompact_handle04_2f_3f_05_dasm(DASM_OPS_32)  { print("BRK (%08x)", op); return 4;}
1104int arcompact_handle04_2f_3f_06_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_06> (%08x)", op); return 4;}
1105int arcompact_handle04_2f_3f_07_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_07> (%08x)", op); return 4;}
1106int arcompact_handle04_2f_3f_08_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_08> (%08x)", op); return 4;}
1107int arcompact_handle04_2f_3f_09_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_09> (%08x)", op); return 4;}
1108int arcompact_handle04_2f_3f_0a_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_0a> (%08x)", op); return 4;}
1109int arcompact_handle04_2f_3f_0b_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_0b> (%08x)", op); return 4;}
1110int arcompact_handle04_2f_3f_0c_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_0c> (%08x)", op); return 4;}
1111int arcompact_handle04_2f_3f_0d_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_0d> (%08x)", op); return 4;}
1112int arcompact_handle04_2f_3f_0e_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_0e> (%08x)", op); return 4;}
1113int arcompact_handle04_2f_3f_0f_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_0f> (%08x)", op); return 4;}
1114int arcompact_handle04_2f_3f_10_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_10> (%08x)", op); return 4;}
1115int arcompact_handle04_2f_3f_11_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_11> (%08x)", op); return 4;}
1116int arcompact_handle04_2f_3f_12_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_12> (%08x)", op); return 4;}
1117int arcompact_handle04_2f_3f_13_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_13> (%08x)", op); return 4;}
1118int arcompact_handle04_2f_3f_14_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_14> (%08x)", op); return 4;}
1119int arcompact_handle04_2f_3f_15_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_15> (%08x)", op); return 4;}
1120int arcompact_handle04_2f_3f_16_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_16> (%08x)", op); return 4;}
1121int arcompact_handle04_2f_3f_17_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_17> (%08x)", op); return 4;}
1122int arcompact_handle04_2f_3f_18_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_18> (%08x)", op); return 4;}
1123int arcompact_handle04_2f_3f_19_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_19> (%08x)", op); return 4;}
1124int arcompact_handle04_2f_3f_1a_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_1a> (%08x)", op); return 4;}
1125int arcompact_handle04_2f_3f_1b_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_1b> (%08x)", op); return 4;}
1126int arcompact_handle04_2f_3f_1c_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_1c> (%08x)", op); return 4;}
1127int arcompact_handle04_2f_3f_1d_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_1d> (%08x)", op); return 4;}
1128int arcompact_handle04_2f_3f_1e_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_1e> (%08x)", op); return 4;}
1129int arcompact_handle04_2f_3f_1f_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_1f> (%08x)", op); return 4;}
1130int arcompact_handle04_2f_3f_20_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_20> (%08x)", op); return 4;}
1131int arcompact_handle04_2f_3f_21_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_21> (%08x)", op); return 4;}
1132int arcompact_handle04_2f_3f_22_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_22> (%08x)", op); return 4;}
1133int arcompact_handle04_2f_3f_23_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_23> (%08x)", op); return 4;}
1134int arcompact_handle04_2f_3f_24_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_24> (%08x)", op); return 4;}
1135int arcompact_handle04_2f_3f_25_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_25> (%08x)", op); return 4;}
1136int arcompact_handle04_2f_3f_26_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_26> (%08x)", op); return 4;}
1137int arcompact_handle04_2f_3f_27_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_27> (%08x)", op); return 4;}
1138int arcompact_handle04_2f_3f_28_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_28> (%08x)", op); return 4;}
1139int arcompact_handle04_2f_3f_29_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_29> (%08x)", op); return 4;}
1140int arcompact_handle04_2f_3f_2a_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_2a> (%08x)", op); return 4;}
1141int arcompact_handle04_2f_3f_2b_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_2b> (%08x)", op); return 4;}
1142int arcompact_handle04_2f_3f_2c_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_2c> (%08x)", op); return 4;}
1143int arcompact_handle04_2f_3f_2d_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_2d> (%08x)", op); return 4;}
1144int arcompact_handle04_2f_3f_2e_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_2e> (%08x)", op); return 4;}
1145int arcompact_handle04_2f_3f_2f_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_2f> (%08x)", op); return 4;}
1146int arcompact_handle04_2f_3f_30_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_30> (%08x)", op); return 4;}
1147int arcompact_handle04_2f_3f_31_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_31> (%08x)", op); return 4;}
1148int arcompact_handle04_2f_3f_32_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_32> (%08x)", op); return 4;}
1149int arcompact_handle04_2f_3f_33_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_33> (%08x)", op); return 4;}
1150int arcompact_handle04_2f_3f_34_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_34> (%08x)", op); return 4;}
1151int arcompact_handle04_2f_3f_35_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_35> (%08x)", op); return 4;}
1152int arcompact_handle04_2f_3f_36_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_36> (%08x)", op); return 4;}
1153int arcompact_handle04_2f_3f_37_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_37> (%08x)", op); return 4;}
1154int arcompact_handle04_2f_3f_38_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_38> (%08x)", op); return 4;}
1155int arcompact_handle04_2f_3f_39_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_39> (%08x)", op); return 4;}
1156int arcompact_handle04_2f_3f_3a_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_3a> (%08x)", op); return 4;}
1157int arcompact_handle04_2f_3f_3b_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_3b> (%08x)", op); return 4;}
1158int arcompact_handle04_2f_3f_3c_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_3c> (%08x)", op); return 4;}
1159int arcompact_handle04_2f_3f_3d_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_3d> (%08x)", op); return 4;}
1160int arcompact_handle04_2f_3f_3e_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_3e> (%08x)", op); return 4;}
1161int arcompact_handle04_2f_3f_3f_dasm(DASM_OPS_32)  { print("<illegal 0x04_2f_3f_3f> (%08x)", op); return 4;}
1162
1163
1164
1165
1166
1167
1168
1169
1170int arcompact_handle04_30_dasm(DASM_OPS_32)  { print("LD r-r (basecase 0x30) (%08x)", op); return 4;}
1171int arcompact_handle04_31_dasm(DASM_OPS_32)  { print("LD r-r (basecase 0x31) (%08x)", op); return 4;}
1172int arcompact_handle04_32_dasm(DASM_OPS_32)  { print("LD r-r (basecase 0x32) (%08x)", op); return 4;}
1173int arcompact_handle04_33_dasm(DASM_OPS_32)  { print("LD r-r (basecase 0x33) (%08x)", op); return 4;}
1174int arcompact_handle04_34_dasm(DASM_OPS_32)  { print("LD r-r (basecase 0x34) (%08x)", op); return 4;}
1175int arcompact_handle04_35_dasm(DASM_OPS_32)  { print("LD r-r (basecase 0x35) (%08x)", op); return 4;}
1176int arcompact_handle04_36_dasm(DASM_OPS_32)  { print("LD r-r (basecase 0x36) (%08x)", op); return 4;}
1177int arcompact_handle04_37_dasm(DASM_OPS_32)  { print("LD r-r (basecase 0x37) (%08x)", op); return 4;}
1178int arcompact_handle04_38_dasm(DASM_OPS_32)  { print("<illegal 0x04_38> (%08x)", op); return 4;}
1179int arcompact_handle04_39_dasm(DASM_OPS_32)  { print("<illegal 0x04_39> (%08x)", op); return 4;}
1180int arcompact_handle04_3a_dasm(DASM_OPS_32)  { print("<illegal 0x04_3a> (%08x)", op); return 4;}
1181int arcompact_handle04_3b_dasm(DASM_OPS_32)  { print("<illegal 0x04_3b> (%08x)", op); return 4;}
1182int arcompact_handle04_3c_dasm(DASM_OPS_32)  { print("<illegal 0x04_3c> (%08x)", op); return 4;}
1183int arcompact_handle04_3d_dasm(DASM_OPS_32)  { print("<illegal 0x04_3d> (%08x)", op); return 4;}
1184int arcompact_handle04_3e_dasm(DASM_OPS_32)  { print("<illegal 0x04_3e> (%08x)", op); return 4;}
1185int arcompact_handle04_3f_dasm(DASM_OPS_32)  { print("<illegal 0x04_3f> (%08x)", op); return 4;}
1186
1187
1188
1189
1190
1191// this is an Extension ALU group, maybe optional on some CPUs?
1192int arcompact_handle05_dasm(DASM_OPS_32)
1193{
1194   int size = 4;
1195   UINT8 subinstr = (op & 0x003f0000) >> 16;
1196   op &= ~0x003f0000;
1197
1198   switch (subinstr)
1199   {
1200      case 0x00: size = arcompact_handle05_00_dasm(DASM_PARAMS); break; // ASL
1201      case 0x01: size = arcompact_handle05_01_dasm(DASM_PARAMS); break; // LSR
1202      case 0x02: size = arcompact_handle05_02_dasm(DASM_PARAMS); break; // ASR
1203      case 0x03: size = arcompact_handle05_03_dasm(DASM_PARAMS); break; // ROR
1204      case 0x04: size = arcompact_handle05_04_dasm(DASM_PARAMS); break; // MUL64
1205      case 0x05: size = arcompact_handle05_05_dasm(DASM_PARAMS); break; // MULU64
1206      case 0x06: size = arcompact_handle05_06_dasm(DASM_PARAMS); break; // ADDS
1207      case 0x07: size = arcompact_handle05_07_dasm(DASM_PARAMS); break; // SUBS
1208      case 0x08: size = arcompact_handle05_08_dasm(DASM_PARAMS); break; // DIVAW
1209      case 0x09: size = arcompact_handle05_09_dasm(DASM_PARAMS); break; // illegal
1210      case 0x0a: size = arcompact_handle05_0a_dasm(DASM_PARAMS); break; // ASLS
1211      case 0x0b: size = arcompact_handle05_0b_dasm(DASM_PARAMS); break; // ASRS
1212      case 0x0c: size = arcompact_handle05_0c_dasm(DASM_PARAMS); break; // illegal
1213      case 0x0d: size = arcompact_handle05_0d_dasm(DASM_PARAMS); break; // illegal
1214      case 0x0e: size = arcompact_handle05_0e_dasm(DASM_PARAMS); break; // illegal
1215      case 0x0f: size = arcompact_handle05_0f_dasm(DASM_PARAMS); break; // illegal
1216      case 0x10: size = arcompact_handle05_10_dasm(DASM_PARAMS); break; // illegal
1217      case 0x11: size = arcompact_handle05_11_dasm(DASM_PARAMS); break; // illegal
1218      case 0x12: size = arcompact_handle05_12_dasm(DASM_PARAMS); break; // illegal
1219      case 0x13: size = arcompact_handle05_13_dasm(DASM_PARAMS); break; // illegal
1220      case 0x14: size = arcompact_handle05_14_dasm(DASM_PARAMS); break; // illegal
1221      case 0x15: size = arcompact_handle05_15_dasm(DASM_PARAMS); break; // illegal
1222      case 0x16: size = arcompact_handle05_16_dasm(DASM_PARAMS); break; // illegal
1223      case 0x17: size = arcompact_handle05_17_dasm(DASM_PARAMS); break; // illegal
1224      case 0x18: size = arcompact_handle05_18_dasm(DASM_PARAMS); break; // illegal
1225      case 0x19: size = arcompact_handle05_19_dasm(DASM_PARAMS); break; // illegal
1226      case 0x1a: size = arcompact_handle05_1a_dasm(DASM_PARAMS); break; // illegal
1227      case 0x1b: size = arcompact_handle05_1b_dasm(DASM_PARAMS); break; // illegal
1228      case 0x1c: size = arcompact_handle05_1c_dasm(DASM_PARAMS); break; // illegal
1229      case 0x1d: size = arcompact_handle05_1d_dasm(DASM_PARAMS); break; // illegal
1230      case 0x1e: size = arcompact_handle05_1e_dasm(DASM_PARAMS); break; // illegal
1231      case 0x1f: size = arcompact_handle05_1f_dasm(DASM_PARAMS); break; // illegal
1232      case 0x20: size = arcompact_handle05_20_dasm(DASM_PARAMS); break; // illegal
1233      case 0x21: size = arcompact_handle05_21_dasm(DASM_PARAMS); break; // illegal
1234      case 0x22: size = arcompact_handle05_22_dasm(DASM_PARAMS); break; // illegal
1235      case 0x23: size = arcompact_handle05_23_dasm(DASM_PARAMS); break; // illegal
1236      case 0x24: size = arcompact_handle05_24_dasm(DASM_PARAMS); break; // illegal
1237      case 0x25: size = arcompact_handle05_25_dasm(DASM_PARAMS); break; // illegal
1238      case 0x26: size = arcompact_handle05_26_dasm(DASM_PARAMS); break; // illegal
1239      case 0x27: size = arcompact_handle05_27_dasm(DASM_PARAMS); break; // illegal
1240      case 0x28: size = arcompact_handle05_28_dasm(DASM_PARAMS); break; // ADDSDW
1241      case 0x29: size = arcompact_handle05_29_dasm(DASM_PARAMS); break; // SUBSDW
1242      case 0x2a: size = arcompact_handle05_2a_dasm(DASM_PARAMS); break; // illegal
1243      case 0x2b: size = arcompact_handle05_2b_dasm(DASM_PARAMS); break; // illegal
1244      case 0x2c: size = arcompact_handle05_2c_dasm(DASM_PARAMS); break; // illegal
1245      case 0x2d: size = arcompact_handle05_2d_dasm(DASM_PARAMS); break; // illegal
1246      case 0x2e: size = arcompact_handle05_2e_dasm(DASM_PARAMS); break; // illegal
1247      case 0x2f: size = arcompact_handle05_2f_dasm(DASM_PARAMS); break; // SOPs
1248      case 0x30: size = arcompact_handle05_30_dasm(DASM_PARAMS); break; // illegal
1249      case 0x31: size = arcompact_handle05_31_dasm(DASM_PARAMS); break; // illegal
1250      case 0x32: size = arcompact_handle05_32_dasm(DASM_PARAMS); break; // illegal
1251      case 0x33: size = arcompact_handle05_33_dasm(DASM_PARAMS); break; // illegal
1252      case 0x34: size = arcompact_handle05_34_dasm(DASM_PARAMS); break; // illegal
1253      case 0x35: size = arcompact_handle05_35_dasm(DASM_PARAMS); break; // illegal
1254      case 0x36: size = arcompact_handle05_36_dasm(DASM_PARAMS); break; // illegal
1255      case 0x37: size = arcompact_handle05_37_dasm(DASM_PARAMS); break; // illegal
1256      case 0x38: size = arcompact_handle05_38_dasm(DASM_PARAMS); break; // illegal
1257      case 0x39: size = arcompact_handle05_39_dasm(DASM_PARAMS); break; // illegal
1258      case 0x3a: size = arcompact_handle05_3a_dasm(DASM_PARAMS); break; // illegal
1259      case 0x3b: size = arcompact_handle05_3b_dasm(DASM_PARAMS); break; // illegal
1260      case 0x3c: size = arcompact_handle05_3c_dasm(DASM_PARAMS); break; // illegal
1261      case 0x3d: size = arcompact_handle05_3d_dasm(DASM_PARAMS); break; // illegal
1262      case 0x3e: size = arcompact_handle05_3e_dasm(DASM_PARAMS); break; // illegal
1263      case 0x3f: size = arcompact_handle05_3f_dasm(DASM_PARAMS); break; // illegal
1264   }
1265
1266   return size;
1267}
1268
1269int arcompact_handle05_00_dasm(DASM_OPS_32)  { print("ASL a <- b asl c (%08x)", op); return 4;}
1270int arcompact_handle05_01_dasm(DASM_OPS_32)  { print("LSR a <- b lsr c (%08x)", op); return 4;}
1271int arcompact_handle05_02_dasm(DASM_OPS_32)  { print("ASR a <- b asr c (%08x)", op); return 4;}
1272int arcompact_handle05_03_dasm(DASM_OPS_32)  { print("ROR a <- b ror c (%08x)", op); return 4;}
1273int arcompact_handle05_04_dasm(DASM_OPS_32)  { print("MUL64 mulres <- b * c (%08x)", op); return 4;}
1274int arcompact_handle05_05_dasm(DASM_OPS_32)  { print("MULU64 mulres <- b * c (%08x)", op); return 4;}
1275int arcompact_handle05_06_dasm(DASM_OPS_32)  { print("ADDS a <- sat32 (b + c) (%08x)", op); return 4;}
1276int arcompact_handle05_07_dasm(DASM_OPS_32)  { print("SUBS a <- sat32 (b + c) (%08x)", op); return 4;}
1277int arcompact_handle05_08_dasm(DASM_OPS_32)  { print("DIVAW (%08x)", op); return 4;}
1278int arcompact_handle05_09_dasm(DASM_OPS_32)  { print("<illegal 0x05_09> (%08x)", op); return 4;}
1279int arcompact_handle05_0a_dasm(DASM_OPS_32)  { print("ASLS a <- sat32 (b << c) (%08x)", op); return 4;}
1280int arcompact_handle05_0b_dasm(DASM_OPS_32)  { print("ASRS a ,- sat32 (b >> c) (%08x)", op); return 4;}
1281int arcompact_handle05_0c_dasm(DASM_OPS_32)  { print("<illegal 0x05_0c> (%08x)", op); return 4;}
1282int arcompact_handle05_0d_dasm(DASM_OPS_32)  { print("<illegal 0x05_0d> (%08x)", op); return 4;}
1283int arcompact_handle05_0e_dasm(DASM_OPS_32)  { print("<illegal 0x05_0e> (%08x)", op); return 4;}
1284int arcompact_handle05_0f_dasm(DASM_OPS_32)  { print("<illegal 0x05_0f> (%08x)", op); return 4;}
1285int arcompact_handle05_10_dasm(DASM_OPS_32)  { print("<illegal 0x05_10> (%08x)", op); return 4;}
1286int arcompact_handle05_11_dasm(DASM_OPS_32)  { print("<illegal 0x05_11> (%08x)", op); return 4;}
1287int arcompact_handle05_12_dasm(DASM_OPS_32)  { print("<illegal 0x05_12> (%08x)", op); return 4;}
1288int arcompact_handle05_13_dasm(DASM_OPS_32)  { print("<illegal 0x05_13> (%08x)", op); return 4;}
1289int arcompact_handle05_14_dasm(DASM_OPS_32)  { print("<illegal 0x05_14> (%08x)", op); return 4;}
1290int arcompact_handle05_15_dasm(DASM_OPS_32)  { print("<illegal 0x05_15> (%08x)", op); return 4;}
1291int arcompact_handle05_16_dasm(DASM_OPS_32)  { print("<illegal 0x05_16> (%08x)", op); return 4;}
1292int arcompact_handle05_17_dasm(DASM_OPS_32)  { print("<illegal 0x05_17> (%08x)", op); return 4;}
1293int arcompact_handle05_18_dasm(DASM_OPS_32)  { print("<illegal 0x05_18> (%08x)", op); return 4;}
1294int arcompact_handle05_19_dasm(DASM_OPS_32)  { print("<illegal 0x05_19> (%08x)", op); return 4;}
1295int arcompact_handle05_1a_dasm(DASM_OPS_32)  { print("<illegal 0x05_1a> (%08x)", op); return 4;}
1296int arcompact_handle05_1b_dasm(DASM_OPS_32)  { print("<illegal 0x05_1b> (%08x)", op); return 4;}
1297int arcompact_handle05_1c_dasm(DASM_OPS_32)  { print("<illegal 0x05_1c> (%08x)", op); return 4;}
1298int arcompact_handle05_1d_dasm(DASM_OPS_32)  { print("<illegal 0x05_1d> (%08x)", op); return 4;}
1299int arcompact_handle05_1e_dasm(DASM_OPS_32)  { print("<illegal 0x05_1e> (%08x)", op); return 4;}
1300int arcompact_handle05_1f_dasm(DASM_OPS_32)  { print("<illegal 0x05_1f> (%08x)", op); return 4;}
1301int arcompact_handle05_20_dasm(DASM_OPS_32)  { print("<illegal 0x05_20> (%08x)", op); return 4;}
1302int arcompact_handle05_21_dasm(DASM_OPS_32)  { print("<illegal 0x05_21> (%08x)", op); return 4;}
1303int arcompact_handle05_22_dasm(DASM_OPS_32)  { print("<illegal 0x05_22> (%08x)", op); return 4;}
1304int arcompact_handle05_23_dasm(DASM_OPS_32)  { print("<illegal 0x05_23> (%08x)", op); return 4;}
1305int arcompact_handle05_24_dasm(DASM_OPS_32)  { print("<illegal 0x05_24> (%08x)", op); return 4;}
1306int arcompact_handle05_25_dasm(DASM_OPS_32)  { print("<illegal 0x05_25> (%08x)", op); return 4;}
1307int arcompact_handle05_26_dasm(DASM_OPS_32)  { print("<illegal 0x05_26> (%08x)", op); return 4;}
1308int arcompact_handle05_27_dasm(DASM_OPS_32)  { print("<illegal 0x05_27> (%08x)", op); return 4;}
1309int arcompact_handle05_28_dasm(DASM_OPS_32)  { print("ADDSDW (%08x)", op); return 4;}
1310int arcompact_handle05_29_dasm(DASM_OPS_32)  { print("SUBSDW (%08x)", op); return 4;}
1311int arcompact_handle05_2a_dasm(DASM_OPS_32)  { print("<illegal 0x05_2a> (%08x)", op); return 4;}
1312int arcompact_handle05_2b_dasm(DASM_OPS_32)  { print("<illegal 0x05_2b> (%08x)", op); return 4;}
1313int arcompact_handle05_2c_dasm(DASM_OPS_32)  { print("<illegal 0x05_2c> (%08x)", op); return 4;}
1314int arcompact_handle05_2d_dasm(DASM_OPS_32)  { print("<illegal 0x05_2d> (%08x)", op); return 4;}
1315int arcompact_handle05_2e_dasm(DASM_OPS_32)  { print("<illegal 0x05_2e> (%08x)", op); return 4;}
1316int arcompact_handle05_2f_dasm(DASM_OPS_32)  { print("SOP (another table) (%08x)", op); return 4;}
1317int arcompact_handle05_30_dasm(DASM_OPS_32)  { print("<illegal 0x05_30> (%08x)", op); return 4;}
1318int arcompact_handle05_31_dasm(DASM_OPS_32)  { print("<illegal 0x05_31> (%08x)", op); return 4;}
1319int arcompact_handle05_32_dasm(DASM_OPS_32)  { print("<illegal 0x05_32> (%08x)", op); return 4;}
1320int arcompact_handle05_33_dasm(DASM_OPS_32)  { print("<illegal 0x05_33> (%08x)", op); return 4;}
1321int arcompact_handle05_34_dasm(DASM_OPS_32)  { print("<illegal 0x05_34> (%08x)", op); return 4;}
1322int arcompact_handle05_35_dasm(DASM_OPS_32)  { print("<illegal 0x05_35> (%08x)", op); return 4;}
1323int arcompact_handle05_36_dasm(DASM_OPS_32)  { print("<illegal 0x05_36> (%08x)", op); return 4;}
1324int arcompact_handle05_37_dasm(DASM_OPS_32)  { print("<illegal 0x05_37> (%08x)", op); return 4;}
1325int arcompact_handle05_38_dasm(DASM_OPS_32)  { print("<illegal 0x05_38> (%08x)", op); return 4;}
1326int arcompact_handle05_39_dasm(DASM_OPS_32)  { print("<illegal 0x05_39> (%08x)", op); return 4;}
1327int arcompact_handle05_3a_dasm(DASM_OPS_32)  { print("<illegal 0x05_3a> (%08x)", op); return 4;}
1328int arcompact_handle05_3b_dasm(DASM_OPS_32)  { print("<illegal 0x05_3b> (%08x)", op); return 4;}
1329int arcompact_handle05_3c_dasm(DASM_OPS_32)  { print("<illegal 0x05_3c> (%08x)", op); return 4;}
1330int arcompact_handle05_3d_dasm(DASM_OPS_32)  { print("<illegal 0x05_3d> (%08x)", op); return 4;}
1331int arcompact_handle05_3e_dasm(DASM_OPS_32)  { print("<illegal 0x05_3e> (%08x)", op); return 4;}
1332int arcompact_handle05_3f_dasm(DASM_OPS_32)  { print("<illegal 0x05_3f> (%08x)", op); return 4;}
1333
1334
1335
1336int arcompact_handle06_dasm(DASM_OPS_32)
1337{
1338   print("op a,b,c (06 ARC ext) (%08x)", op );
1339   return 4;
1340}
1341
1342int arcompact_handle07_dasm(DASM_OPS_32)
1343{
1344   print("op a,b,c (07 User ext) (%08x)", op );
1345   return 4;
1346}
1347
1348int arcompact_handle08_dasm(DASM_OPS_32)
1349{
1350   print("op a,b,c (08 User ext) (%08x)", op );
1351   return 4;
1352}
1353
1354int arcompact_handle09_dasm(DASM_OPS_32)
1355{
1356   print("op a,b,c (09 Market ext) (%08x)", op );
1357   return 4;
1358}
1359
1360int arcompact_handle0a_dasm(DASM_OPS_32)
1361{
1362   print("op a,b,c (0a Market ext) (%08x)",  op );
1363   return 4;
1364}
1365
1366int arcompact_handle0b_dasm(DASM_OPS_32)
1367{
1368   print("op a,b,c (0b Market ext) (%08x)",  op );
1369   return 4;
1370}
1371
1372
1373
1374
1375int arcompact_handle0c_dasm(DASM_OPS_16)
1376{
1377   int size = 2;
1378   UINT8 subinstr = (op & 0x0018) >> 3;
1379   op &= ~0x0018;
1380
1381   switch (subinstr)
1382   {
1383      case 0x00: size = arcompact_handle0c_00_dasm(DASM_PARAMS); break; // LD_S
1384      case 0x01: size = arcompact_handle0c_01_dasm(DASM_PARAMS); break; // LDB_S
1385      case 0x02: size = arcompact_handle0c_02_dasm(DASM_PARAMS); break; // LDW_S
1386      case 0x03: size = arcompact_handle0c_03_dasm(DASM_PARAMS); break; // ADD_S
1387   }
1388   return size;
1389}
1390
1391
1392int arcompact_handle0c_00_dasm(DASM_OPS_16)
1393{
1394   int size = 2;
1395   print("LD_S a <- m[b + c].long (%04x)", op);
1396   return size;
1397}
1398
1399int arcompact_handle0c_01_dasm(DASM_OPS_16)
1400{
1401   int size = 2;
1402   print("LDB_S a <- m[b + c].byte (%04x)", op);
1403   return size;
1404}
1405
1406int arcompact_handle0c_02_dasm(DASM_OPS_16)
1407{
1408   int size = 2;
1409   print("LDW_S a <- m[b + c].word (%04x)", op);
1410   return size;
1411}
1412
1413int arcompact_handle0c_03_dasm(DASM_OPS_16)
1414{
1415   int size = 2;
1416   print("ADD_S a <- b + c (%04x)", op);
1417   return size;
1418}
1419
1420
1421int arcompact_handle0d_dasm(DASM_OPS_16)
1422{
1423   int size = 2;
1424   UINT8 subinstr = (op & 0x0018) >> 3;
1425   op &= ~0x0018;
1426
1427   switch (subinstr)
1428   {
1429      case 0x00: size = arcompact_handle0d_00_dasm(DASM_PARAMS); break; // ADD_S
1430      case 0x01: size = arcompact_handle0d_01_dasm(DASM_PARAMS); break; // SUB_S
1431      case 0x02: size = arcompact_handle0d_02_dasm(DASM_PARAMS); break; // ASL_S
1432      case 0x03: size = arcompact_handle0d_03_dasm(DASM_PARAMS); break; // ASR_S
1433   }
1434   return size;
1435}
1436
1437int arcompact_handle0d_00_dasm(DASM_OPS_16)
1438{
1439   int size = 2;
1440   print("ADD_S c <- b + u3 (%04x)", op);
1441   return size;
1442}
1443
1444int arcompact_handle0d_01_dasm(DASM_OPS_16)
1445{
1446   int size = 2;
1447   print("SUB_S c <- b - u3 (%04x)", op);
1448   return size;
1449}
1450
1451int arcompact_handle0d_02_dasm(DASM_OPS_16)
1452{
1453   int size = 2;
1454   print("ASL_S c <- b asl u3 (%04x)", op);
1455   return size;
1456}
1457
1458int arcompact_handle0d_03_dasm(DASM_OPS_16)
1459{
1460   int size = 2;
1461   print("ASL_S c <- b asr u3 (%04x)", op);
1462   return size;
1463}
1464
1465
1466int arcompact_handle0e_dasm(DASM_OPS_16)
1467{
1468   int size = 2;
1469   UINT8 subinstr = (op & 0x0018) >> 3;
1470   op &= ~0x0018;
1471
1472   switch (subinstr)
1473   {
1474      case 0x00: size = arcompact_handle0e_00_dasm(DASM_PARAMS); break; // ADD_S
1475      case 0x01: size = arcompact_handle0e_01_dasm(DASM_PARAMS); break; // MOV_S
1476      case 0x02: size = arcompact_handle0e_02_dasm(DASM_PARAMS); break; // CMP_S
1477      case 0x03: size = arcompact_handle0e_03_dasm(DASM_PARAMS); break; // MOV_S
1478   }
1479   return size;
1480}
1481
1482
1483
1484
1485#define GROUP_0e_GET_h \
1486   h =  ((op & 0x0007) << 3); \
1487    h |= ((op & 0x00e0) >> 5); \
1488
1489// this is as messed up as the rest of the 16-bit alignment in LE mode...
1490
1491#define GET_LIMM \
1492   limm = oprom[4] | (oprom[5] << 8); \
1493   limm |= (oprom[2] << 16) | (oprom[3] << 24); \
1494
1495
1496int arcompact_handle0e_00_dasm(DASM_OPS_16)
1497{
1498   int h;
1499   int size = 2;
1500
1501   GROUP_0e_GET_h;
1502
1503   if (h == LIMM_REG)
1504   {
1505      UINT32 limm;
1506      GET_LIMM;
1507      size = 6;
1508      print("ADD_S b <- b + (%08x) (%04x)", limm, op);
1509   }
1510   else
1511   {
1512
1513      print("ADD_S b <- b + (r%d) (%04x)", h, op);
1514   }
1515
1516   return size;
1517}
1518
1519int arcompact_handle0e_01_dasm(DASM_OPS_16)
1520{
1521   int h;
1522   int size = 2;
1523   GROUP_0e_GET_h;
1524
1525   if (h == LIMM_REG)
1526   {
1527      UINT32 limm;
1528      GET_LIMM;
1529      size = 6;
1530      print("MOV_S b <- (%08x)  (%04x)", limm, op);
1531   }
1532   else
1533   {
1534      print("MOV_S b <- (r%d)  (%04x)", h, op);
1535   }
1536   return size;
1537}
1538
1539int arcompact_handle0e_02_dasm(DASM_OPS_16)
1540{
1541   int h;
1542   int size = 2;
1543   GROUP_0e_GET_h;
1544
1545   if (h == LIMM_REG)
1546   {
1547      UINT32 limm;
1548      GET_LIMM;
1549      size = 6;
1550      print("CMP_S b - (%08x) (%04x)", limm, op);
1551   }
1552   else
1553   {
1554      print("CMP_S b - (r%d) (%04x)", h, op);
1555   }
1556   return size;
1557}
1558
1559int arcompact_handle0e_03_dasm(DASM_OPS_16)
1560{
1561   int h;
1562   int size = 2;
1563   GROUP_0e_GET_h;
1564
1565   if (h == LIMM_REG)
1566   {
1567      UINT32 limm;
1568      GET_LIMM;
1569      size = 6;
1570      print("MOV_S (%08x) <- b (%04x)", limm, op);
1571   }
1572   else
1573   {
1574      print("MOV_S (r%d) <- b (%04x)", h, op);
1575   }
1576
1577   return size;
1578}
1579
1580
1581
1582int arcompact_handle0f_dasm(DASM_OPS_16)
1583{
1584   // General Register Instructions (16-bit)
1585   // 01111 bbb ccc iiiii
1586   UINT8 subinstr = (op & 0x01f) >> 0;
1587   //print("%s (%04x)", table0f[subinstr], op & ~0xf81f);
1588     
1589   switch (subinstr)
1590   {
1591   
1592      default:
1593         print("%s (%04x)", table0f[subinstr], op & ~0xf81f);
1594         break;
1595
1596      case 0x00:
311      switch (instruction)
1597312      {
1598         // General Operations w/ Register
1599         // 01111 bbb iii 00000
1600         UINT8 subinstr2 = (op & 0x00e0) >> 5;
1601
1602         switch (subinstr2)
313         case 0x0f:
1603314         {
1604            default:
1605               print("%s (%04x)", table0f_00[subinstr2], op & ~0xf8ff);
1606               return 2;
315            // General Register Instructions (16-bit)
316            // 01111 bbb ccc iiiii
317            UINT8 subinstr = (op & 0x01f) >> 0;
318            //print("%s (%04x)", table0f[subinstr], op & ~0xf81f);
1607319
1608            case 0x7:
320#if 1         
321            switch (subinstr)
1609322            {
1610               // General Operations w/o Register
1611               // 01111 iii 111 00000
1612               UINT8 subinstr3 = (op & 0x0700) >> 8;
1613
1614               print("%s (%04x)", table0f_00_07[subinstr3], op & ~0xffff);
1615
1616               return 2;
1617            }
1618         }
1619      }
1620   }
1621323   
1622   return 2;
1623}
324               default:
325                  print("%s (%04x)", table0f[subinstr], op & ~0xf81f);
326                  break;
1624327
1625int arcompact_handle10_dasm(DASM_OPS_16)
1626{
1627   print("LD_S (%04x)",  op);
1628   return 2;
1629}
328               case 0x00:
329               {
330                  // General Operations w/ Register
331                  // 01111 bbb iii 00000
332                  UINT8 subinstr2 = (op & 0x00e0) >> 5;
1630333
1631int arcompact_handle11_dasm(DASM_OPS_16)
1632{
1633   print("LDB_S (%04x)", op);
1634   return 2;
1635}
334                  switch (subinstr2)
335                  {
336                     default:
337                        print("%s (%04x)", table0f_00[subinstr2], op & ~0xf8ff);
338                        break;
1636339
1637int arcompact_handle12_dasm(DASM_OPS_16)
1638{
1639   print("LDW_S (%04x)", op);
1640   return 2;
1641}
340                     case 0x7:
341                     {
342                        // General Operations w/o Register
343                        // 01111 iii 111 00000
344                        UINT8 subinstr3 = (op & 0x0700) >> 8;
1642345
1643int arcompact_handle13_dasm(DASM_OPS_16)
1644{
1645   print("LSW_S.X (%04x)", op);
1646   return 2;
1647}
346                        print("%s (%04x)", table0f_00_07[subinstr3], op & ~0xffff);
1648347
1649int arcompact_handle14_dasm(DASM_OPS_16)
1650{
1651   print("ST_S (%04x)", op);
1652   return 2;
1653}
348                        break;
349                     }
350                  }
351               }
352            }
353#endif           
354         
355            break;
1654356
1655int arcompact_handle15_dasm(DASM_OPS_16)
1656{
1657   print("STB_S (%04x)", op);
1658   return 2;
1659}
357         }
1660358
1661int arcompact_handle16_dasm(DASM_OPS_16)
1662{
1663   print("STW_S (%04x)",  op);
1664   return 2;
1665}
1666359
1667int arcompact_handle17_dasm(DASM_OPS_16)
1668{
1669   int size = 2;
1670   UINT8 subinstr = (op & 0x00e0) >> 5;
1671   op &= ~0x00e0;
360         case 0x18:
361         {
362            // Stack Pointer Based Instructions (16-bit)
363            // 11000 bbb iii uuuuu
364            UINT8 subinstr = (op & 0x00e0) >> 5;
365            print("%s (%04x)", table18[subinstr], op & ~0xf8e0);
366            break;
1672367
1673   switch (subinstr)
1674   {
1675      case 0x00: size = arcompact_handle17_00_dasm(DASM_PARAMS); break; // ASL_S
1676      case 0x01: size = arcompact_handle17_01_dasm(DASM_PARAMS); break; // LSR_S
1677      case 0x02: size = arcompact_handle17_02_dasm(DASM_PARAMS); break; // ASR_S
1678      case 0x03: size = arcompact_handle17_03_dasm(DASM_PARAMS); break; // SUB_S
1679      case 0x04: size = arcompact_handle17_04_dasm(DASM_PARAMS); break; // BSET_S
1680      case 0x05: size = arcompact_handle17_05_dasm(DASM_PARAMS); break; // BCLR_S
1681      case 0x06: size = arcompact_handle17_06_dasm(DASM_PARAMS); break; // BMSK_S
1682      case 0x07: size = arcompact_handle17_07_dasm(DASM_PARAMS); break; // BTST_S
1683   }
368         }
1684369
1685   return size;
1686}
1687
1688int arcompact_handle17_00_dasm(DASM_OPS_16)
1689{
1690   int size = 2;
1691   print("ASL_S b <- b asl u5 (%04x)",  op);
1692   return size;
1693}
1694
1695int arcompact_handle17_01_dasm(DASM_OPS_16)
1696{
1697   int size = 2;
1698   print("LSR_S b <- b lsr u5 (%04x)",  op);
1699   return size;
1700}
1701
1702int arcompact_handle17_02_dasm(DASM_OPS_16)
1703{
1704   int size = 2;
1705   print("ASR_S b <- b asr u5 (%04x)",  op);
1706   return size;
1707}
1708
1709int arcompact_handle17_03_dasm(DASM_OPS_16)
1710{
1711   int size = 2;
1712   print("SUB_S b <- b - u5 (%04x)",  op);
1713   return size;
1714}
1715
1716int arcompact_handle17_04_dasm(DASM_OPS_16)
1717{
1718   int size = 2;
1719   print("BSET_S b <- b | (1 << u5) (%04x)",  op);
1720   return size;
1721}
1722
1723int arcompact_handle17_05_dasm(DASM_OPS_16)
1724{
1725   int size = 2;
1726   print("BCLR_S b <- b & !(1 << u5) (%04x)",  op);
1727   return size;
1728}
1729
1730int arcompact_handle17_06_dasm(DASM_OPS_16)
1731{
1732   int size = 2;
1733   print("BMSK_S (%04x)",  op);
1734   return size;
1735}
1736
1737int arcompact_handle17_07_dasm(DASM_OPS_16)
1738{
1739   int size = 2;
1740   print("BTST_S (%04x)",  op);
1741   return size;
1742}
1743
1744int arcompact_handle18_dasm(DASM_OPS_16)
1745{
1746   int size = 2;
1747   // Stack Pointer Based Instructions (16-bit)
1748   // 11000 bbb iii uuuuu
1749   UINT8 subinstr = (op & 0x00e0) >> 5;
1750   op &= ~0x00e0;
1751
1752   switch (subinstr)
1753   {
1754      case 0x00: size = arcompact_handle18_00_dasm(DASM_PARAMS); break; // LD_S (SP)
1755      case 0x01: size = arcompact_handle18_01_dasm(DASM_PARAMS); break; // LDB_S (SP)
1756      case 0x02: size = arcompact_handle18_02_dasm(DASM_PARAMS); break; // ST_S (SP)
1757      case 0x03: size = arcompact_handle18_03_dasm(DASM_PARAMS); break; // STB_S (SP)
1758      case 0x04: size = arcompact_handle18_04_dasm(DASM_PARAMS); break; // ADD_S (SP)
1759      case 0x05: size = arcompact_handle18_05_dasm(DASM_PARAMS); break; // subtable 18_05
1760      case 0x06: size = arcompact_handle18_06_dasm(DASM_PARAMS); break; // subtable 18_06
1761      case 0x07: size = arcompact_handle18_07_dasm(DASM_PARAMS); break; // subtable 18_07
1762   }
1763
1764   return size;
1765}
1766
1767// op bits remaining for 0x18_xx subgroups 0x071f
1768
1769int arcompact_handle18_00_dasm(DASM_OPS_16)
1770{
1771   print("LD_S (SP) (%04x)",  op);
1772   return 2;
1773}
1774
1775int arcompact_handle18_01_dasm(DASM_OPS_16)
1776{
1777   print("LDB_S (SP) (%04x)",  op);
1778   return 2;
1779}
1780
1781int arcompact_handle18_02_dasm(DASM_OPS_16)
1782{
1783   print("ST_S (SP) (%04x)",  op);
1784   return 2;
1785}
1786
1787int arcompact_handle18_03_dasm(DASM_OPS_16)
1788{
1789   print("STB_S (SP) (%04x)",  op);
1790   return 2;
1791}
1792
1793int arcompact_handle18_04_dasm(DASM_OPS_16)
1794{
1795   print("ADD_S (SP) (%04x)",  op);
1796   return 2;
1797}
1798
1799
1800
1801
1802
1803int arcompact_handle18_05_dasm(DASM_OPS_16)
1804{
1805   int size = 2;
1806   UINT8 subinstr2 = (op & 0x0700) >> 8;
1807   op &= ~0x001f;
1808
1809   switch (subinstr2)
1810   {
1811      case 0x00: size = arcompact_handle18_05_00_dasm(DASM_PARAMS); break; // ADD_S (SP)
1812      case 0x01: size = arcompact_handle18_05_01_dasm(DASM_PARAMS); break; // SUB_S (SP)
1813      case 0x02: size = arcompact_handle18_05_02_dasm(DASM_PARAMS); break; // <illegal 0x18_05_02>
1814      case 0x03: size = arcompact_handle18_05_03_dasm(DASM_PARAMS); break; // <illegal 0x18_05_03>
1815      case 0x04: size = arcompact_handle18_05_04_dasm(DASM_PARAMS); break; // <illegal 0x18_05_04>
1816      case 0x05: size = arcompact_handle18_05_05_dasm(DASM_PARAMS); break; // <illegal 0x18_05_05>
1817      case 0x06: size = arcompact_handle18_05_06_dasm(DASM_PARAMS); break; // <illegal 0x18_05_06>
1818      case 0x07: size = arcompact_handle18_05_07_dasm(DASM_PARAMS); break; // <illegal 0x18_05_07>
1819   }
1820
1821   return size;
1822}
1823// op bits remaining for 0x18_05_xx subgroups 0x001f
1824int arcompact_handle18_05_00_dasm(DASM_OPS_16)
1825{
1826   int u = op & 0x001f;
1827   op &= ~0x001f; // all bits now used
1828
1829   print("ADD_S %02x (SP)", u);
1830   return 2;
1831
1832}
1833
1834int arcompact_handle18_05_01_dasm(DASM_OPS_16)
1835{
1836   int u = op & 0x001f;
1837   op &= ~0x001f; // all bits now used
1838
1839   print("SUB_S %02x (SP)", u);
1840   return 2;
1841}
1842
1843
1844int arcompact_handle18_05_02_dasm(DASM_OPS_16)  { print("<illegal 0x18_05_02> (%04x)", op); return 2;}
1845int arcompact_handle18_05_03_dasm(DASM_OPS_16)  { print("<illegal 0x18_05_03> (%04x)", op); return 2;}
1846int arcompact_handle18_05_04_dasm(DASM_OPS_16)  { print("<illegal 0x18_05_04> (%04x)", op); return 2;}
1847int arcompact_handle18_05_05_dasm(DASM_OPS_16)  { print("<illegal 0x18_05_05> (%04x)", op); return 2;}
1848int arcompact_handle18_05_06_dasm(DASM_OPS_16)  { print("<illegal 0x18_05_06> (%04x)", op); return 2;}
1849int arcompact_handle18_05_07_dasm(DASM_OPS_16)  { print("<illegal 0x18_05_07> (%04x)", op); return 2;}
1850
1851
1852int arcompact_handle18_06_dasm(DASM_OPS_16)
1853{
1854   int size = 2;
1855   UINT8 subinstr2 = (op & 0x001f) >> 0;
1856   op &= ~0x001f;
1857
1858   switch (subinstr2)
1859   {
1860      case 0x00: size = arcompact_handle18_06_00_dasm(DASM_PARAMS); break; // <illegal 0x18_06_00>
1861      case 0x01: size = arcompact_handle18_06_01_dasm(DASM_PARAMS); break; // POP_S b
1862      case 0x02: size = arcompact_handle18_06_02_dasm(DASM_PARAMS); break; // <illegal 0x18_06_02>
1863      case 0x03: size = arcompact_handle18_06_03_dasm(DASM_PARAMS); break; // <illegal 0x18_06_03>
1864      case 0x04: size = arcompact_handle18_06_04_dasm(DASM_PARAMS); break; // <illegal 0x18_06_04>
1865      case 0x05: size = arcompact_handle18_06_05_dasm(DASM_PARAMS); break; // <illegal 0x18_06_05>
1866      case 0x06: size = arcompact_handle18_06_06_dasm(DASM_PARAMS); break; // <illegal 0x18_06_06>
1867      case 0x07: size = arcompact_handle18_06_07_dasm(DASM_PARAMS); break; // <illegal 0x18_06_07>
1868      case 0x08: size = arcompact_handle18_06_08_dasm(DASM_PARAMS); break; // <illegal 0x18_06_08>
1869      case 0x09: size = arcompact_handle18_06_09_dasm(DASM_PARAMS); break; // <illegal 0x18_06_09>
1870      case 0x0a: size = arcompact_handle18_06_0a_dasm(DASM_PARAMS); break; // <illegal 0x18_06_0a>
1871      case 0x0b: size = arcompact_handle18_06_0b_dasm(DASM_PARAMS); break; // <illegal 0x18_06_0b>
1872      case 0x0c: size = arcompact_handle18_06_0c_dasm(DASM_PARAMS); break; // <illegal 0x18_06_0c>
1873      case 0x0d: size = arcompact_handle18_06_0d_dasm(DASM_PARAMS); break; // <illegal 0x18_06_0d>
1874      case 0x0e: size = arcompact_handle18_06_0e_dasm(DASM_PARAMS); break; // <illegal 0x18_06_0e>
1875      case 0x0f: size = arcompact_handle18_06_0f_dasm(DASM_PARAMS); break; // <illegal 0x18_06_0f>
1876      case 0x10: size = arcompact_handle18_06_10_dasm(DASM_PARAMS); break; // <illegal 0x18_06_10>
1877      case 0x11: size = arcompact_handle18_06_11_dasm(DASM_PARAMS); break; // POP_S blink
1878      case 0x12: size = arcompact_handle18_06_12_dasm(DASM_PARAMS); break; // <illegal 0x18_06_12>
1879      case 0x13: size = arcompact_handle18_06_13_dasm(DASM_PARAMS); break; // <illegal 0x18_06_13>
1880      case 0x14: size = arcompact_handle18_06_14_dasm(DASM_PARAMS); break; // <illegal 0x18_06_14>
1881      case 0x15: size = arcompact_handle18_06_15_dasm(DASM_PARAMS); break; // <illegal 0x18_06_15>
1882      case 0x16: size = arcompact_handle18_06_16_dasm(DASM_PARAMS); break; // <illegal 0x18_06_16>
1883      case 0x17: size = arcompact_handle18_06_17_dasm(DASM_PARAMS); break; // <illegal 0x18_06_17>
1884      case 0x18: size = arcompact_handle18_06_18_dasm(DASM_PARAMS); break; // <illegal 0x18_06_18>
1885      case 0x19: size = arcompact_handle18_06_19_dasm(DASM_PARAMS); break; // <illegal 0x18_06_19>
1886      case 0x1a: size = arcompact_handle18_06_1a_dasm(DASM_PARAMS); break; // <illegal 0x18_06_1a>
1887      case 0x1b: size = arcompact_handle18_06_1b_dasm(DASM_PARAMS); break; // <illegal 0x18_06_1b>
1888      case 0x1c: size = arcompact_handle18_06_1c_dasm(DASM_PARAMS); break; // <illegal 0x18_06_1c>
1889      case 0x1d: size = arcompact_handle18_06_1d_dasm(DASM_PARAMS); break; // <illegal 0x18_06_1d>
1890      case 0x1e: size = arcompact_handle18_06_1e_dasm(DASM_PARAMS); break; // <illegal 0x18_06_1e>
1891      case 0x1f: size = arcompact_handle18_06_1f_dasm(DASM_PARAMS); break; // <illegal 0x18_06_1f>
1892   }
1893
1894   return size;
1895}
1896
1897
1898// op bits remaining for 0x18_06_xx subgroups 0x0700
1899int arcompact_handle18_06_00_dasm(DASM_OPS_16)  { print("<illegal 0x18_06_00> (%04x)",  op); return 2;}
1900
1901int arcompact_handle18_06_01_dasm(DASM_OPS_16)
1902{
1903   int b = (op & 0x0700) >> 8;
1904   op &= ~0x0700; // all bits now used
1905
1906   print("POP_S [%02x]", b);
1907
1908   return 2;
1909}
1910
1911int arcompact_handle18_06_02_dasm(DASM_OPS_16)  { print("<illegal 0x18_06_02> (%04x)", op); return 2;}
1912int arcompact_handle18_06_03_dasm(DASM_OPS_16)  { print("<illegal 0x18_06_03> (%04x)", op); return 2;}
1913int arcompact_handle18_06_04_dasm(DASM_OPS_16)  { print("<illegal 0x18_06_04> (%04x)", op); return 2;}
1914int arcompact_handle18_06_05_dasm(DASM_OPS_16)  { print("<illegal 0x18_06_05> (%04x)", op); return 2;}
1915int arcompact_handle18_06_06_dasm(DASM_OPS_16)  { print("<illegal 0x18_06_06> (%04x)", op); return 2;}
1916int arcompact_handle18_06_07_dasm(DASM_OPS_16)  { print("<illegal 0x18_06_07> (%04x)", op); return 2;}
1917int arcompact_handle18_06_08_dasm(DASM_OPS_16)  { print("<illegal 0x18_06_08> (%04x)", op); return 2;}
1918int arcompact_handle18_06_09_dasm(DASM_OPS_16)  { print("<illegal 0x18_06_09> (%04x)", op); return 2;}
1919int arcompact_handle18_06_0a_dasm(DASM_OPS_16)  { print("<illegal 0x18_06_0a> (%04x)", op); return 2;}
1920int arcompact_handle18_06_0b_dasm(DASM_OPS_16)  { print("<illegal 0x18_06_0b> (%04x)", op); return 2;}
1921int arcompact_handle18_06_0c_dasm(DASM_OPS_16)  { print("<illegal 0x18_06_0c> (%04x)", op); return 2;}
1922int arcompact_handle18_06_0d_dasm(DASM_OPS_16)  { print("<illegal 0x18_06_0d> (%04x)", op); return 2;}
1923int arcompact_handle18_06_0e_dasm(DASM_OPS_16)  { print("<illegal 0x18_06_0e> (%04x)", op); return 2;}
1924int arcompact_handle18_06_0f_dasm(DASM_OPS_16)  { print("<illegal 0x18_06_0f> (%04x)", op); return 2;}
1925int arcompact_handle18_06_10_dasm(DASM_OPS_16)  { print("<illegal 0x18_06_10> (%04x)", op); return 2;}
1926
1927int arcompact_handle18_06_11_dasm(DASM_OPS_16)
1928{
1929   int res = (op & 0x0700) >> 8;
1930   op &= ~0x0700; // all bits now used
1931
1932   if (res)
1933      print("POP_S [BLINK] (Reserved Bits set %04x)", op);
1934   else
1935      print("POP_S [BLINK]");
1936
1937   return 2;
1938}
1939
1940int arcompact_handle18_06_12_dasm(DASM_OPS_16)  { print("<illegal 0x18_06_12> (%04x)",  op); return 2;}
1941int arcompact_handle18_06_13_dasm(DASM_OPS_16)  { print("<illegal 0x18_06_13> (%04x)",  op); return 2;}
1942int arcompact_handle18_06_14_dasm(DASM_OPS_16)  { print("<illegal 0x18_06_14> (%04x)",  op); return 2;}
1943int arcompact_handle18_06_15_dasm(DASM_OPS_16)  { print("<illegal 0x18_06_15> (%04x)",  op); return 2;}
1944int arcompact_handle18_06_16_dasm(DASM_OPS_16)  { print("<illegal 0x18_06_16> (%04x)",  op); return 2;}
1945int arcompact_handle18_06_17_dasm(DASM_OPS_16)  { print("<illegal 0x18_06_17> (%04x)",  op); return 2;}
1946int arcompact_handle18_06_18_dasm(DASM_OPS_16)  { print("<illegal 0x18_06_18> (%04x)",  op); return 2;}
1947int arcompact_handle18_06_19_dasm(DASM_OPS_16)  { print("<illegal 0x18_06_19> (%04x)",  op); return 2;}
1948int arcompact_handle18_06_1a_dasm(DASM_OPS_16)  { print("<illegal 0x18_06_1a> (%04x)",  op); return 2;}
1949int arcompact_handle18_06_1b_dasm(DASM_OPS_16)  { print("<illegal 0x18_06_1b> (%04x)",  op); return 2;}
1950int arcompact_handle18_06_1c_dasm(DASM_OPS_16)  { print("<illegal 0x18_06_1c> (%04x)",  op); return 2;}
1951int arcompact_handle18_06_1d_dasm(DASM_OPS_16)  { print("<illegal 0x18_06_1d> (%04x)",  op); return 2;}
1952int arcompact_handle18_06_1e_dasm(DASM_OPS_16)  { print("<illegal 0x18_06_1e> (%04x)",  op); return 2;}
1953int arcompact_handle18_06_1f_dasm(DASM_OPS_16)  { print("<illegal 0x18_06_1f> (%04x)",  op); return 2;}
1954
1955
1956
1957
1958int arcompact_handle18_07_dasm(DASM_OPS_16)
1959{
1960   int size = 2;
1961   UINT8 subinstr2 = (op & 0x001f) >> 0;
1962   op &= ~0x001f;
1963
1964   switch (subinstr2)
1965   {
1966      case 0x00: size = arcompact_handle18_07_00_dasm(DASM_PARAMS); break; // <illegal 0x18_07_00>
1967      case 0x01: size = arcompact_handle18_07_01_dasm(DASM_PARAMS); break; // PUSH_S b
1968      case 0x02: size = arcompact_handle18_07_02_dasm(DASM_PARAMS); break; // <illegal 0x18_07_02>
1969      case 0x03: size = arcompact_handle18_07_03_dasm(DASM_PARAMS); break; // <illegal 0x18_07_03>
1970      case 0x04: size = arcompact_handle18_07_04_dasm(DASM_PARAMS); break; // <illegal 0x18_07_04>
1971      case 0x05: size = arcompact_handle18_07_05_dasm(DASM_PARAMS); break; // <illegal 0x18_07_05>
1972      case 0x06: size = arcompact_handle18_07_06_dasm(DASM_PARAMS); break; // <illegal 0x18_07_06>
1973      case 0x07: size = arcompact_handle18_07_07_dasm(DASM_PARAMS); break; // <illegal 0x18_07_07>
1974      case 0x08: size = arcompact_handle18_07_08_dasm(DASM_PARAMS); break; // <illegal 0x18_07_08>
1975      case 0x09: size = arcompact_handle18_07_09_dasm(DASM_PARAMS); break; // <illegal 0x18_07_09>
1976      case 0x0a: size = arcompact_handle18_07_0a_dasm(DASM_PARAMS); break; // <illegal 0x18_07_0a>
1977      case 0x0b: size = arcompact_handle18_07_0b_dasm(DASM_PARAMS); break; // <illegal 0x18_07_0b>
1978      case 0x0c: size = arcompact_handle18_07_0c_dasm(DASM_PARAMS); break; // <illegal 0x18_07_0c>
1979      case 0x0d: size = arcompact_handle18_07_0d_dasm(DASM_PARAMS); break; // <illegal 0x18_07_0d>
1980      case 0x0e: size = arcompact_handle18_07_0e_dasm(DASM_PARAMS); break; // <illegal 0x18_07_0e>
1981      case 0x0f: size = arcompact_handle18_07_0f_dasm(DASM_PARAMS); break; // <illegal 0x18_07_0f>
1982      case 0x10: size = arcompact_handle18_07_10_dasm(DASM_PARAMS); break; // <illegal 0x18_07_10>
1983      case 0x11: size = arcompact_handle18_07_11_dasm(DASM_PARAMS); break; // PUSH_S blink
1984      case 0x12: size = arcompact_handle18_07_12_dasm(DASM_PARAMS); break; // <illegal 0x18_07_12>
1985      case 0x13: size = arcompact_handle18_07_13_dasm(DASM_PARAMS); break; // <illegal 0x18_07_13>
1986      case 0x14: size = arcompact_handle18_07_14_dasm(DASM_PARAMS); break; // <illegal 0x18_07_14>
1987      case 0x15: size = arcompact_handle18_07_15_dasm(DASM_PARAMS); break; // <illegal 0x18_07_15>
1988      case 0x16: size = arcompact_handle18_07_16_dasm(DASM_PARAMS); break; // <illegal 0x18_07_16>
1989      case 0x17: size = arcompact_handle18_07_17_dasm(DASM_PARAMS); break; // <illegal 0x18_07_17>
1990      case 0x18: size = arcompact_handle18_07_18_dasm(DASM_PARAMS); break; // <illegal 0x18_07_18>
1991      case 0x19: size = arcompact_handle18_07_19_dasm(DASM_PARAMS); break; // <illegal 0x18_07_19>
1992      case 0x1a: size = arcompact_handle18_07_1a_dasm(DASM_PARAMS); break; // <illegal 0x18_07_1a>
1993      case 0x1b: size = arcompact_handle18_07_1b_dasm(DASM_PARAMS); break; // <illegal 0x18_07_1b>
1994      case 0x1c: size = arcompact_handle18_07_1c_dasm(DASM_PARAMS); break; // <illegal 0x18_07_1c>
1995      case 0x1d: size = arcompact_handle18_07_1d_dasm(DASM_PARAMS); break; // <illegal 0x18_07_1d>
1996      case 0x1e: size = arcompact_handle18_07_1e_dasm(DASM_PARAMS); break; // <illegal 0x18_07_1e>
1997      case 0x1f: size = arcompact_handle18_07_1f_dasm(DASM_PARAMS); break; // <illegal 0x18_07_1f>
1998   }
1999
2000   return size;
2001}
2002
2003
2004// op bits remaining for 0x18_07_xx subgroups 0x0700
2005int arcompact_handle18_07_00_dasm(DASM_OPS_16)  { print("<illegal 0x18_07_00> (%04x)",  op); return 2;}
2006
2007int arcompact_handle18_07_01_dasm(DASM_OPS_16)
2008{
2009   int b = (op & 0x0700) >> 8;
2010   op &= ~0x0700; // all bits now used
2011
2012   print("PUSH_S [%02x]", b);
2013
2014   return 2;
2015}
2016
2017int arcompact_handle18_07_02_dasm(DASM_OPS_16)  { print("<illegal 0x18_07_02> (%04x)", op); return 2;}
2018int arcompact_handle18_07_03_dasm(DASM_OPS_16)  { print("<illegal 0x18_07_03> (%04x)", op); return 2;}
2019int arcompact_handle18_07_04_dasm(DASM_OPS_16)  { print("<illegal 0x18_07_04> (%04x)", op); return 2;}
2020int arcompact_handle18_07_05_dasm(DASM_OPS_16)  { print("<illegal 0x18_07_05> (%04x)", op); return 2;}
2021int arcompact_handle18_07_06_dasm(DASM_OPS_16)  { print("<illegal 0x18_07_06> (%04x)", op); return 2;}
2022int arcompact_handle18_07_07_dasm(DASM_OPS_16)  { print("<illegal 0x18_07_07> (%04x)", op); return 2;}
2023int arcompact_handle18_07_08_dasm(DASM_OPS_16)  { print("<illegal 0x18_07_08> (%04x)", op); return 2;}
2024int arcompact_handle18_07_09_dasm(DASM_OPS_16)  { print("<illegal 0x18_07_09> (%04x)", op); return 2;}
2025int arcompact_handle18_07_0a_dasm(DASM_OPS_16)  { print("<illegal 0x18_07_0a> (%04x)", op); return 2;}
2026int arcompact_handle18_07_0b_dasm(DASM_OPS_16)  { print("<illegal 0x18_07_0b> (%04x)", op); return 2;}
2027int arcompact_handle18_07_0c_dasm(DASM_OPS_16)  { print("<illegal 0x18_07_0c> (%04x)", op); return 2;}
2028int arcompact_handle18_07_0d_dasm(DASM_OPS_16)  { print("<illegal 0x18_07_0d> (%04x)", op); return 2;}
2029int arcompact_handle18_07_0e_dasm(DASM_OPS_16)  { print("<illegal 0x18_07_0e> (%04x)", op); return 2;}
2030int arcompact_handle18_07_0f_dasm(DASM_OPS_16)  { print("<illegal 0x18_07_0f> (%04x)", op); return 2;}
2031int arcompact_handle18_07_10_dasm(DASM_OPS_16)  { print("<illegal 0x18_07_10> (%04x)", op); return 2;}
2032
2033int arcompact_handle18_07_11_dasm(DASM_OPS_16)
2034{
2035   int res = (op & 0x0700) >> 8;
2036   op &= ~0x0700; // all bits now used
2037
2038   if (res)
2039      print("PUSH_S [BLINK] (Reserved Bits set %04x)", op);
2040   else
2041      print("PUSH_S [BLINK]");
2042
2043   return 2;
2044}
2045
2046int arcompact_handle18_07_12_dasm(DASM_OPS_16)  { print("<illegal 0x18_07_12> (%04x)",  op); return 2;}
2047int arcompact_handle18_07_13_dasm(DASM_OPS_16)  { print("<illegal 0x18_07_13> (%04x)",  op); return 2;}
2048int arcompact_handle18_07_14_dasm(DASM_OPS_16)  { print("<illegal 0x18_07_14> (%04x)",  op); return 2;}
2049int arcompact_handle18_07_15_dasm(DASM_OPS_16)  { print("<illegal 0x18_07_15> (%04x)",  op); return 2;}
2050int arcompact_handle18_07_16_dasm(DASM_OPS_16)  { print("<illegal 0x18_07_16> (%04x)",  op); return 2;}
2051int arcompact_handle18_07_17_dasm(DASM_OPS_16)  { print("<illegal 0x18_07_17> (%04x)",  op); return 2;}
2052int arcompact_handle18_07_18_dasm(DASM_OPS_16)  { print("<illegal 0x18_07_18> (%04x)",  op); return 2;}
2053int arcompact_handle18_07_19_dasm(DASM_OPS_16)  { print("<illegal 0x18_07_19> (%04x)",  op); return 2;}
2054int arcompact_handle18_07_1a_dasm(DASM_OPS_16)  { print("<illegal 0x18_07_1a> (%04x)",  op); return 2;}
2055int arcompact_handle18_07_1b_dasm(DASM_OPS_16)  { print("<illegal 0x18_07_1b> (%04x)",  op); return 2;}
2056int arcompact_handle18_07_1c_dasm(DASM_OPS_16)  { print("<illegal 0x18_07_1c> (%04x)",  op); return 2;}
2057int arcompact_handle18_07_1d_dasm(DASM_OPS_16)  { print("<illegal 0x18_07_1d> (%04x)",  op); return 2;}
2058int arcompact_handle18_07_1e_dasm(DASM_OPS_16)  { print("<illegal 0x18_07_1e> (%04x)",  op); return 2;}
2059int arcompact_handle18_07_1f_dasm(DASM_OPS_16)  { print("<illegal 0x18_07_1f> (%04x)",  op); return 2;}
2060
2061
2062int arcompact_handle19_dasm(DASM_OPS_16)
2063{
2064   int size = 2;
2065   UINT8 subinstr = (op & 0x0600) >> 9;
2066   op &= ~0x0600;
2067
2068   switch (subinstr)
2069   {
2070      case 0x00: size = arcompact_handle19_00_dasm(DASM_PARAMS); break; // LD_S (GP)
2071      case 0x01: size = arcompact_handle19_01_dasm(DASM_PARAMS); break; // LDB_S (GP)
2072      case 0x02: size = arcompact_handle19_02_dasm(DASM_PARAMS); break; // LDW_S (GP)
2073      case 0x03: size = arcompact_handle19_03_dasm(DASM_PARAMS); break; // ADD_S (GP)
2074   }
2075   return size;
2076}
2077
2078int arcompact_handle19_00_dasm(DASM_OPS_16)  { print("LD_S r0 <- m[GP + s11].long (%04x)",  op); return 2;}
2079int arcompact_handle19_01_dasm(DASM_OPS_16)  { print("LDB_S r0 <- m[GP + s9].byte (%04x)",  op); return 2;}
2080int arcompact_handle19_02_dasm(DASM_OPS_16)  { print("LDW_S r0 <- m[GP + s10].word (%04x)",  op); return 2;}
2081int arcompact_handle19_03_dasm(DASM_OPS_16)  { print("ADD_S r0 <- GP + s11 (%04x)",  op); return 2;}
2082
2083
2084
2085int arcompact_handle1a_dasm(DASM_OPS_16)
2086{
2087   print("PCL Instr (%04x)", op);
2088   return 2;
2089}
2090
2091int arcompact_handle1b_dasm(DASM_OPS_16)
2092{
2093   print("MOV_S (%04x)", op);
2094   return 2;
2095}
2096
2097int arcompact_handle1c_dasm(DASM_OPS_16)
2098{
2099   int size = 2;
2100   UINT8 subinstr = (op & 0x0080) >> 7;
2101   op &= ~0x0080;
2102
2103   switch (subinstr)
2104   {
2105      case 0x00: size = arcompact_handle1c_00_dasm(DASM_PARAMS); break; // ADD_S
2106      case 0x01: size = arcompact_handle1c_01_dasm(DASM_PARAMS); break; // CMP_S
2107   }
2108   return size;
2109}
2110
2111int arcompact_handle1c_00_dasm(DASM_OPS_16)  { print("ADD_S b <- b + u7 (%04x)",  op); return 2;}
2112int arcompact_handle1c_01_dasm(DASM_OPS_16)  { print("CMP_S b - u7 (%04x)",  op); return 2;}
2113
2114
2115int arcompact_handle1d_dasm(DASM_OPS_16)
2116{
2117   int size = 2;
2118   UINT8 subinstr = (op & 0x0080) >> 7;
2119   op &= ~0x0080;
2120
2121   switch (subinstr)
2122   {
2123      case 0x00: size = arcompact_handle1d_00_dasm(DASM_PARAMS); break; // BREQ_S
2124      case 0x01: size = arcompact_handle1d_01_dasm(DASM_PARAMS); break; // BRNE_S
2125   }
2126   return size;
2127}
2128
2129int arcompact_handle1d_00_dasm(DASM_OPS_16)  { print("BREQ_S (%04x)",  op); return 2;}
2130int arcompact_handle1d_01_dasm(DASM_OPS_16)  { print("BRNE_S (%04x)",  op); return 2;}
2131
2132
2133int arcompact_handle1e_dasm(DASM_OPS_16)
2134{
2135   int size = 2;
2136   UINT8 subinstr = (op & 0x0600) >> 9;
2137   op &= ~0x0600;
2138
2139   switch (subinstr)
2140   {
2141      case 0x00: size = arcompact_handle1e_00_dasm(DASM_PARAMS); break; // B_S
2142      case 0x01: size = arcompact_handle1e_01_dasm(DASM_PARAMS); break; // BEQ_S
2143      case 0x02: size = arcompact_handle1e_02_dasm(DASM_PARAMS); break; // BNE_S
2144      case 0x03: size = arcompact_handle1e_03_dasm(DASM_PARAMS); break; // Bcc_S
2145   }
2146   return size;
2147}
2148
2149int arcompact_handle1e_00_dasm(DASM_OPS_16)  { print("B_S (%04x)",  op); return 2;}
2150int arcompact_handle1e_01_dasm(DASM_OPS_16)  { print("BEQ_S (%04x)",  op); return 2;}
2151int arcompact_handle1e_02_dasm(DASM_OPS_16)  { print("BNE_S (%04x)",  op); return 2;}
2152
2153
2154int arcompact_handle1e_03_dasm(DASM_OPS_16)
2155{
2156   
2157   int size = 2;
2158   UINT8 subinstr2 = (op & 0x01c0) >> 6;
2159   op &= ~0x01c0;
2160
2161   switch (subinstr2)
2162   {
2163      case 0x00: size = arcompact_handle1e_03_00_dasm(DASM_PARAMS); break; // BGT_S
2164      case 0x01: size = arcompact_handle1e_03_01_dasm(DASM_PARAMS); break; // BGE_S
2165      case 0x02: size = arcompact_handle1e_03_02_dasm(DASM_PARAMS); break; // BLT_S
2166      case 0x03: size = arcompact_handle1e_03_03_dasm(DASM_PARAMS); break; // BLE_S
2167      case 0x04: size = arcompact_handle1e_03_04_dasm(DASM_PARAMS); break; // BHI_S
2168      case 0x05: size = arcompact_handle1e_03_05_dasm(DASM_PARAMS); break; // BHS_S
2169      case 0x06: size = arcompact_handle1e_03_06_dasm(DASM_PARAMS); break; // BLO_S
2170      case 0x07: size = arcompact_handle1e_03_07_dasm(DASM_PARAMS); break; // BLS_S
2171   }
2172   return size;
2173
2174}
2175
2176int arcompact_handle1e_03_00_dasm(DASM_OPS_16)  { print("BGT_S (%04x)",  op); return 2;}
2177int arcompact_handle1e_03_01_dasm(DASM_OPS_16)  { print("BGE_S (%04x)",  op); return 2;}
2178int arcompact_handle1e_03_02_dasm(DASM_OPS_16)  { print("BLT_S (%04x)",  op); return 2;}
2179int arcompact_handle1e_03_03_dasm(DASM_OPS_16)  { print("BLE_S (%04x)",  op); return 2;}
2180int arcompact_handle1e_03_04_dasm(DASM_OPS_16)  { print("BHI_S (%04x)",  op); return 2;}
2181int arcompact_handle1e_03_05_dasm(DASM_OPS_16)  { print("BHS_S (%04x)",  op); return 2;}
2182int arcompact_handle1e_03_06_dasm(DASM_OPS_16)  { print("BLO_S (%04x)",  op); return 2;}
2183int arcompact_handle1e_03_07_dasm(DASM_OPS_16)  { print("BLS_S (%04x)",  op); return 2;}
2184
2185
2186
2187int arcompact_handle1f_dasm(DASM_OPS_16)
2188{
2189   print("BL_S (%04x)", op);
2190   return 2;
2191}
2192
2193CPU_DISASSEMBLE(arcompact)
2194{
2195   int size = 2;
2196
2197   UINT32 op = oprom[0] | (oprom[1] << 8);
2198   output = buffer;
2199
2200   UINT8 instruction = ARCOMPACT_OPERATION;
2201
2202   if (instruction < 0x0c)
2203   {
2204      size = 4;
2205      op <<= 16;
2206      op |= oprom[2] | (oprom[3] << 8);
2207
2208      op &= ~0xf8000000;
2209
2210      switch (instruction) // 32-bit instructions (with optional extra dword for immediate data)
2211      {
2212         case 0x00: size = arcompact_handle00_dasm(DASM_PARAMS);   break; // Bcc
2213         case 0x01: size = arcompact_handle01_dasm(DASM_PARAMS);   break; // BLcc/BRcc
2214         case 0x02: size = arcompact_handle02_dasm(DASM_PARAMS);   break; // LD r+o
2215         case 0x03: size = arcompact_handle03_dasm(DASM_PARAMS);   break; // ST r+o
2216         case 0x04: size = arcompact_handle04_dasm(DASM_PARAMS);   break; // op a,b,c (basecase)
2217         case 0x05: size = arcompact_handle05_dasm(DASM_PARAMS);   break; // op a,b,c (05 ARC ext)
2218         case 0x06: size = arcompact_handle06_dasm(DASM_PARAMS);   break; // op a,b,c (06 ARC ext)
2219         case 0x07: size = arcompact_handle07_dasm(DASM_PARAMS);   break; // op a,b,c (07 User ext)
2220         case 0x08: size = arcompact_handle08_dasm(DASM_PARAMS);   break; // op a,b,c (08 User ext)
2221         case 0x09: size = arcompact_handle09_dasm(DASM_PARAMS);   break; // op a,b,c (09 Market ext)
2222         case 0x0a: size = arcompact_handle0a_dasm(DASM_PARAMS);   break; // op a,b,c (0a Market ext)
2223         case 0x0b: size = arcompact_handle0b_dasm(DASM_PARAMS);   break; // op a,b,c (0b Market ext)
370         default:
371            print("%s (%04x)", basic[instruction], op & ~0xf800);
372            break;
2224373      }
2225374   }
2226   else
2227   {   
2228      size = 2;
2229      op &= ~0xf800;
2230375
2231376
2232      switch (instruction) // 16-bit instructions
2233      {
2234         case 0x0c: size = arcompact_handle0c_dasm(DASM_PARAMS);   break; // Load/Add reg-reg
2235         case 0x0d: size = arcompact_handle0d_dasm(DASM_PARAMS);   break; // Add/Sub/Shft imm
2236         case 0x0e: size = arcompact_handle0e_dasm(DASM_PARAMS);   break; // Mov/Cmp/Add
2237         case 0x0f: size = arcompact_handle0f_dasm(DASM_PARAMS);   break; // op_S b,b,c (single 16-bit ops)
2238         case 0x10: size = arcompact_handle10_dasm(DASM_PARAMS);   break; // LD_S
2239         case 0x11: size = arcompact_handle11_dasm(DASM_PARAMS);   break; // LDB_S
2240         case 0x12: size = arcompact_handle12_dasm(DASM_PARAMS);   break; // LDW_S
2241         case 0x13: size = arcompact_handle13_dasm(DASM_PARAMS);   break; // LSW_S.X
2242         case 0x14: size = arcompact_handle14_dasm(DASM_PARAMS);   break; // ST_S
2243         case 0x15: size = arcompact_handle15_dasm(DASM_PARAMS);   break; // STB_S
2244         case 0x16: size = arcompact_handle16_dasm(DASM_PARAMS);   break; // STW_S
2245         case 0x17: size = arcompact_handle17_dasm(DASM_PARAMS);   break; // Shift/Sub/Bit
2246         case 0x18: size = arcompact_handle18_dasm(DASM_PARAMS);   break; // Stack Instr
2247         case 0x19: size = arcompact_handle19_dasm(DASM_PARAMS);   break; // GP Instr
2248         case 0x1a: size = arcompact_handle1a_dasm(DASM_PARAMS);   break; // PCL Instr
2249         case 0x1b: size = arcompact_handle1b_dasm(DASM_PARAMS);   break; // MOV_S
2250         case 0x1c: size = arcompact_handle1c_dasm(DASM_PARAMS);   break; // ADD_S/CMP_S
2251         case 0x1d: size = arcompact_handle1d_dasm(DASM_PARAMS);   break; // BRcc_S
2252         case 0x1e: size = arcompact_handle1e_dasm(DASM_PARAMS);   break; // Bcc_S
2253         case 0x1f: size = arcompact_handle1f_dasm(DASM_PARAMS);   break; // BL_S
2254      }
2255   }
2256
2257377   return size | DASMFLAG_SUPPORTED;
2258378}
trunk/src/emu/cpu/m68000/m68kdasm.c
r242301r242302
17181718   sprintf(g_dasm_str, "extb.l  D%d; (2+)", g_cpu_ir&7);
17191719}
17201720
1721static void d68881_ftrap(void)
1722{
1723   UINT16 w2, w3;
1724   UINT32 l2;
1725
1726   LIMIT_CPU_TYPES(M68020_PLUS);
1727   w2 = read_imm_16();
1728
1729   switch (g_cpu_ir & 0x7)
1730   {
1731      case 2:   // word operand
1732         w3 = read_imm_16();
1733         sprintf(g_dasm_str, "ftrap%s.w   $%04x", g_cpcc[w2 & 0x3f], w3);
1734         break;
1735
1736      case 3:   // long word operand
1737         l2 = read_imm_32();
1738         sprintf(g_dasm_str, "ftrap%s.l   $%08x", g_cpcc[w2 & 0x3f], l2);
1739         break;
1740
1741      case 4: // no operand
1742         sprintf(g_dasm_str, "ftrap%s", g_cpcc[w2 & 0x3f]);
1743         break;
1744   }
1745}
1746
17471721static void d68040_fpu(void)
17481722{
17491723   char float_data_format[8][3] =
r242301r242302
34823456   {d68020_bfins        , 0xffc0, 0xefc0, 0xa78},
34833457   {d68020_bfset        , 0xffc0, 0xeec0, 0xa78},
34843458   {d68020_bftst        , 0xffc0, 0xe8c0, 0xa7b},
3485   {d68881_ftrap        , 0xfff8, 0xf278, 0x000},
34863459   {d68010_bkpt         , 0xfff8, 0x4848, 0x000},
34873460   {d68000_bra_8        , 0xff00, 0x6000, 0x000},
34883461   {d68000_bra_16       , 0xffff, 0x6000, 0x000},
trunk/src/emu/cpu/tms0980/tms0980.c
r242301r242302
7878#define M_CKM               0x00000040 /* CKB to MEM */
7979#define M_CKN               0x00000080 /* CKB to -ALU */
8080#define M_CKP               0x00000100 /* CKB to +ALU */
81#define M_MTN               0x00000200 /* MEM to -ALU */
82#define M_MTP               0x00000400 /* MEM to +ALU */
83#define M_NATN              0x00000800 /* ~ACC to -ALU */
84#define M_NE                0x00001000 /* COMP to STATUS */
85#define M_STO               0x00002000 /* ACC to MEM */
86#define M_STSL              0x00004000 /* STATUS to Status Latch */
87#define M_YTP               0x00008000 /* Y to +ALU */
81#define M_CME               0x00000200 /* Conditional Memory Enable */
82#define M_DMTP              0x00000400 /* DAM to +ALU */
83#define M_MTN               0x00000800 /* MEM to -ALU */
84#define M_MTP               0x00001000 /* MEM to +ALU */
85#define M_NATN              0x00002000 /* ~ACC to -ALU */
86#define M_NDMTP             0x00004000 /* ~DAM to +ALU */
87#define M_NE                0x00008000 /* COMP to STATUS */
88#define M_SSE               0x00010000 /* Special Status Enable */
89#define M_SSS               0x00020000 /* Special Status Sample */
90#define M_STO               0x00040000 /* ACC to MEM */
91#define M_STSL              0x00080000 /* STATUS to Status Latch */
92#define M_YTP               0x00100000 /* Y to +ALU */
8893
89#define M_CME               0x00010000 /* Conditional Memory Enable */
90#define M_DMTP              0x00020000 /* DAM to +ALU */
91#define M_NDMTP             0x00040000 /* ~DAM to +ALU */
92#define M_SSE               0x00080000 /* Special Status Enable */
93#define M_SSS               0x00100000 /* Special Status Sample */
94
95#define M_RSTR              0x00200000 /* -> line #36, F_RSTR (TMC02x0 custom) */
96#define M_UNK1              0x00400000 /* -> line #37, F_???? (TMC0270 custom) */
97
9894/* Standard/fixed instructions - these are documented more in their specific handlers below */
9995#define F_BR                0x00000001
10096#define F_CALL              0x00000002
r242301r242302
104100#define F_COMX8             0x00000020
105101#define F_LDP               0x00000040
106102#define F_LDX               0x00000080
107#define F_RBIT              0x00000100
108#define F_RETN              0x00000200
109#define F_RSTR              0x00000400
110#define F_SBIT              0x00000800
111#define F_SETR              0x00001000
112#define F_TDO               0x00002000
113
114#define F_OFF               0x00004000
115#define F_REAC              0x00008000
116#define F_SAL               0x00010000
117#define F_SBL               0x00020000
118#define F_SEAC              0x00040000
103#define F_OFF               0x00000100
104#define F_RBIT              0x00000200
105#define F_REAC              0x00000400
106#define F_RETN              0x00000800
107#define F_RSTR              0x00001000
108#define F_SAL               0x00002000
109#define F_SBIT              0x00004000
110#define F_SBL               0x00008000
111#define F_SEAC              0x00010000
112#define F_SETR              0x00020000
113#define F_TDO               0x00040000
119114#define F_XDA               0x00080000
120115
121116
122117// supported types:
123// note: dice information assumes the orientation is pictured with RAM at the bottom-left, except where noted
118// note: dice information assumes the orientation is pictured with RAM at the bottom-left
124119
125120// TMS1000
126121// - 64x4bit RAM array at the bottom-left
r242301r242302
132127// - 20-term output PLA(opla) at the top-left
133128// - the ALU is between the opla and mpla
134129const device_type TMS1000 = &device_creator<tms1000_cpu_device>; // 28-pin DIP, 11 R pins
135const device_type TMS1070 = &device_creator<tms1070_cpu_device>; // same as tms1000, just supports higher voltage
136130const device_type TMS1200 = &device_creator<tms1200_cpu_device>; // 40-pin DIP, 13 R pins
131const device_type TMS1070 = &device_creator<tms1070_cpu_device>; // same as tms1000, just supports higher voltage
137132// TMS1270 has 10 O pins, how does that work?
138133
139134// TMS1100 is nearly the same as TMS1000, some different opcodes, and with double the RAM and ROM
r242301r242302
145140// - 2048x9bit ROM array at the bottom-left
146141// - main instructions PLA at the top half, to the right of the midline
147142// - 64-term microinstructions PLA between the RAM and ROM, supporting 20 microinstructions
148// - 16-term output PLA and segment PLA above the RAM (rotate opla 90 degrees)
149const device_type TMS0980 = &device_creator<tms0980_cpu_device>; // 28-pin DIP, 9 R pins, 5 K pins
143// - 16-term output PLA and segment PLA above the RAM
144const device_type TMS0980 = &device_creator<tms0980_cpu_device>; // 28-pin DIP, 9 R pins
150145
151146// TMS0970 is a stripped-down version of the TMS0980, itself acting more like a TMS1000
152// - RAM and ROM is exactly the same as TMS1000
147// - 64x4bit RAM array at the bottom-left
148// - 1024x8bit ROM array at the bottom-right
153149// - main instructions PLA at the top half, to the right of the midline
154150// - 32-term microinstructions PLA between the RAM and ROM, supporting 15 microinstructions
155// - 16-term output PLA and segment PLA above the RAM (rotate opla 90 degrees)
151// - 16-term output PLA and segment PLA above the RAM
156152const device_type TMS0970 = &device_creator<tms0970_cpu_device>; // 28-pin DIP, 11 R pins
157153
158// TMC0270 on the other hand, is a TMS0980 with earrings and a new hat. The new changes look like a quick afterthought, almost hacky
159// - RAM, ROM, and main instructions PLA is exactly the same as TMS0980
160// - 64-term microinstructions PLA between the RAM and ROM, supporting 20 microinstructions plus optional separate lines for custom opcode handling
161// - 48-term output PLA above the RAM (rotate opla 90 degrees)
162const device_type TMC0270 = &device_creator<tmc0270_cpu_device>; // 40-pin DIP, 16 O pins, 8 R pins (the other R pins are internally hooked up to support more I/O)
163// TMC0260 is same? except opla is 32 instead of 48 terms
164154
165
166155static ADDRESS_MAP_START(program_11bit_9, AS_PROGRAM, 16, tms1xxx_cpu_device)
167156   AM_RANGE(0x000, 0xfff) AM_ROM
168157ADDRESS_MAP_END
r242301r242302
243232{
244233}
245234
246tms0980_cpu_device::tms0980_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT8 o_pins, UINT8 r_pins, UINT8 k_pins, UINT8 pc_bits, UINT8 byte_bits, UINT8 x_bits, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source)
247   : tms0970_cpu_device(mconfig, type, name, tag, owner, clock, o_pins, r_pins, k_pins, pc_bits, byte_bits, x_bits, prgwidth, program, datawidth, data, shortname, source)
248{
249}
250235
251236
252tmc0270_cpu_device::tmc0270_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
253   : tms0980_cpu_device(mconfig, TMC0270, "TMC0270", tag, owner, clock, 16, 8, 4, 7, 9, 4, 12, ADDRESS_MAP_NAME(program_11bit_9), 8, ADDRESS_MAP_NAME(data_64x9_as4), "tmc0270", __FILE__)
254{
255}
256
257
258
259237static MACHINE_CONFIG_FRAGMENT(tms1000)
260238   
261239   // microinstructions PLA, output PLA
r242301r242302
309287}
310288
311289
312static MACHINE_CONFIG_FRAGMENT(tmc0270)
313290
314   // main opcodes PLA, microinstructions PLA, output PLA
315   MCFG_PLA_ADD("ipla", 9, 22, 24)
316   MCFG_PLA_FILEFORMAT(PLA_FMT_BERKELEY)
317   MCFG_PLA_ADD("mpla", 6, 22, 64)
318   MCFG_PLA_FILEFORMAT(PLA_FMT_BERKELEY)
319   MCFG_PLA_ADD("opla", 6, 16, 48)
320   MCFG_PLA_FILEFORMAT(PLA_FMT_BERKELEY)
321MACHINE_CONFIG_END
322
323machine_config_constructor tmc0270_cpu_device::device_mconfig_additions() const
324{
325   return MACHINE_CONFIG_NAME(tmc0270);
326}
327
328
329
330291offs_t tms1000_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options)
331292{
332293   extern CPU_DISASSEMBLE(tms1000);
r242301r242302
396357   m_cs = 0;
397358   m_r = 0;
398359   m_o = 0;
399   m_o_latch = 0;
400   m_o_latch_low = 0;
401360   m_cki_bus = 0;
402361   m_c4 = 0;
403362   m_p = 0;
r242301r242302
411370   m_clatch = 0;
412371   m_add = 0;
413372   m_bl = 0;
414   
373
415374   m_ram_in = 0;
416375   m_dam_in = 0;
417376   m_ram_out = 0;
r242301r242302
422381   m_micro = 0;
423382   m_subcycle = 0;
424383
425   m_a_prev = m_a;
426   m_r_prev = m_r;
427   m_o_latch_prev = m_o_latch;
428
429384   // register for savestates
430385   save_item(NAME(m_pc));
431386   save_item(NAME(m_sr));
r242301r242302
439394   save_item(NAME(m_cs));
440395   save_item(NAME(m_r));
441396   save_item(NAME(m_o));
442   save_item(NAME(m_o_latch));
443   save_item(NAME(m_o_latch_low));
444397   save_item(NAME(m_cki_bus));
445398   save_item(NAME(m_c4));
446399   save_item(NAME(m_p));
r242301r242302
465418   save_item(NAME(m_micro));
466419   save_item(NAME(m_subcycle));
467420
468   save_item(NAME(m_a_prev));
469   save_item(NAME(m_r_prev));
470   save_item(NAME(m_o_latch_prev));
471
472421   // register state for debugger
473422   state_add(TMS0980_PC,     "PC",     m_pc    ).formatstr("%02X");
474423   state_add(TMS0980_SR,     "SR",     m_sr    ).formatstr("%01X");
r242301r242302
513462   // clear outputs
514463   m_r = 0;
515464   m_write_r(0, m_r & m_r_mask, 0xffff);
516   m_o_latch_low = 0;
517   m_o_latch = 0;
518465   write_o_output(0);
519466   m_write_r(0, m_r & m_r_mask, 0xffff);
520   m_power_off(0);
521467}
522468
523469
r242301r242302
624570   sel = BITSWAP8(sel,7,6,0,1,2,3,4,5); // lines are reversed
625571   UINT32 mask = m_mpla->read(sel);
626572   mask ^= 0x43fc3; // invert active-negative
627   
628   // M_RSTR is specific to TMC02x0, it redirects to F_RSTR
629   // M_UNK1 is specific to TMC0270, unknown yet
573
630574   //                      _______  ______                                _____  _____  _____  _____  ______  _____  ______  _____                            _____
631   const UINT32 md[22] = { M_NDMTP, M_DMTP, M_AUTY, M_AUTA, M_CKM, M_SSE, M_CKP, M_YTP, M_MTP, M_ATN, M_NATN, M_MTN, M_15TN, M_CKN, M_NE, M_C8, M_SSS, M_CME, M_CIN, M_STO, M_RSTR, M_UNK1 };
575   const UINT32 md[20] = { M_NDMTP, M_DMTP, M_AUTY, M_AUTA, M_CKM, M_SSE, M_CKP, M_YTP, M_MTP, M_ATN, M_NATN, M_MTN, M_15TN, M_CKN, M_NE, M_C8, M_SSS, M_CME, M_CIN, M_STO };
632576   
633   for (int bit = 0; bit < 22 && bit < m_mpla->outputs(); bit++)
577   for (int bit = 0; bit < 20; bit++)
634578      if (mask & (1 << bit))
635579         decode |= md[bit];
636580   
r242301r242302
675619
676620
677621
678//-------------------------------------------------
679//  program counter/opcode decode
680//-------------------------------------------------
681622
623
682624void tms1xxx_cpu_device::next_pc()
683625{
684626   // The program counter is a LFSR. To put it simply, the feedback bit is a XOR of the two highest bits,
r242301r242302
724666   next_pc();
725667}
726668
727void tmc0270_cpu_device::read_opcode()
728{
729   tms0980_cpu_device::read_opcode();
730   
731   // RSTR is on the mpla
732   if (m_micro & M_RSTR)
733      m_fixed |= F_RSTR;
734   
735   // TODO: M_UNK1
736}
737669
738
739
740//-------------------------------------------------
741//  i/o handling
742//-------------------------------------------------
743
744670void tms1xxx_cpu_device::write_o_output(UINT8 data)
745671{
746672   // a hardcoded table is supported if the output pla is unknown
747673   m_o = (c_output_pla == NULL) ? m_opla->read(data) : c_output_pla[data];
674   
675   if ((m_o & 0xff00) == 0xff00)
676      logerror("unknown output pla mapping for index %02X\n", data);
677   
748678   m_write_o(0, m_o & m_o_mask, 0xffff);
749679}
750680
r242301r242302
754684   m_write_o(0, m_o & m_o_mask, 0xffff);
755685}
756686
757
758void tmc0270_cpu_device::dynamic_output()
759{
760   // TODO..
761   
762   m_a_prev = m_a;
763   m_r_prev = m_r;
764   m_o_latch_prev = m_o_latch;
765}
766
767
768687UINT8 tms1xxx_cpu_device::read_k_input()
769688{
770689   // K1,2,4,8,3 (KC test pin is not emulated)
r242301r242302
773692   return (k & 0xf) | k3;
774693}
775694
776UINT8 tmc0270_cpu_device::read_k_input()
777{
778   // TODO..
779   
780   return tms1xxx_cpu_device::read_k_input();
781}
782695
783
784696void tms1xxx_cpu_device::set_cki_bus()
785697{
786698   switch (m_opcode & 0xf8)
r242301r242302
834746}
835747
836748
749// fixed opcode set
837750
838//-------------------------------------------------
839//  fixed opcode set
840//-------------------------------------------------
841
842751// TMS1000/common:
843752
844753void tms1xxx_cpu_device::op_sbit()
r242301r242302
932841}
933842
934843
935// TMS0970-specific (and possibly child classes)
844// TMS09x0-specific
936845void tms0970_cpu_device::op_setr()
937846{
938847   // SETR: set output register
r242301r242302
949858}
950859
951860
952// TMS0980-specific (and possibly child classes)
861// TMS0980-specific
953862void tms0980_cpu_device::op_comx()
954863{
955864   // COMX: complement X register, but not the MSB
r242301r242302
965874
966875void tms1xxx_cpu_device::op_off()
967876{
968   // OFF: request auto power-off
877   // OFF: request power off
878   logerror("%s: power-off request\n", tag());
969879   m_power_off(1);
970880}
971881
r242301r242302
994904}
995905
996906
997// TMC0270-specific
998void tmc0270_cpu_device::op_tdo()
907void tms1xxx_cpu_device::execute_fixed_opcode()
999908{
1000   // TDO: transfer data out
1001   if (m_status)
1002      m_o_latch_low = m_a;
1003   else
1004      m_o_latch = m_o_latch_low | (m_a << 4 & 0x30);
1005   
1006   // handled further in dynamic_output
909   switch (m_fixed)
910   {
911      case F_SBIT: op_sbit(); break;
912      case F_RBIT: op_rbit(); break;
913      case F_SETR: op_setr(); break;
914      case F_RSTR: op_rstr(); break;
915      case F_TDO:  op_tdo();  break;
916      case F_CLO:  op_clo();  break;
917      case F_LDX:  op_ldx();  break;
918      case F_COMX: op_comx(); break;
919      case F_COMX8:op_comx8();break;
920      case F_LDP:  op_ldp();  break;
921      case F_COMC: op_comc(); break;
922      case F_OFF:  op_off();  break;
923      case F_SEAC: op_seac(); break;
924      case F_REAC: op_reac(); break;
925      case F_SAL:  op_sal();  break;
926      case F_SBL:  op_sbl();  break;
927      case F_XDA:  op_xda();  break;
928     
929      default:
930         // BR, CALL, RETN are handled in execute_run
931         if (m_fixed & ~(F_BR | F_CALL | F_RETN))
932            fatalerror("%s unsupported fixed opcode %03X %04X!\n", tag(), m_opcode, m_fixed);
933         break;
934   }
1007935}
1008936
1009937
1010938
1011//-------------------------------------------------
1012//  execute_run
1013//-------------------------------------------------
1014
1015939void tms1xxx_cpu_device::execute_run()
1016940{
1017941   do
r242301r242302
1071995
1072996         // execute: k input valid, read ram, clear alu inputs
1073997         set_cki_bus();
1074         dynamic_output();
1075998         m_ram_in = m_data->read_byte(m_ram_address) & 0xf;
1076999         m_dam_in = m_data->read_byte(m_ram_address | (0x10 << (m_x_bits-1))) & 0xf;
10771000         m_ram_out = -1;
r242301r242302
11331056         if (m_micro & M_STO || (m_micro & M_CME && m_eac == m_add))
11341057            m_ram_out = m_a;
11351058
1136         // handle the other fixed opcodes here
1137         if (m_fixed & F_SBIT)  op_sbit();
1138         if (m_fixed & F_RBIT)  op_rbit();
1139         if (m_fixed & F_SETR)  op_setr();
1140         if (m_fixed & F_RSTR)  op_rstr();
1141         if (m_fixed & F_TDO)   op_tdo();
1142         if (m_fixed & F_CLO)   op_clo();
1143         if (m_fixed & F_LDX)   op_ldx();
1144         if (m_fixed & F_COMX)  op_comx();
1145         if (m_fixed & F_COMX8) op_comx8();
1146         if (m_fixed & F_LDP)   op_ldp();
1147         if (m_fixed & F_COMC)  op_comc();
1148         if (m_fixed & F_OFF)   op_off();
1149         if (m_fixed & F_SEAC)  op_seac();
1150         if (m_fixed & F_REAC)  op_reac();
1151         if (m_fixed & F_SAL)   op_sal();
1152         if (m_fixed & F_SBL)   op_sbl();
1153         if (m_fixed & F_XDA)   op_xda();
1059         // handle the fixed opcodes here
1060         execute_fixed_opcode();
11541061
11551062         // execute: write ram
11561063         if (m_ram_out != -1)
trunk/src/emu/cpu/tms0980/tms0980.h
r242301r242302
8383   void state_string_export(const device_state_entry &entry, astring &string);
8484
8585   void next_pc();
86
86   void execute_fixed_opcode();
87   
8788   virtual void write_o_output(UINT8 data);
8889   virtual UINT8 read_k_input();
8990   virtual void set_cki_bus();
90   virtual void dynamic_output() { ; } // not used by default
9191   virtual void read_opcode();
9292
9393   virtual void op_sbit();
r242301r242302
122122   UINT8   m_pa;        // 4-bit page address register
123123   UINT8   m_pb;        // 4-bit page buffer register
124124   UINT8   m_a;         // 4-bit accumulator
125   UINT8   m_a_prev;
126125   UINT8   m_x;         // 2,3,or 4-bit RAM X register
127126   UINT8   m_y;         // 4-bit RAM Y register
128127   UINT8   m_ca;        // chapter address bit
129128   UINT8   m_cb;        // chapter buffer bit
130129   UINT8   m_cs;        // chapter subroutine bit
131130   UINT16  m_r;
132   UINT16  m_r_prev;
133131   UINT16  m_o;
134   UINT8   m_o_latch;   // TMC0270 hold latch
135   UINT8   m_o_latch_low;
136   UINT8   m_o_latch_prev;
137132   UINT8   m_cki_bus;
138133   UINT8   m_c4;
139134   UINT8   m_p;         // 4-bit adder p(lus)-input
r242301r242302
263258{
264259public:
265260   tms0980_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
266   tms0980_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT8 o_pins, UINT8 r_pins, UINT8 k_pins, UINT8 pc_bits, UINT8 byte_bits, UINT8 x_bits, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source);
267261
268262protected:
269263   // overrides
r242301r242302
279273   virtual void read_opcode();
280274   
281275   virtual void op_comx();
282
276private:
283277   UINT32 decode_micro(UINT8 sel);
284278};
285279
286280
287class tmc0270_cpu_device : public tms0980_cpu_device
288{
289public:
290   tmc0270_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
291281
292protected:
293   // overrides
294   virtual machine_config_constructor device_mconfig_additions() const;
295
296   virtual void write_o_output(UINT8 data) { tms1xxx_cpu_device::write_o_output(data); }
297   virtual UINT8 read_k_input();
298   virtual void dynamic_output();
299   virtual void read_opcode();
300   
301   virtual void op_setr() { tms1xxx_cpu_device::op_setr(); }
302   virtual void op_rstr() { tms1xxx_cpu_device::op_rstr(); }
303   virtual void op_tdo();
304};
305
306
307
308282extern const device_type TMS1000;
309283extern const device_type TMS1070;
310284extern const device_type TMS1200;
r242301r242302
312286extern const device_type TMS1300;
313287extern const device_type TMS0970;
314288extern const device_type TMS0980;
315extern const device_type TMC0270;
316289
317290
318291#endif /* _TMS0980_H_ */
trunk/src/emu/debug/dvmemory.c
r242301r242302
6161      m_memintf(NULL),
6262      m_base(region.base()),
6363      m_length(region.bytes()),
64      m_offsetxor(ENDIAN_VALUE_NE_NNE(region.endianness(), 0, region.bytewidth() - 1)),
64      m_offsetxor(NATIVE_ENDIAN_VALUE_LE_BE(region.bytewidth() - 1, 0)),
6565      m_endianness(region.endianness()),
6666      m_prefsize(MIN(region.bytewidth(), 8))
6767{
trunk/src/emu/emucore.h
r242301r242302
239239#define NATIVE_ENDIAN_VALUE_LE_BE(leval,beval)  ENDIAN_VALUE_LE_BE(ENDIANNESS_NATIVE, leval, beval)
240240
241241// endian-based value: first value is if 'endian' matches native, second is if 'endian' doesn't match native
242#define ENDIAN_VALUE_NE_NNE(endian,neval,nneval) (((endian) == ENDIANNESS_NATIVE) ? (neval) : (nneval))
242#define ENDIAN_VALUE_NE_NNE(endian,leval,beval) (((endian) == ENDIANNESS_NATIVE) ? (neval) : (nneval))
243243
244244
245245// useful macros to deal with bit shuffling encryptions
trunk/src/emu/machine/64h156.c
r242301r242302
190190      return true;
191191
192192   if(bit && cur_live.write_position < ARRAY_LENGTH(cur_live.write_buffer))
193      cur_live.write_buffer[cur_live.write_position++] = cur_live.tm - m_period;
193      cur_live.write_buffer[cur_live.write_position++] = cur_live.tm;
194194
195195   if (LOG) logerror("%s write bit %u (%u)\n", cur_live.tm.as_string(), cur_live.bit_counter, bit);
196196
trunk/src/emu/machine/fdc_pll.c
r242301r242302
2222void fdc_pll_t::reset(const attotime &when)
2323{
2424   ctime = when;
25   write_ctime = when;
2625   phase_adjust = attotime::zero;
2726   freq_hist = 0;
2827   write_position = 0;
r242301r242302
6665   if(next > limit)
6766      return -1;
6867
69   write_ctime = ctime;
7068   ctime = next;
7169   tm = next;
7270
r242301r242302
132130   ctime = etime;
133131   return false;
134132}
135
136bool fdc_pll_t::write_next_bit_prev_cell(bool bit, attotime &tm, floppy_image_device *floppy, const attotime &limit)
137{
138   if(write_start_time.is_never()) {
139      write_start_time = write_ctime;
140      write_position = 0;
141   }
142
143   attotime etime = write_ctime + period;
144   if(etime > limit)
145      return true;
146
147   if(bit && write_position < ARRAY_LENGTH(write_buffer))
148      write_buffer[write_position++] = write_ctime + period/2;
149
150   return false;
151}
trunk/src/emu/machine/fdc_pll.h
r242301r242302
1212public:
1313   attotime ctime, period, min_period, max_period, period_adjust_base, phase_adjust;
1414
15   attotime write_ctime;
1615   attotime write_start_time;
1716   attotime write_buffer[32];
1817   int write_position;
r242301r242302
2221   void reset(const attotime &when);
2322   int get_next_bit(attotime &tm, floppy_image_device *floppy, const attotime &limit);
2423   bool write_next_bit(bool bit, attotime &tm, floppy_image_device *floppy, const attotime &limit);
25   bool write_next_bit_prev_cell(bool bit, attotime &tm, floppy_image_device *floppy, const attotime &limit);
2624   void start_writing(const attotime &tm);
2725   void commit(floppy_image_device *floppy, const attotime &tm);
2826   void stop_writing(floppy_image_device *floppy, const attotime &tm);
trunk/src/emu/machine/machine.mak
r242301r242302
13041304
13051305#-------------------------------------------------
13061306#
1307#@src/emu/machine/r10788.h,MACHINES += R10788
1308#-------------------------------------------------
1309
1310ifneq ($(filter R10788,$(MACHINES)),)
1311MACHINEOBJS+= $(MACHINEOBJ)/r10788.o
1312endif
1313
1314#-------------------------------------------------
1315#
13161307#@src/emu/machine/rf5c296.h,MACHINES += RF5C296
13171308#-------------------------------------------------
13181309
trunk/src/emu/machine/pci.c
r242301r242302
1313   AM_RANGE(0x0c, 0x0f) AM_READ8      (latency_timer_r,                          0x0000ff00)
1414   AM_RANGE(0x0c, 0x0f) AM_READ8      (header_type_r,                            0x00ff0000)
1515   AM_RANGE(0x0c, 0x0f) AM_READ8      (bist_r,                                   0xff000000)
16   AM_RANGE(0x0c, 0x0f) AM_WRITENOP
1716   AM_RANGE(0x10, 0x27) AM_READWRITE  (address_base_r,      address_base_w)
18   // Cardbus CIS pointer at 28
17
1918   AM_RANGE(0x2c, 0x2f) AM_READ16     (subvendor_r,                              0x0000ffff)
2019   AM_RANGE(0x2c, 0x2f) AM_READ16     (subsystem_r,                              0xffff0000)
2120   AM_RANGE(0x2c, 0x2f) AM_WRITENOP
22   AM_RANGE(0x30, 0x33) AM_READWRITE  (expansion_base_r,    expansion_base_w)
21
2322   AM_RANGE(0x34, 0x37) AM_READ8      (capptr_r,                                 0x000000ff)
2423ADDRESS_MAP_END
2524
r242301r242302
8988
9089   bank_count = 0;
9190   bank_reg_count = 0;
92
93   expansion_rom = 0;
94   expansion_rom_size = 0;
95   expansion_rom_base = 0;
9691}
9792
9893void pci_device::device_reset()
r242301r242302
214209   return subsystem_id;
215210}
216211
217READ32_MEMBER(pci_device::expansion_base_r)
218{
219   return expansion_rom_base;
220}
221
222
223WRITE32_MEMBER(pci_device::expansion_base_w)
224{
225   COMBINE_DATA(&expansion_rom_base);
226   if(!expansion_rom_size)
227      expansion_rom_base = 0;
228   else {
229      // Trick to get an address resolution at expansion_rom_size with minimal granularity of 0x800, plus bit 1 set to keep the on/off information
230      expansion_rom_base &= 0xfffff801 & (1-expansion_rom_size);
231   }
232   remap_cb();
233}
234
235212READ8_MEMBER(pci_device::capptr_r)
236213{
237214   return 0x00;
r242301r242302
279256      case 5: space->install_readwrite_handler(start, end, 0, 0, read32_delegate(FUNC(pci_device::unmapped5_r), this), write32_delegate(FUNC(pci_device::unmapped5_w), this)); break;
280257      }
281258      space->install_device_delegate(start, end, *this, bi.map);
282      logerror("%s: map %s at %0*x-%0*x\n", tag(), bi.map.name(), bi.flags & M_IO ? 4 : 8, UINT32(start), bi.flags & M_IO ? 4 : 8, UINT32(end));
283259   }
284260
285261   map_extra(memory_window_start, memory_window_end, memory_offset, memory_space,
286262            io_window_start, io_window_end, io_offset, io_space);
287
288   if(expansion_rom_base & 1) {
289      logerror("%s: map expansion rom at %08x-%08x\n", tag(), expansion_rom_base & ~1, (expansion_rom_base & ~1) + expansion_rom_size - 1);
290      UINT32 start = (expansion_rom_base & ~1) + memory_offset;
291      UINT32 end = start + expansion_rom_size - 1;
292      if(end > memory_window_end)
293         end = memory_window_end;
294      memory_space->install_rom(start, end, (void *)expansion_rom);
295   }
296263}
297264
298265void pci_device::map_extra(UINT64 memory_window_start, UINT64 memory_window_end, UINT64 memory_offset, address_space *memory_space,
r242301r242302
338305   logerror("Device %s (%s) has 0x%" I64FMT "x bytes of %s named %s\n", tag(), name(), size, flags & M_IO ? "io" : "memory", map.name());
339306}
340307
341void pci_device::add_rom(const UINT8 *rom, UINT32 size)
342{
343   expansion_rom = rom;
344   expansion_rom_size = size;
345   logerror("Device %s (%s) has 0x%x bytes of expansion rom\n", tag(), name(), size);
346}
347
348void pci_device::add_rom_from_region()
349{
350   add_rom(m_region->base(), m_region->bytes());
351}
352
353308agp_device::agp_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
354309   : pci_device(mconfig, type, name, tag, owner, clock, shortname, source)
355310{
r242301r242302
707662   logerror("%s: iolimitu_w %04x\n", tag(), data);
708663}
709664
665READ32_MEMBER (pci_bridge_device::expansion_base_r)
666{
667   logerror("%s: expansion_base_r\n", tag());
668   return 0xffffffff;
669}
670
671WRITE32_MEMBER(pci_bridge_device::expansion_base_w)
672{
673   logerror("%s: expansion_base_w %08x\n", tag(), data);
674}
675
710676READ8_MEMBER  (pci_bridge_device::interrupt_line_r)
711677{
712678   logerror("%s: interrupt_line_r\n", tag());
trunk/src/emu/machine/pci.h
r242301r242302
7474   DECLARE_WRITE32_MEMBER(address_base_w);
7575   DECLARE_READ16_MEMBER(subvendor_r);
7676   DECLARE_READ16_MEMBER(subsystem_r);
77   DECLARE_READ32_MEMBER (expansion_base_r);
78   DECLARE_WRITE32_MEMBER(expansion_base_w);
7977   virtual DECLARE_READ8_MEMBER(capptr_r);
8078
8179protected:
r242301r242302
106104   UINT32 pclass;
107105   UINT8 revision;
108106   UINT16 command, command_mask, status;
109   const UINT8 *expansion_rom;
110   UINT32 expansion_rom_size;
111   UINT32 expansion_rom_base;
112107
113108   virtual void device_start();
114109   virtual void device_reset();
r242301r242302
121116      address_map_delegate delegate(map, name, static_cast<T *>(this));
122117      add_map(size, flags, delegate);
123118   }
124
125   void add_rom(const UINT8 *data, UINT32 size);
126   void add_rom_from_region();
127119};
128120
129121class agp_device : public pci_device {
r242301r242302
181173   DECLARE_WRITE16_MEMBER(iobaseu_w);
182174   DECLARE_READ16_MEMBER (iolimitu_r);
183175   DECLARE_WRITE16_MEMBER(iolimitu_w);
176   DECLARE_READ32_MEMBER (expansion_base_r);
177   DECLARE_WRITE32_MEMBER(expansion_base_w);
184178   DECLARE_READ8_MEMBER  (interrupt_line_r);
185179   DECLARE_WRITE8_MEMBER (interrupt_line_w);
186180   DECLARE_READ8_MEMBER  (interrupt_pin_r);
trunk/src/emu/machine/r10788.c
r242301r242302
1/**********************************************************************
2
3    Rockwell 10788 General Purpose Keyboard and Display circuit
4
5    Copyright Nicola Salmoria and the MAME Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8
9    REGISTER DESCRIPTION
10
11
12                 [ Opcodes IOL, I2 ]
13    NAME   W/IO   CS I/O    CMD I/O    Names
14    --------------------------------------------------------------
15    KTR    1      1 x x x   1 1 0 0    Transfer Keyboard Return
16    KTS    1      1 x x x   1 0 1 0    Transfer Keyboard Strobe
17    KLA    1      1 x x x   1 1 1 0    Load Display Register A
18    KLB    1      1 x x x   1 1 0 1    Load Display Register A
19    KDN    1      1 x x x   0 0 1 1    Turn On Display
20    KAF    1      1 x x x   1 0 1 1    Turn Off A
21    KBF    1      1 x x x   0 1 1 1    Turn Off B
22    KER    1      1 x x x   0 1 1 0    Reset Keyboard Error
23
24    Notes:
25    1.) W/IO is generated by the first word of the PPS IOL instruction.
26    2.) Polarities of I/O7, I/O6 and I/O5 must be the same as the
27        polarities of the chip select straps SC7, SC6 and SC5.
28    3.) KLA resets DA1-DA4 and DB1 and DB2 to VSS level. KLB resets
29        DB3 and DB4 to VSS level.
30    4.) KAF and KBF is used to blank the display without changing the
31        contents of display data registers.
32    5.) KAF resets output lines DA1, DA2, DA3, DA4, DB1 and DB2 to
33        VSS level. KBF resets output lines DB3 and DB4 to VSS level.
34    6.) KAF stops the circulation of the display register A, and KBF
35        stops the circulation of the display register B.
36    7.) KER takes a maximum of 10-bit times to complete (= 80 clocks)
37        Therefore, there must be at least 10 bit times between KER
38        and the next KTS instruction.
39**********************************************************************/
40
41#include "emu.h"
42#include "machine/r10788.h"
43
44#define   VERBOSE   1
45#if VERBOSE
46#define LOG(x) logerror x
47#else
48#define LOG(x)
49#endif
50
51/*************************************
52 *
53 *  Device interface
54 *
55 *************************************/
56
57const device_type R10788 = &device_creator<r10788_device>;
58
59r10788_device::r10788_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
60    : device_t(mconfig, R10788, "Rockwell 10788", tag, owner, clock, "r10788", __FILE__),
61        m_reg(),
62        m_ktr(0), m_kts(0), m_kla(0), m_klb(0), m_mask_a(15), m_mask_b(15), m_ker(0),
63        m_io_counter(0), m_scan_counter(0),
64        m_display(*this)
65{
66}
67
68/**
69 * @brief r10788_device::device_start device-specific startup
70 */
71void r10788_device::device_start()
72{
73    m_display.resolve();
74
75    save_item(NAME(m_reg));
76    save_item(NAME(m_ktr));
77    save_item(NAME(m_kts));
78    save_item(NAME(m_kla));
79    save_item(NAME(m_klb));
80    save_item(NAME(m_mask_a));
81    save_item(NAME(m_mask_b));
82    save_item(NAME(m_ker));
83    save_item(NAME(m_io_counter));
84    save_item(NAME(m_scan_counter));
85
86    m_timer = timer_alloc(TIMER_DISPLAY);
87    // recurring timer every 36 cycles
88    m_timer->adjust(clocks_to_attotime(36), 0, clocks_to_attotime(36));
89}
90
91/**
92 * @brief r10788_device::device_reset device-specific reset
93 */
94void r10788_device::device_reset()
95{
96    for (int i = 0; i < 16; i++)
97        m_reg[0][i] = m_reg[1][i] = 0;
98    m_ktr = 0;
99    m_kts = 0;
100    m_kla = 0;
101    m_klb = 0;
102    m_mask_a = 15;
103    m_mask_b = 15;
104    m_ker = 0;
105    m_scan_counter = 0;
106}
107
108
109/**
110 * @brief r10788_device::device_timer timer event callback
111 * @param timer emu_timer which fired
112 * @param id timer identifier
113 * @param param parameter
114 * @param ptr pointer parameter
115 */
116void r10788_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
117{
118    UINT8 data;
119    switch (id)
120    {
121        case TIMER_DISPLAY:
122            data = (m_reg[0][m_scan_counter] & m_mask_a) +
123                   16 * (m_reg[1][m_scan_counter] & m_mask_b);
124            LOG(("%s: scan counter:%2d data:%02x\n", __FUNCTION__, m_scan_counter, data));
125            m_display(m_scan_counter, data, 0xff);
126            break;
127        default:
128            LOG(("%s: invalid timer id:%d\n", __FUNCTION__, id));
129    }
130    m_scan_counter = (m_scan_counter + 1) % 16;
131}
132
133/*************************************
134 *
135 *  Constants
136 *
137 *************************************/
138
139/*************************************
140 *
141 *  Command access handlers
142 *
143 *************************************/
144
145WRITE8_MEMBER( r10788_device::io_w )
146{
147    assert(offset < 16);
148    switch (offset)
149    {
150        case KTR:  // Transfer Keyboard Return
151            LOG(("%s: KTR data:%02x\n", __FUNCTION__, data));
152            m_ktr = data;
153            break;
154        case KTS:  // Transfer Keyboard Strobe
155            LOG(("%s: KTS data:%02x\n", __FUNCTION__, data));
156            m_kts = data;
157            break;
158        case KLA:  // Load Display Register A
159            LOG(("%s: KLA [%2d] data:%02x\n", __FUNCTION__, m_io_counter, data));
160            m_kla = data;
161            m_reg[0][m_io_counter] = m_kla;
162            break;
163        case KLB:  // Load Display Register B
164            LOG(("%s: KLB [%2d] data:%02x\n", __FUNCTION__, m_io_counter, data));
165            m_klb = data;
166            m_reg[1][m_io_counter] = m_kla;
167            break;
168        case KDN:  // Turn On Display
169            LOG(("%s: KDN data:%02x\n", __FUNCTION__, data));
170            m_mask_a = 15;
171            m_mask_b = 15;
172            break;
173        case KAF:  // Turn Off A
174            LOG(("%s: KAF data:%02x\n", __FUNCTION__, data));
175            m_mask_a = 0;
176            m_mask_b &= ~3;
177            break;
178        case KBF:  // Turn Off B
179            LOG(("%s: KBF data:%02x\n", __FUNCTION__, data));
180            m_mask_b &= ~12;
181            break;
182        case KER:  // Reset Keyboard Error
183            LOG(("%s: KER data:%02x\n", __FUNCTION__, data));
184            m_ker = 10;
185            break;
186    }
187}
188
189
190READ8_MEMBER( r10788_device::io_r )
191{
192    assert(offset < 16);
193    UINT8 data = 0xf;
194    switch (offset)
195    {
196        case KTR:  // Transfer Keyboard Return
197            data = m_ktr;
198            LOG(("%s: KTR data:%02x\n", __FUNCTION__, data));
199            break;
200        case KTS:  // Transfer Keyboard Strobe
201            data = m_kts;
202            LOG(("%s: KTS data:%02x\n", __FUNCTION__, data));
203            break;
204        case KLA:  // Load Display Register A
205            m_kla = m_reg[0][m_io_counter];
206            data = m_kla;
207            LOG(("%s: KLA [%2d] data:%02x\n", __FUNCTION__, m_io_counter, data));
208            break;
209        case KLB:  // Load Display Register B
210            m_klb = m_reg[1][m_io_counter];
211            data = m_klb;
212            LOG(("%s: KLB [%2d] data:%02x\n", __FUNCTION__, m_io_counter, data));
213            // FIXME: does it automagically increment at KLB write?
214            m_io_counter = (m_io_counter + 1) % 16;
215            break;
216        case KDN:  // Turn On Display
217            LOG(("%s: KDN data:%02x\n", __FUNCTION__, data));
218            break;
219        case KAF:  // Turn Off A
220            LOG(("%s: KAF data:%02x\n", __FUNCTION__, data));
221            break;
222        case KBF:  // Turn Off B
223            LOG(("%s: KBF data:%02x\n", __FUNCTION__, data));
224            break;
225        case KER:  // Reset Keyboard Error
226            LOG(("%s: KER data:%02x\n", __FUNCTION__, data));
227            break;
228    }
229    return data;
230}
trunk/src/emu/machine/r10788.h
r242301r242302
1/**********************************************************************
2
3    Rockwell 10788 General Purpose Keyboard and Display circuit
4
5    Juergen Buchmueller <pullmoll@t-online.de>
6
7    The device decodes reads/write to a 16 byte I/O range defined
8    by three wired inputs SC5, SC6 and SC7. The range is one of
9    80-8f, 90-9f, ..., f0-ff depending on the wiring.
10
11**********************************************************************/
12
13#ifndef __R10788_H__
14#define __R10788_H__
15
16#include "device.h"
17
18/*************************************
19 *
20 *  Device configuration macros
21 *
22 *************************************/
23
24/* Set the writer used to update a display digit */
25#define MCFG_R10788_UPDATE(_devcb) \
26    r10788_device::set_update(*device, DEVCB_##_devcb);
27
28class r10788_device : public device_t
29{
30public:
31    r10788_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
32    ~r10788_device() {}
33
34    enum {
35        KTR = 0xc,  //!< Transfer Keyboard Return
36        KTS = 0xa,  //!< Transfer Keyboard Strobe
37        KLA = 0xe,  //!< Load Display Register A
38        KLB = 0xd,  //!< Load Display Register B
39        KDN = 0x3,  //!< Turn On Display
40        KAF = 0xb,  //!< Turn Off A
41        KBF = 0x7,  //!< Turn Off B
42        KER = 0x6   //!< Reset Keyboard Error
43    };
44
45    DECLARE_READ8_MEMBER ( io_r );
46    DECLARE_WRITE8_MEMBER( io_w );
47
48    template<class _Object> static devcb_base &set_update(device_t &device, _Object object) { return downcast<r10788_device &>(device).m_display.set_callback(object); }
49protected:
50    // device-level overrides
51    virtual void device_start();
52    virtual void device_reset();
53    virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
54
55private:
56    static const device_timer_id TIMER_DISPLAY = 0;
57
58    UINT8        m_reg[2][16];          //!< display registers
59    UINT8        m_ktr;                 //!< transfer keyboard return value
60    UINT8        m_kts;                 //!< transfer keyboard strobe value
61    UINT8        m_kla;                 //!< display register A value
62    UINT8        m_klb;                 //!< display register B value
63    UINT8        m_mask_a;              //!< display enable bits for A
64    UINT8        m_mask_b;              //!< display enable bits for B
65    UINT8        m_ker;                 //!< keyboard error value
66    int          m_io_counter;          //!< current I/O register index
67    int          m_scan_counter;        //!< current display scan
68    devcb_write8 m_display;             //!< display updater
69    emu_timer*   m_timer;               //!< timer running at clock / 18 / 36
70};
71
72extern const device_type R10788;
73
74#endif /* __R10788_H__ */
trunk/src/emu/mame.h
r242301r242302
120120//**************************************************************************
121121
122122extern const char build_version[];
123extern const char bare_build_version[];
123124
124125
125
126126/***************************************************************************
127127    FUNCTION PROTOTYPES
128128***************************************************************************/
trunk/src/emu/rendlay.c
r242301r242302
9494
9595enum
9696{
97    LINE_CAP_NONE = 0,
98    LINE_CAP_START = 1,
99    LINE_CAP_END = 2
97   LINE_CAP_NONE = 0,
98   LINE_CAP_START = 1,
99   LINE_CAP_END = 2
100100};
101101
102102
r242301r242302
120120
121121inline int gcd(int a, int b)
122122{
123    while (b != 0)
124    {
125        int t = b;
126        b = a % b;
127        a = t;
128    }
129    return a;
123   while (b != 0)
124   {
125      int t = b;
126      b = a % b;
127      a = t;
128   }
129   return a;
130130}
131131
132132
r242301r242302
137137
138138inline void reduce_fraction(int &num, int &den)
139139{
140    // search the greatest common divisor
141    int div = gcd(num, den);
140   // search the greatest common divisor
141   int div = gcd(num, den);
142142
143    // reduce the fraction if a common divisor has been found
144    if (div > 1)
145    {
146        num /= div;
147        den /= div;
148    }
143   // reduce the fraction if a common divisor has been found
144   if (div > 1)
145   {
146      num /= div;
147      den /= div;
148   }
149149}
150150
151151
r242301r242302
161161
162162static int get_variable_value(running_machine &machine, const char *string, char **outputptr)
163163{
164    char temp[100];
164   char temp[100];
165165
166    // screen 0 parameters
167    screen_device_iterator iter(machine.root_device());
168    int scrnum = 0;
169    for (const screen_device *device = iter.first(); device != NULL; device = iter.next(), scrnum++)
170    {
171        // native X aspect factor
172        sprintf(temp, "~scr%dnativexaspect~", scrnum);
173        if (!strncmp(string, temp, strlen(temp)))
174        {
175            int num = device->visible_area().width();
176            int den = device->visible_area().height();
177            reduce_fraction(num, den);
178            *outputptr += sprintf(*outputptr, "%d", num);
179            return strlen(temp);
180        }
166   // screen 0 parameters
167   screen_device_iterator iter(machine.root_device());
168   int scrnum = 0;
169   for (const screen_device *device = iter.first(); device != NULL; device = iter.next(), scrnum++)
170   {
171      // native X aspect factor
172      sprintf(temp, "~scr%dnativexaspect~", scrnum);
173      if (!strncmp(string, temp, strlen(temp)))
174      {
175         int num = device->visible_area().width();
176         int den = device->visible_area().height();
177         reduce_fraction(num, den);
178         *outputptr += sprintf(*outputptr, "%d", num);
179         return strlen(temp);
180      }
181181
182        // native Y aspect factor
183        sprintf(temp, "~scr%dnativeyaspect~", scrnum);
184        if (!strncmp(string, temp, strlen(temp)))
185        {
186            int num = device->visible_area().width();
187            int den = device->visible_area().height();
188            reduce_fraction(num, den);
189            *outputptr += sprintf(*outputptr, "%d", den);
190            return strlen(temp);
191        }
182      // native Y aspect factor
183      sprintf(temp, "~scr%dnativeyaspect~", scrnum);
184      if (!strncmp(string, temp, strlen(temp)))
185      {
186         int num = device->visible_area().width();
187         int den = device->visible_area().height();
188         reduce_fraction(num, den);
189         *outputptr += sprintf(*outputptr, "%d", den);
190         return strlen(temp);
191      }
192192
193        // native width
194        sprintf(temp, "~scr%dwidth~", scrnum);
195        if (!strncmp(string, temp, strlen(temp)))
196        {
197            *outputptr += sprintf(*outputptr, "%d", device->visible_area().width());
198            return strlen(temp);
199        }
193      // native width
194      sprintf(temp, "~scr%dwidth~", scrnum);
195      if (!strncmp(string, temp, strlen(temp)))
196      {
197         *outputptr += sprintf(*outputptr, "%d", device->visible_area().width());
198         return strlen(temp);
199      }
200200
201        // native height
202        sprintf(temp, "~scr%dheight~", scrnum);
203        if (!strncmp(string, temp, strlen(temp)))
204        {
205            *outputptr += sprintf(*outputptr, "%d", device->visible_area().height());
206            return strlen(temp);
207        }
208    }
201      // native height
202      sprintf(temp, "~scr%dheight~", scrnum);
203      if (!strncmp(string, temp, strlen(temp)))
204      {
205         *outputptr += sprintf(*outputptr, "%d", device->visible_area().height());
206         return strlen(temp);
207      }
208   }
209209
210    // default: copy the first character and continue
211    **outputptr = *string;
212    *outputptr += 1;
213    return 1;
210   // default: copy the first character and continue
211   **outputptr = *string;
212   *outputptr += 1;
213   return 1;
214214}
215215
216216
r242301r242302
222222
223223static const char *xml_get_attribute_string_with_subst(running_machine &machine, xml_data_node &node, const char *attribute, const char *defvalue)
224224{
225    const char *str = xml_get_attribute_string(&node, attribute, NULL);
226    static char buffer[1000];
225   const char *str = xml_get_attribute_string(&node, attribute, NULL);
226   static char buffer[1000];
227227
228    // if nothing, just return the default
229    if (str == NULL)
230        return defvalue;
228   // if nothing, just return the default
229   if (str == NULL)
230      return defvalue;
231231
232    // if no tildes, don't worry
233    if (strchr(str, '~') == NULL)
234        return str;
232   // if no tildes, don't worry
233   if (strchr(str, '~') == NULL)
234      return str;
235235
236    // make a copy of the string, doing substitutions along the way
237    const char *s;
238    char *d;
239    for (s = str, d = buffer; *s != 0; )
240    {
241        // if not a variable, just copy
242        if (*s != '~')
243            *d++ = *s++;
236   // make a copy of the string, doing substitutions along the way
237   const char *s;
238   char *d;
239   for (s = str, d = buffer; *s != 0; )
240   {
241      // if not a variable, just copy
242      if (*s != '~')
243         *d++ = *s++;
244244
245        // extract the variable
246        else
247            s += get_variable_value(machine, s, &d);
248    }
249    *d = 0;
250    return buffer;
245      // extract the variable
246      else
247         s += get_variable_value(machine, s, &d);
248   }
249   *d = 0;
250   return buffer;
251251}
252252
253253
r242301r242302
259259
260260static int xml_get_attribute_int_with_subst(running_machine &machine, xml_data_node &node, const char *attribute, int defvalue)
261261{
262    const char *string = xml_get_attribute_string_with_subst(machine, node, attribute, NULL);
263    int value;
262   const char *string = xml_get_attribute_string_with_subst(machine, node, attribute, NULL);
263   int value;
264264
265    if (string == NULL)
266        return defvalue;
267    if (string[0] == '$')
268        return (sscanf(&string[1], "%X", &value) == 1) ? value : defvalue;
269    if (string[0] == '0' && string[1] == 'x')
270        return (sscanf(&string[2], "%X", &value) == 1) ? value : defvalue;
271    if (string[0] == '#')
272        return (sscanf(&string[1], "%d", &value) == 1) ? value : defvalue;
273    return (sscanf(&string[0], "%d", &value) == 1) ? value : defvalue;
265   if (string == NULL)
266      return defvalue;
267   if (string[0] == '$')
268      return (sscanf(&string[1], "%X", &value) == 1) ? value : defvalue;
269   if (string[0] == '0' && string[1] == 'x')
270      return (sscanf(&string[2], "%X", &value) == 1) ? value : defvalue;
271   if (string[0] == '#')
272      return (sscanf(&string[1], "%d", &value) == 1) ? value : defvalue;
273   return (sscanf(&string[0], "%d", &value) == 1) ? value : defvalue;
274274}
275275
276276
r242301r242302
282282
283283static float xml_get_attribute_float_with_subst(running_machine &machine, xml_data_node &node, const char *attribute, float defvalue)
284284{
285    const char *string = xml_get_attribute_string_with_subst(machine, node, attribute, NULL);
286    float value;
285   const char *string = xml_get_attribute_string_with_subst(machine, node, attribute, NULL);
286   float value;
287287
288    if (string == NULL || sscanf(string, "%f", &value) != 1)
289        return defvalue;
290    return value;
288   if (string == NULL || sscanf(string, "%f", &value) != 1)
289      return defvalue;
290   return value;
291291}
292292
293293
r242301r242302
297297
298298void parse_bounds(running_machine &machine, xml_data_node *boundsnode, render_bounds &bounds)
299299{
300    // skip if nothing
301    if (boundsnode == NULL)
302    {
303        bounds.x0 = bounds.y0 = 0.0f;
304        bounds.x1 = bounds.y1 = 1.0f;
305        return;
306    }
300   // skip if nothing
301   if (boundsnode == NULL)
302   {
303      bounds.x0 = bounds.y0 = 0.0f;
304      bounds.x1 = bounds.y1 = 1.0f;
305      return;
306   }
307307
308    // parse out the data
309    if (xml_get_attribute(boundsnode, "left") != NULL)
310    {
311        // left/right/top/bottom format
312        bounds.x0 = xml_get_attribute_float_with_subst(machine, *boundsnode, "left", 0.0f);
313        bounds.x1 = xml_get_attribute_float_with_subst(machine, *boundsnode, "right", 1.0f);
314        bounds.y0 = xml_get_attribute_float_with_subst(machine, *boundsnode, "top", 0.0f);
315        bounds.y1 = xml_get_attribute_float_with_subst(machine, *boundsnode, "bottom", 1.0f);
316    }
317    else if (xml_get_attribute(boundsnode, "x") != NULL)
318    {
319        // x/y/width/height format
320        bounds.x0 = xml_get_attribute_float_with_subst(machine, *boundsnode, "x", 0.0f);
321        bounds.x1 = bounds.x0 + xml_get_attribute_float_with_subst(machine, *boundsnode, "width", 1.0f);
322        bounds.y0 = xml_get_attribute_float_with_subst(machine, *boundsnode, "y", 0.0f);
323        bounds.y1 = bounds.y0 + xml_get_attribute_float_with_subst(machine, *boundsnode, "height", 1.0f);
324    }
325    else
326        throw emu_fatalerror("Illegal bounds value in XML");
308   // parse out the data
309   if (xml_get_attribute(boundsnode, "left") != NULL)
310   {
311      // left/right/top/bottom format
312      bounds.x0 = xml_get_attribute_float_with_subst(machine, *boundsnode, "left", 0.0f);
313      bounds.x1 = xml_get_attribute_float_with_subst(machine, *boundsnode, "right", 1.0f);
314      bounds.y0 = xml_get_attribute_float_with_subst(machine, *boundsnode, "top", 0.0f);
315      bounds.y1 = xml_get_attribute_float_with_subst(machine, *boundsnode, "bottom", 1.0f);
316   }
317   else if (xml_get_attribute(boundsnode, "x") != NULL)
318   {
319      // x/y/width/height format
320      bounds.x0 = xml_get_attribute_float_with_subst(machine, *boundsnode, "x", 0.0f);
321      bounds.x1 = bounds.x0 + xml_get_attribute_float_with_subst(machine, *boundsnode, "width", 1.0f);
322      bounds.y0 = xml_get_attribute_float_with_subst(machine, *boundsnode, "y", 0.0f);
323      bounds.y1 = bounds.y0 + xml_get_attribute_float_with_subst(machine, *boundsnode, "height", 1.0f);
324   }
325   else
326      throw emu_fatalerror("Illegal bounds value in XML");
327327
328    // check for errors
329    if (bounds.x0 > bounds.x1 || bounds.y0 > bounds.y1)
330        throw emu_fatalerror("Illegal bounds value in XML: (%f-%f)-(%f-%f)", bounds.x0, bounds.x1, bounds.y0, bounds.y1);
328   // check for errors
329   if (bounds.x0 > bounds.x1 || bounds.y0 > bounds.y1)
330      throw emu_fatalerror("Illegal bounds value in XML: (%f-%f)-(%f-%f)", bounds.x0, bounds.x1, bounds.y0, bounds.y1);
331331}
332332
333333
r242301r242302
337337
338338void parse_color(running_machine &machine, xml_data_node *colornode, render_color &color)
339339{
340    // skip if nothing
341    if (colornode == NULL)
342    {
343        color.r = color.g = color.b = color.a = 1.0f;
344        return;
345    }
340   // skip if nothing
341   if (colornode == NULL)
342   {
343      color.r = color.g = color.b = color.a = 1.0f;
344      return;
345   }
346346
347    // parse out the data
348    color.r = xml_get_attribute_float_with_subst(machine, *colornode, "red", 1.0);
349    color.g = xml_get_attribute_float_with_subst(machine, *colornode, "green", 1.0);
350    color.b = xml_get_attribute_float_with_subst(machine, *colornode, "blue", 1.0);
351    color.a = xml_get_attribute_float_with_subst(machine, *colornode, "alpha", 1.0);
347   // parse out the data
348   color.r = xml_get_attribute_float_with_subst(machine, *colornode, "red", 1.0);
349   color.g = xml_get_attribute_float_with_subst(machine, *colornode, "green", 1.0);
350   color.b = xml_get_attribute_float_with_subst(machine, *colornode, "blue", 1.0);
351   color.a = xml_get_attribute_float_with_subst(machine, *colornode, "alpha", 1.0);
352352
353    // check for errors
354    if (color.r < 0.0 || color.r > 1.0 || color.g < 0.0 || color.g > 1.0 ||
355        color.b < 0.0 || color.b > 1.0 || color.a < 0.0 || color.a > 1.0)
356        throw emu_fatalerror("Illegal ARGB color value in XML: %f,%f,%f,%f", color.r, color.g, color.b, color.a);
353   // check for errors
354   if (color.r < 0.0 || color.r > 1.0 || color.g < 0.0 || color.g > 1.0 ||
355      color.b < 0.0 || color.b > 1.0 || color.a < 0.0 || color.a > 1.0)
356      throw emu_fatalerror("Illegal ARGB color value in XML: %f,%f,%f,%f", color.r, color.g, color.b, color.a);
357357}
358358
359359
r242301r242302
364364
365365static void parse_orientation(running_machine &machine, xml_data_node *orientnode, int &orientation)
366366{
367    // skip if nothing
368    if (orientnode == NULL)
369    {
370        orientation = ROT0;
371        return;
372    }
367   // skip if nothing
368   if (orientnode == NULL)
369   {
370      orientation = ROT0;
371      return;
372   }
373373
374    // parse out the data
375    int rotate = xml_get_attribute_int_with_subst(machine, *orientnode, "rotate", 0);
376    switch (rotate)
377    {
378        case 0:     orientation = ROT0;     break;
379        case 90:    orientation = ROT90;    break;
380        case 180:   orientation = ROT180;   break;
381        case 270:   orientation = ROT270;   break;
382        default:    throw emu_fatalerror("Invalid rotation in XML orientation node: %d", rotate);
383    }
384    if (strcmp("yes", xml_get_attribute_string_with_subst(machine, *orientnode, "swapxy", "no")) == 0)
385        orientation ^= ORIENTATION_SWAP_XY;
386    if (strcmp("yes", xml_get_attribute_string_with_subst(machine, *orientnode, "flipx", "no")) == 0)
387        orientation ^= ORIENTATION_FLIP_X;
388    if (strcmp("yes", xml_get_attribute_string_with_subst(machine, *orientnode, "flipy", "no")) == 0)
389        orientation ^= ORIENTATION_FLIP_Y;
374   // parse out the data
375   int rotate = xml_get_attribute_int_with_subst(machine, *orientnode, "rotate", 0);
376   switch (rotate)
377   {
378      case 0:     orientation = ROT0;     break;
379      case 90:    orientation = ROT90;    break;
380      case 180:   orientation = ROT180;   break;
381      case 270:   orientation = ROT270;   break;
382      default:    throw emu_fatalerror("Invalid rotation in XML orientation node: %d", rotate);
383   }
384   if (strcmp("yes", xml_get_attribute_string_with_subst(machine, *orientnode, "swapxy", "no")) == 0)
385      orientation ^= ORIENTATION_SWAP_XY;
386   if (strcmp("yes", xml_get_attribute_string_with_subst(machine, *orientnode, "flipx", "no")) == 0)
387      orientation ^= ORIENTATION_FLIP_X;
388   if (strcmp("yes", xml_get_attribute_string_with_subst(machine, *orientnode, "flipy", "no")) == 0)
389      orientation ^= ORIENTATION_FLIP_Y;
390390}
391391
392392
r242301r242302
400400//-------------------------------------------------
401401
402402layout_element::layout_element(running_machine &machine, xml_data_node &elemnode, const char *dirname)
403    : m_next(NULL),
404        m_machine(machine),
405        m_defstate(0),
406        m_maxstate(0)
403   : m_next(NULL),
404      m_machine(machine),
405      m_defstate(0),
406      m_maxstate(0)
407407{
408    // extract the name
409    const char *name = xml_get_attribute_string_with_subst(machine, elemnode, "name", NULL);
410    if (name == NULL)
411        throw emu_fatalerror("All layout elements must have a name!\n");
412    m_name = name;
408   // extract the name
409   const char *name = xml_get_attribute_string_with_subst(machine, elemnode, "name", NULL);
410   if (name == NULL)
411      throw emu_fatalerror("All layout elements must have a name!\n");
412   m_name = name;
413413
414    // get the default state
415    m_defstate = xml_get_attribute_int_with_subst(machine, elemnode, "defstate", -1);
414   // get the default state
415   m_defstate = xml_get_attribute_int_with_subst(machine, elemnode, "defstate", -1);
416416
417    // parse components in order
418    bool first = true;
419    render_bounds bounds = { 0 };
420    for (xml_data_node *compnode = elemnode.child; compnode != NULL; compnode = compnode->next)
421    {
422        // allocate a new component
423        component &newcomp = m_complist.append(*global_alloc(component(machine, *compnode, dirname)));
417   // parse components in order
418   bool first = true;
419   render_bounds bounds = { 0 };
420   for (xml_data_node *compnode = elemnode.child; compnode != NULL; compnode = compnode->next)
421   {
422      // allocate a new component
423      component &newcomp = m_complist.append(*global_alloc(component(machine, *compnode, dirname)));
424424
425        // accumulate bounds
426        if (first)
427            bounds = newcomp.m_bounds;
428        else
429            union_render_bounds(&bounds, &newcomp.m_bounds);
430        first = false;
425      // accumulate bounds
426      if (first)
427         bounds = newcomp.m_bounds;
428      else
429         union_render_bounds(&bounds, &newcomp.m_bounds);
430      first = false;
431431
432        // determine the maximum state
433        if (newcomp.m_state > m_maxstate)
434            m_maxstate = newcomp.m_state;
435        if (newcomp.m_type == component::CTYPE_LED7SEG || newcomp.m_type == component::CTYPE_LED8SEG_GTS1)
436            m_maxstate = 255;
437        if (newcomp.m_type == component::CTYPE_LED14SEG)
438            m_maxstate = 16383;
439        if (newcomp.m_type == component::CTYPE_LED14SEGSC || newcomp.m_type == component::CTYPE_LED16SEG)
440            m_maxstate = 65535;
441        if (newcomp.m_type == component::CTYPE_LED16SEGSC)
442            m_maxstate = 262143;
443        if (newcomp.m_type == component::CTYPE_DOTMATRIX)
444            m_maxstate = 255;
445        if (newcomp.m_type == component::CTYPE_DOTMATRIX5DOT)
446            m_maxstate = 31;
447        if (newcomp.m_type == component::CTYPE_DOTMATRIXDOT)
448            m_maxstate = 1;
449        if (newcomp.m_type == component::CTYPE_SIMPLECOUNTER)
450            m_maxstate = xml_get_attribute_int_with_subst(machine, *compnode, "maxstate", 999);
451        if (newcomp.m_type == component::CTYPE_REEL)
452            m_maxstate = 65536;
453    }
432      // determine the maximum state
433      if (newcomp.m_state > m_maxstate)
434         m_maxstate = newcomp.m_state;
435      if (newcomp.m_type == component::CTYPE_LED7SEG)
436         m_maxstate = 255;
437      if (newcomp.m_type == component::CTYPE_LED14SEG)
438         m_maxstate = 16383;
439      if (newcomp.m_type == component::CTYPE_LED14SEGSC || newcomp.m_type == component::CTYPE_LED16SEG)
440         m_maxstate = 65535;
441      if (newcomp.m_type == component::CTYPE_LED16SEGSC)
442         m_maxstate = 262143;
443      if (newcomp.m_type == component::CTYPE_DOTMATRIX)
444         m_maxstate = 255;
445      if (newcomp.m_type == component::CTYPE_DOTMATRIX5DOT)
446         m_maxstate = 31;
447      if (newcomp.m_type == component::CTYPE_DOTMATRIXDOT)
448         m_maxstate = 1;
449      if (newcomp.m_type == component::CTYPE_SIMPLECOUNTER)
450         m_maxstate = xml_get_attribute_int_with_subst(machine, *compnode, "maxstate", 999);
451      if (newcomp.m_type == component::CTYPE_REEL)
452         m_maxstate = 65536;
453   }
454454
455    if (m_complist.first() != NULL)
456    {
457        // determine the scale/offset for normalization
458        float xoffs = bounds.x0;
459        float yoffs = bounds.y0;
460        float xscale = 1.0f / (bounds.x1 - bounds.x0);
461        float yscale = 1.0f / (bounds.y1 - bounds.y0);
455   if (m_complist.first() != NULL)
456   {
457      // determine the scale/offset for normalization
458      float xoffs = bounds.x0;
459      float yoffs = bounds.y0;
460      float xscale = 1.0f / (bounds.x1 - bounds.x0);
461      float yscale = 1.0f / (bounds.y1 - bounds.y0);
462462
463        // normalize all the component bounds
464        for (component *curcomp = m_complist.first(); curcomp != NULL; curcomp = curcomp->next())
465        {
466            curcomp->m_bounds.x0 = (curcomp->m_bounds.x0 - xoffs) * xscale;
467            curcomp->m_bounds.x1 = (curcomp->m_bounds.x1 - xoffs) * xscale;
468            curcomp->m_bounds.y0 = (curcomp->m_bounds.y0 - yoffs) * yscale;
469            curcomp->m_bounds.y1 = (curcomp->m_bounds.y1 - yoffs) * yscale;
470        }
471    }
463      // normalize all the component bounds
464      for (component *curcomp = m_complist.first(); curcomp != NULL; curcomp = curcomp->next())
465      {
466         curcomp->m_bounds.x0 = (curcomp->m_bounds.x0 - xoffs) * xscale;
467         curcomp->m_bounds.x1 = (curcomp->m_bounds.x1 - xoffs) * xscale;
468         curcomp->m_bounds.y0 = (curcomp->m_bounds.y0 - yoffs) * yscale;
469         curcomp->m_bounds.y1 = (curcomp->m_bounds.y1 - yoffs) * yscale;
470      }
471   }
472472
473    // allocate an array of element textures for the states
474    m_elemtex.resize(m_maxstate + 1);
473   // allocate an array of element textures for the states
474   m_elemtex.resize(m_maxstate + 1);
475475}
476476
477477
r242301r242302
492492
493493render_texture *layout_element::state_texture(int state)
494494{
495    assert(state <= m_maxstate);
496    if (m_elemtex[state].m_texture == NULL)
497    {
498        m_elemtex[state].m_element = this;
499        m_elemtex[state].m_state = state;
500        m_elemtex[state].m_texture = machine().render().texture_alloc(element_scale, &m_elemtex[state]);
501    }
502    return m_elemtex[state].m_texture;
495   assert(state <= m_maxstate);
496   if (m_elemtex[state].m_texture == NULL)
497   {
498      m_elemtex[state].m_element = this;
499      m_elemtex[state].m_state = state;
500      m_elemtex[state].m_texture = machine().render().texture_alloc(element_scale, &m_elemtex[state]);
501   }
502   return m_elemtex[state].m_texture;
503503}
504504
505505
r242301r242302
511511
512512void layout_element::element_scale(bitmap_argb32 &dest, bitmap_argb32 &source, const rectangle &sbounds, void *param)
513513{
514    texture *elemtex = (texture *)param;
514   texture *elemtex = (texture *)param;
515515
516    // iterate over components that are part of the current state
517    for (component *curcomp = elemtex->m_element->m_complist.first(); curcomp != NULL; curcomp = curcomp->next())
518        if (curcomp->m_state == -1 || curcomp->m_state == elemtex->m_state)
519        {
520            // get the local scaled bounds
521            rectangle bounds;
522            bounds.min_x = render_round_nearest(curcomp->bounds().x0 * dest.width());
523            bounds.min_y = render_round_nearest(curcomp->bounds().y0 * dest.height());
524            bounds.max_x = render_round_nearest(curcomp->bounds().x1 * dest.width());
525            bounds.max_y = render_round_nearest(curcomp->bounds().y1 * dest.height());
526            bounds &= dest.cliprect();
516   // iterate over components that are part of the current state
517   for (component *curcomp = elemtex->m_element->m_complist.first(); curcomp != NULL; curcomp = curcomp->next())
518      if (curcomp->m_state == -1 || curcomp->m_state == elemtex->m_state)
519      {
520         // get the local scaled bounds
521         rectangle bounds;
522         bounds.min_x = render_round_nearest(curcomp->bounds().x0 * dest.width());
523         bounds.min_y = render_round_nearest(curcomp->bounds().y0 * dest.height());
524         bounds.max_x = render_round_nearest(curcomp->bounds().x1 * dest.width());
525         bounds.max_y = render_round_nearest(curcomp->bounds().y1 * dest.height());
526         bounds &= dest.cliprect();
527527
528            // based on the component type, add to the texture
529            curcomp->draw(elemtex->m_element->machine(), dest, bounds, elemtex->m_state);
530        }
528         // based on the component type, add to the texture
529         curcomp->draw(elemtex->m_element->machine(), dest, bounds, elemtex->m_state);
530      }
531531}
532532
533533
r242301r242302
540540//-------------------------------------------------
541541
542542layout_element::texture::texture()
543    : m_element(NULL),
544        m_texture(NULL),
545        m_state(0)
543   : m_element(NULL),
544      m_texture(NULL),
545      m_state(0)
546546{
547547}
548548
r242301r242302
553553
554554layout_element::texture::~texture()
555555{
556    if (m_element != NULL)
557        m_element->machine().render().texture_free(m_texture);
556   if (m_element != NULL)
557      m_element->machine().render().texture_free(m_texture);
558558}
559559
560560
r242301r242302
568568//-------------------------------------------------
569569
570570layout_element::component::component(running_machine &machine, xml_data_node &compnode, const char *dirname)
571    : m_next(NULL),
572        m_type(CTYPE_INVALID),
573        m_state(0)
571   : m_next(NULL),
572      m_type(CTYPE_INVALID),
573      m_state(0)
574574{
575    for (int i=0;i<MAX_BITMAPS;i++)
576        m_hasalpha[i] = false;
575   for (int i=0;i<MAX_BITMAPS;i++)
576      m_hasalpha[i] = false;
577577
578    // fetch common data
579    m_state = xml_get_attribute_int_with_subst(machine, compnode, "state", -1);
580    parse_bounds(machine, xml_get_sibling(compnode.child, "bounds"), m_bounds);
581    parse_color(machine, xml_get_sibling(compnode.child, "color"), m_color);
578   // fetch common data
579   m_state = xml_get_attribute_int_with_subst(machine, compnode, "state", -1);
580   parse_bounds(machine, xml_get_sibling(compnode.child, "bounds"), m_bounds);
581   parse_color(machine, xml_get_sibling(compnode.child, "color"), m_color);
582582
583    // image nodes
584    if (strcmp(compnode.name, "image") == 0)
585    {
586        m_type = CTYPE_IMAGE;
587        if (dirname != NULL)
588            m_dirname = dirname;
589        m_imagefile[0] = xml_get_attribute_string_with_subst(machine, compnode, "file", "");
590        m_alphafile[0] = xml_get_attribute_string_with_subst(machine, compnode, "alphafile", "");
591        m_file[0].reset(global_alloc(emu_file(machine.options().art_path(), OPEN_FLAG_READ)));
592    }
583   // image nodes
584   if (strcmp(compnode.name, "image") == 0)
585   {
586      m_type = CTYPE_IMAGE;
587      if (dirname != NULL)
588         m_dirname = dirname;
589      m_imagefile[0] = xml_get_attribute_string_with_subst(machine, compnode, "file", "");
590      m_alphafile[0] = xml_get_attribute_string_with_subst(machine, compnode, "alphafile", "");
591      m_file[0].reset(global_alloc(emu_file(machine.options().art_path(), OPEN_FLAG_READ)));
592   }
593593
594    // text nodes
595    else if (strcmp(compnode.name, "text") == 0)
596    {
597        m_type = CTYPE_TEXT;
598        m_string = xml_get_attribute_string_with_subst(machine, compnode, "string", "");
599        m_textalign = xml_get_attribute_int_with_subst(machine, compnode, "align", 0);
600    }
594   // text nodes
595   else if (strcmp(compnode.name, "text") == 0)
596   {
597      m_type = CTYPE_TEXT;
598      m_string = xml_get_attribute_string_with_subst(machine, compnode, "string", "");
599      m_textalign = xml_get_attribute_int_with_subst(machine, compnode, "align", 0);
600   }
601601
602    // dotmatrix nodes
603    else if (strcmp(compnode.name, "dotmatrix") == 0)
604    {
605        m_type = CTYPE_DOTMATRIX;
606    }
607    else if (strcmp(compnode.name, "dotmatrix5dot") == 0)
608    {
609        m_type = CTYPE_DOTMATRIX5DOT;
610    }
611    else if (strcmp(compnode.name, "dotmatrixdot") == 0)
612    {
613        m_type = CTYPE_DOTMATRIXDOT;
614    }
602   // dotmatrix nodes
603   else if (strcmp(compnode.name, "dotmatrix") == 0)
604   {
605      m_type = CTYPE_DOTMATRIX;
606   }
607   else if (strcmp(compnode.name, "dotmatrix5dot") == 0)
608   {
609      m_type = CTYPE_DOTMATRIX5DOT;
610   }
611   else if (strcmp(compnode.name, "dotmatrixdot") == 0)
612   {
613      m_type = CTYPE_DOTMATRIXDOT;
614   }
615615
616    // simplecounter nodes
617    else if (strcmp(compnode.name, "simplecounter") == 0)
618    {
619        m_type = CTYPE_SIMPLECOUNTER;
620        m_digits = xml_get_attribute_int_with_subst(machine, compnode, "digits", 2);
621        m_textalign = xml_get_attribute_int_with_subst(machine, compnode, "align", 0);
622    }
616   // simplecounter nodes
617   else if (strcmp(compnode.name, "simplecounter") == 0)
618   {
619      m_type = CTYPE_SIMPLECOUNTER;
620      m_digits = xml_get_attribute_int_with_subst(machine, compnode, "digits", 2);
621      m_textalign = xml_get_attribute_int_with_subst(machine, compnode, "align", 0);
622   }
623623
624    // fruit machine reels
625    else if (strcmp(compnode.name, "reel") == 0)
626    {
627        m_type = CTYPE_REEL;
624   // fruit machine reels
625   else if (strcmp(compnode.name, "reel") == 0)
626   {
627      m_type = CTYPE_REEL;
628628
629        astring symbollist = xml_get_attribute_string_with_subst(machine, compnode, "symbollist", "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15");
629      astring symbollist = xml_get_attribute_string_with_subst(machine, compnode, "symbollist", "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15");
630630
631        // split out position names from string and figure out our number of symbols
632        int location = -1;
633        m_numstops = 0;
634        location=symbollist.find(0,",");
635        while (location!=-1)
636        {
637            m_stopnames[m_numstops] = symbollist;
638            m_stopnames[m_numstops].substr(0, location);
639            symbollist.substr(location+1, symbollist.len()-(location-1));
640            m_numstops++;
641            location=symbollist.find(0,",");
642        }
643        m_stopnames[m_numstops++] = symbollist;
631      // split out position names from string and figure out our number of symbols
632      int location = -1;
633      m_numstops = 0;
634      location=symbollist.find(0,",");
635      while (location!=-1)
636      {
637         m_stopnames[m_numstops] = symbollist;
638         m_stopnames[m_numstops].substr(0, location);
639         symbollist.substr(location+1, symbollist.len()-(location-1));
640         m_numstops++;
641         location=symbollist.find(0,",");
642      }
643      m_stopnames[m_numstops++] = symbollist;
644644
645        // careful, dirname is NULL if we're coming from internal layout, and our string assignment doesn't like that
646        if (dirname != NULL)
647            m_dirname = dirname;
645      // careful, dirname is NULL if we're coming from internal layout, and our string assignment doesn't like that
646      if (dirname != NULL)
647         m_dirname = dirname;
648648
649        for (int i=0;i<m_numstops;i++)
650        {
651            location=m_stopnames[i].find(0,":");
652            if (location!=-1)
653            {
654                m_imagefile[i] = m_stopnames[i];
655                m_stopnames[i].substr(0, location);
656                m_imagefile[i].substr(location+1, m_imagefile[i].len()-(location-1));
649      for (int i=0;i<m_numstops;i++)
650      {
651         location=m_stopnames[i].find(0,":");
652         if (location!=-1)
653         {
654            m_imagefile[i] = m_stopnames[i];
655            m_stopnames[i].substr(0, location);
656            m_imagefile[i].substr(location+1, m_imagefile[i].len()-(location-1));
657657
658                //m_alphafile[i] =
659                m_file[i].reset(global_alloc(emu_file(machine.options().art_path(), OPEN_FLAG_READ)));
660            }
661            else
662            {
663                //m_imagefile[i] = 0;
664                //m_alphafile[i] = 0;
665                m_file[i].reset();
666            }
667        }
658            //m_alphafile[i] =
659            m_file[i].reset(global_alloc(emu_file(machine.options().art_path(), OPEN_FLAG_READ)));
660         }
661         else
662         {
663            //m_imagefile[i] = 0;
664            //m_alphafile[i] = 0;
665            m_file[i].reset();
666         }
667      }
668668
669        m_stateoffset = xml_get_attribute_int_with_subst(machine, compnode, "stateoffset", 0);
670        m_numsymbolsvisible = xml_get_attribute_int_with_subst(machine, compnode, "numsymbolsvisible", 3);
671        m_reelreversed = xml_get_attribute_int_with_subst(machine, compnode, "reelreversed", 0);
672        m_beltreel = xml_get_attribute_int_with_subst(machine, compnode, "beltreel", 0);
669      m_stateoffset = xml_get_attribute_int_with_subst(machine, compnode, "stateoffset", 0);
670      m_numsymbolsvisible = xml_get_attribute_int_with_subst(machine, compnode, "numsymbolsvisible", 3);
671      m_reelreversed = xml_get_attribute_int_with_subst(machine, compnode, "reelreversed", 0);
672      m_beltreel = xml_get_attribute_int_with_subst(machine, compnode, "beltreel", 0);
673673
674    }
674   }
675675
676    // led7seg nodes
677    else if (strcmp(compnode.name, "led7seg") == 0)
678        m_type = CTYPE_LED7SEG;
676   // led7seg nodes
677   else if (strcmp(compnode.name, "led7seg") == 0)
678      m_type = CTYPE_LED7SEG;
679679
680    // led8seg_gts1 nodes
681    else if (strcmp(compnode.name, "led8seg_gts1") == 0)
682        m_type = CTYPE_LED8SEG_GTS1;
680   // led8seg nodes
681   else if (strcmp(compnode.name, "led8seg") == 0)
682      m_type = CTYPE_LED8SEG;
683683
684    // led14seg nodes
685    else if (strcmp(compnode.name, "led14seg") == 0)
686        m_type = CTYPE_LED14SEG;
684   // led14seg nodes
685   else if (strcmp(compnode.name, "led14seg") == 0)
686      m_type = CTYPE_LED14SEG;
687687
688    // led14segsc nodes
689    else if (strcmp(compnode.name, "led14segsc") == 0)
690        m_type = CTYPE_LED14SEGSC;
688   // led14segsc nodes
689   else if (strcmp(compnode.name, "led14segsc") == 0)
690      m_type = CTYPE_LED14SEGSC;
691691
692    // led16seg nodes
693    else if (strcmp(compnode.name, "led16seg") == 0)
694        m_type = CTYPE_LED16SEG;
692   // led16seg nodes
693   else if (strcmp(compnode.name, "led16seg") == 0)
694      m_type = CTYPE_LED16SEG;
695695
696    // led16segsc nodes
697    else if (strcmp(compnode.name, "led16segsc") == 0)
698        m_type = CTYPE_LED16SEGSC;
696   // led16segsc nodes
697   else if (strcmp(compnode.name, "led16segsc") == 0)
698      m_type = CTYPE_LED16SEGSC;
699699
700    // rect nodes
701    else if (strcmp(compnode.name, "rect") == 0)
702        m_type = CTYPE_RECT;
700   // rect nodes
701   else if (strcmp(compnode.name, "rect") == 0)
702      m_type = CTYPE_RECT;
703703
704    // disk nodes
705    else if (strcmp(compnode.name, "disk") == 0)
706        m_type = CTYPE_DISK;
704   // disk nodes
705   else if (strcmp(compnode.name, "disk") == 0)
706      m_type = CTYPE_DISK;
707707
708    // error otherwise
709    else
710        throw emu_fatalerror("Unknown element component: %s", compnode.name);
708   // error otherwise
709   else
710      throw emu_fatalerror("Unknown element component: %s", compnode.name);
711711}
712712
713713
r242301r242302
726726
727727void layout_element::component::draw(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state)
728728{
729    switch (m_type)
730    {
731        case CTYPE_IMAGE:
732            if (!m_bitmap[0].valid())
733                load_bitmap();
734            {
735                bitmap_argb32 destsub(dest, bounds);
736                render_resample_argb_bitmap_hq(destsub, m_bitmap[0], m_color);
737            }
738            break;
729   switch (m_type)
730   {
731      case CTYPE_IMAGE:
732         if (!m_bitmap[0].valid())
733            load_bitmap();
734         {
735            bitmap_argb32 destsub(dest, bounds);
736            render_resample_argb_bitmap_hq(destsub, m_bitmap[0], m_color);
737         }
738         break;
739739
740        case CTYPE_RECT:
741            draw_rect(dest, bounds);
742            break;
740      case CTYPE_RECT:
741         draw_rect(dest, bounds);
742         break;
743743
744        case CTYPE_DISK:
745            draw_disk(dest, bounds);
746            break;
744      case CTYPE_DISK:
745         draw_disk(dest, bounds);
746         break;
747747
748        case CTYPE_TEXT:
749            draw_text(machine, dest, bounds);
750            break;
748      case CTYPE_TEXT:
749         draw_text(machine, dest, bounds);
750         break;
751751
752        case CTYPE_LED7SEG:
753            draw_led7seg(dest, bounds, state);
754            break;
752      case CTYPE_LED7SEG:
753         draw_led7seg(dest, bounds, state);
754         break;
755755
756        case CTYPE_LED8SEG_GTS1:
757            draw_led8seg_gts1(dest, bounds, state);
758            break;
756      case CTYPE_LED8SEG:
757         draw_led8seg(dest, bounds, state);
758         break;
759759
760        case CTYPE_LED14SEG:
761            draw_led14seg(dest, bounds, state);
762            break;
760      case CTYPE_LED14SEG:
761         draw_led14seg(dest, bounds, state);
762         break;
763763
764        case CTYPE_LED16SEG:
765            draw_led16seg(dest, bounds, state);
766            break;
764      case CTYPE_LED16SEG:
765         draw_led16seg(dest, bounds, state);
766         break;
767767
768        case CTYPE_LED14SEGSC:
769            draw_led14segsc(dest, bounds, state);
770            break;
768      case CTYPE_LED14SEGSC:
769         draw_led14segsc(dest, bounds, state);
770         break;
771771
772        case CTYPE_LED16SEGSC:
773            draw_led16segsc(dest, bounds, state);
774            break;
772      case CTYPE_LED16SEGSC:
773         draw_led16segsc(dest, bounds, state);
774         break;
775775
776        case CTYPE_DOTMATRIX:
777            draw_dotmatrix(8, dest, bounds, state);
778            break;
776      case CTYPE_DOTMATRIX:
777         draw_dotmatrix(8, dest, bounds, state);
778         break;
779779
780        case CTYPE_DOTMATRIX5DOT:
781            draw_dotmatrix(5, dest, bounds, state);
782            break;
780      case CTYPE_DOTMATRIX5DOT:
781         draw_dotmatrix(5, dest, bounds, state);
782         break;
783783
784        case CTYPE_DOTMATRIXDOT:
785            draw_dotmatrix(1, dest, bounds, state);
786            break;
784      case CTYPE_DOTMATRIXDOT:
785         draw_dotmatrix(1, dest, bounds, state);
786         break;
787787
788        case CTYPE_SIMPLECOUNTER:
789            draw_simplecounter(machine, dest, bounds, state);
790            break;
788      case CTYPE_SIMPLECOUNTER:
789         draw_simplecounter(machine, dest, bounds, state);
790         break;
791791
792        case CTYPE_REEL:
793            draw_reel(machine, dest, bounds, state);
794            break;
792      case CTYPE_REEL:
793         draw_reel(machine, dest, bounds, state);
794         break;
795795
796        default:
797            throw emu_fatalerror("Unknown component type requested draw()");
798    }
796      default:
797         throw emu_fatalerror("Unknown component type requested draw()");
798   }
799799}
800800
801801
r242301r242302
806806
807807void layout_element::component::draw_rect(bitmap_argb32 &dest, const rectangle &bounds)
808808{
809    // compute premultiplied colors
810    UINT32 r = m_color.r * m_color.a * 255.0;
811    UINT32 g = m_color.g * m_color.a * 255.0;
812    UINT32 b = m_color.b * m_color.a * 255.0;
813    UINT32 inva = (1.0f - m_color.a) * 255.0;
809   // compute premultiplied colors
810   UINT32 r = m_color.r * m_color.a * 255.0;
811   UINT32 g = m_color.g * m_color.a * 255.0;
812   UINT32 b = m_color.b * m_color.a * 255.0;
813   UINT32 inva = (1.0f - m_color.a) * 255.0;
814814
815    // iterate over X and Y
816    for (UINT32 y = bounds.min_y; y <= bounds.max_y; y++)
817    {
818        for (UINT32 x = bounds.min_x; x <= bounds.max_x; x++)
819        {
820            UINT32 finalr = r;
821            UINT32 finalg = g;
822            UINT32 finalb = b;
815   // iterate over X and Y
816   for (UINT32 y = bounds.min_y; y <= bounds.max_y; y++)
817   {
818      for (UINT32 x = bounds.min_x; x <= bounds.max_x; x++)
819      {
820         UINT32 finalr = r;
821         UINT32 finalg = g;
822         UINT32 finalb = b;
823823
824            // if we're translucent, add in the destination pixel contribution
825            if (inva > 0)
826            {
827                rgb_t dpix = dest.pix32(y, x);
828                finalr += (dpix.r() * inva) >> 8;
829                finalg += (dpix.g() * inva) >> 8;
830                finalb += (dpix.b() * inva) >> 8;
831            }
824         // if we're translucent, add in the destination pixel contribution
825         if (inva > 0)
826         {
827            rgb_t dpix = dest.pix32(y, x);
828            finalr += (dpix.r() * inva) >> 8;
829            finalg += (dpix.g() * inva) >> 8;
830            finalb += (dpix.b() * inva) >> 8;
831         }
832832
833            // store the target pixel, dividing the RGBA values by the overall scale factor
834            dest.pix32(y, x) = rgb_t(finalr, finalg, finalb);
835        }
836    }
833         // store the target pixel, dividing the RGBA values by the overall scale factor
834         dest.pix32(y, x) = rgb_t(finalr, finalg, finalb);
835      }
836   }
837837}
838838
839839
r242301r242302
844844
845845void layout_element::component::draw_disk(bitmap_argb32 &dest, const rectangle &bounds)
846846{
847    // compute premultiplied colors
848    UINT32 r = m_color.r * m_color.a * 255.0;
849    UINT32 g = m_color.g * m_color.a * 255.0;
850    UINT32 b = m_color.b * m_color.a * 255.0;
851    UINT32 inva = (1.0f - m_color.a) * 255.0;
847   // compute premultiplied colors
848   UINT32 r = m_color.r * m_color.a * 255.0;
849   UINT32 g = m_color.g * m_color.a * 255.0;
850   UINT32 b = m_color.b * m_color.a * 255.0;
851   UINT32 inva = (1.0f - m_color.a) * 255.0;
852852
853    // find the center
854    float xcenter = float(bounds.xcenter());
855    float ycenter = float(bounds.ycenter());
856    float xradius = float(bounds.width()) * 0.5f;
857    float yradius = float(bounds.height()) * 0.5f;
858    float ooyradius2 = 1.0f / (yradius * yradius);
853   // find the center
854   float xcenter = float(bounds.xcenter());
855   float ycenter = float(bounds.ycenter());
856   float xradius = float(bounds.width()) * 0.5f;
857   float yradius = float(bounds.height()) * 0.5f;
858   float ooyradius2 = 1.0f / (yradius * yradius);
859859
860    // iterate over y
861    for (UINT32 y = bounds.min_y; y <= bounds.max_y; y++)
862    {
863        float ycoord = ycenter - ((float)y + 0.5f);
864        float xval = xradius * sqrt(1.0f - (ycoord * ycoord) * ooyradius2);
860   // iterate over y
861   for (UINT32 y = bounds.min_y; y <= bounds.max_y; y++)
862   {
863      float ycoord = ycenter - ((float)y + 0.5f);
864      float xval = xradius * sqrt(1.0f - (ycoord * ycoord) * ooyradius2);
865865
866        // compute left/right coordinates
867        INT32 left = (INT32)(xcenter - xval + 0.5f);
868        INT32 right = (INT32)(xcenter + xval + 0.5f);
866      // compute left/right coordinates
867      INT32 left = (INT32)(xcenter - xval + 0.5f);
868      INT32 right = (INT32)(xcenter + xval + 0.5f);
869869
870        // draw this scanline
871        for (UINT32 x = left; x < right; x++)
872        {
873            UINT32 finalr = r;
874            UINT32 finalg = g;
875            UINT32 finalb = b;
870      // draw this scanline
871      for (UINT32 x = left; x < right; x++)
872      {
873         UINT32 finalr = r;
874         UINT32 finalg = g;
875         UINT32 finalb = b;
876876
877            // if we're translucent, add in the destination pixel contribution
878            if (inva > 0)
879            {
880                rgb_t dpix = dest.pix32(y, x);
881                finalr += (dpix.r() * inva) >> 8;
882                finalg += (dpix.g() * inva) >> 8;
883                finalb += (dpix.b() * inva) >> 8;
884            }
877         // if we're translucent, add in the destination pixel contribution
878         if (inva > 0)
879         {
880            rgb_t dpix = dest.pix32(y, x);
881            finalr += (dpix.r() * inva) >> 8;
882            finalg += (dpix.g() * inva) >> 8;
883            finalb += (dpix.b() * inva) >> 8;
884         }
885885
886            // store the target pixel, dividing the RGBA values by the overall scale factor
887            dest.pix32(y, x) = rgb_t(finalr, finalg, finalb);
888        }
889    }
886         // store the target pixel, dividing the RGBA values by the overall scale factor
887         dest.pix32(y, x) = rgb_t(finalr, finalg, finalb);
888      }
889   }
890890}
891891
892892
r242301r242302
896896
897897void layout_element::component::draw_text(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds)
898898{
899    // compute premultiplied colors
900    UINT32 r = m_color.r * 255.0;
901    UINT32 g = m_color.g * 255.0;
902    UINT32 b = m_color.b * 255.0;
903    UINT32 a = m_color.a * 255.0;
899   // compute premultiplied colors
900   UINT32 r = m_color.r * 255.0;
901   UINT32 g = m_color.g * 255.0;
902   UINT32 b = m_color.b * 255.0;
903   UINT32 a = m_color.a * 255.0;
904904
905    // get the width of the string
906    render_font *font = machine.render().font_alloc("default");
907    float aspect = 1.0f;
908    INT32 width;
905   // get the width of the string
906   render_font *font = machine.render().font_alloc("default");
907   float aspect = 1.0f;
908   INT32 width;
909909
910910
911    while (1)
912    {
913        width = font->string_width(bounds.height(), aspect, m_string);
914        if (width < bounds.width())
915            break;
916        aspect *= 0.9f;
917    }
911   while (1)
912   {
913      width = font->string_width(bounds.height(), aspect, m_string);
914      if (width < bounds.width())
915         break;
916      aspect *= 0.9f;
917   }
918918
919919
920    // get alignment
921    INT32 curx;
922    switch (m_textalign)
923    {
924        // left
925        case 1:
926            curx = bounds.min_x;
927            break;
920   // get alignment
921   INT32 curx;
922   switch (m_textalign)
923   {
924      // left
925      case 1:
926         curx = bounds.min_x;
927         break;
928928
929        // right
930        case 2:
931            curx = bounds.max_x - width;
932            break;
929      // right
930      case 2:
931         curx = bounds.max_x - width;
932         break;
933933
934        // default to center
935        default:
936            curx = bounds.min_x + (bounds.width() - width) / 2;
937            break;
938    }
934      // default to center
935      default:
936         curx = bounds.min_x + (bounds.width() - width) / 2;
937         break;
938   }
939939
940    // allocate a temporary bitmap
941    bitmap_argb32 tempbitmap(dest.width(), dest.height());
940   // allocate a temporary bitmap
941   bitmap_argb32 tempbitmap(dest.width(), dest.height());
942942
943    // loop over characters
944    for (const char *s = m_string; *s != 0; s++)
945    {
946        // get the font bitmap
947        rectangle chbounds;
948        font->get_scaled_bitmap_and_bounds(tempbitmap, bounds.height(), aspect, *s, chbounds);
943   // loop over characters
944   for (const char *s = m_string; *s != 0; s++)
945   {
946      // get the font bitmap
947      rectangle chbounds;
948      font->get_scaled_bitmap_and_bounds(tempbitmap, bounds.height(), aspect, *s, chbounds);
949949
950        // copy the data into the target
951        for (int y = 0; y < chbounds.height(); y++)
952        {
953            int effy = bounds.min_y + y;
954            if (effy >= bounds.min_y && effy <= bounds.max_y)
955            {
956                UINT32 *src = &tempbitmap.pix32(y);
957                UINT32 *d = &dest.pix32(effy);
958                for (int x = 0; x < chbounds.width(); x++)
959                {
960                    int effx = curx + x + chbounds.min_x;
961                    if (effx >= bounds.min_x && effx <= bounds.max_x)
962                    {
963                        UINT32 spix = rgb_t(src[x]).a();
964                        if (spix != 0)
965                        {
966                            rgb_t dpix = d[effx];
967                            UINT32 ta = (a * (spix + 1)) >> 8;
968                            UINT32 tr = (r * ta + dpix.r() * (0x100 - ta)) >> 8;
969                            UINT32 tg = (g * ta + dpix.g() * (0x100 - ta)) >> 8;
970                            UINT32 tb = (b * ta + dpix.b() * (0x100 - ta)) >> 8;
971                            d[effx] = rgb_t(tr, tg, tb);
972                        }
973                    }
974                }
975            }
976        }
950      // copy the data into the target
951      for (int y = 0; y < chbounds.height(); y++)
952      {
953         int effy = bounds.min_y + y;
954         if (effy >= bounds.min_y && effy <= bounds.max_y)
955         {
956            UINT32 *src = &tempbitmap.pix32(y);
957            UINT32 *d = &dest.pix32(effy);
958            for (int x = 0; x < chbounds.width(); x++)
959            {
960               int effx = curx + x + chbounds.min_x;
961               if (effx >= bounds.min_x && effx <= bounds.max_x)
962               {
963                  UINT32 spix = rgb_t(src[x]).a();
964                  if (spix != 0)
965                  {
966                     rgb_t dpix = d[effx];
967                     UINT32 ta = (a * (spix + 1)) >> 8;
968                     UINT32 tr = (r * ta + dpix.r() * (0x100 - ta)) >> 8;
969                     UINT32 tg = (g * ta + dpix.g() * (0x100 - ta)) >> 8;
970                     UINT32 tb = (b * ta + dpix.b() * (0x100 - ta)) >> 8;
971                     d[effx] = rgb_t(tr, tg, tb);
972                  }
973               }
974            }
975         }
976      }
977977
978        // advance in the X direction
979        curx += font->char_width(bounds.height(), aspect, *s);
980    }
978      // advance in the X direction
979      curx += font->char_width(bounds.height(), aspect, *s);
980   }
981981
982    // free the temporary bitmap and font
983    machine.render().font_free(font);
982   // free the temporary bitmap and font
983   machine.render().font_free(font);
984984}
985985
986986void layout_element::component::draw_simplecounter(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state)
987987{
988    char temp[256];
989    sprintf(temp, "%0*d", m_digits, state);
990    m_string = astring(temp);
991    draw_text(machine, dest, bounds);
988   char temp[256];
989   sprintf(temp, "%0*d", m_digits, state);
990   m_string = astring(temp);
991   draw_text(machine, dest, bounds);
992992}
993993
994994/* state is a normalized value between 0 and 65536 so that we don't need to worry about how many motor steps here or in the .lay, only the number of symbols */
995995void layout_element::component::draw_reel(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state)
996996{
997    if (m_beltreel)
998    {
999        draw_beltreel(machine,dest,bounds,state);
1000    }
1001    else
1002    {
1003        const int max_state_used = 0x10000;
997   if (m_beltreel)
998   {
999      draw_beltreel(machine,dest,bounds,state);
1000   }
1001   else
1002   {
1003      const int max_state_used = 0x10000;
10041004
1005        // shift the reels a bit based on this param, allows fine tuning
1006        int use_state = (state + m_stateoffset) % max_state_used;
1005      // shift the reels a bit based on this param, allows fine tuning
1006      int use_state = (state + m_stateoffset) % max_state_used;
10071007
1008        // compute premultiplied colors
1009        UINT32 r = m_color.r * 255.0;
1010        UINT32 g = m_color.g * 255.0;
1011        UINT32 b = m_color.b * 255.0;
1012        UINT32 a = m_color.a * 255.0;
1008      // compute premultiplied colors
1009      UINT32 r = m_color.r * 255.0;
1010      UINT32 g = m_color.g * 255.0;
1011      UINT32 b = m_color.b * 255.0;
1012      UINT32 a = m_color.a * 255.0;
10131013
1014        // get the width of the string
1015        render_font *font = machine.render().font_alloc("default");
1016        float aspect = 1.0f;
1017        INT32 width;
1014      // get the width of the string
1015      render_font *font = machine.render().font_alloc("default");
1016      float aspect = 1.0f;
1017      INT32 width;
10181018
10191019
1020        int curry = 0;
1021        int num_shown = m_numsymbolsvisible;
1020      int curry = 0;
1021      int num_shown = m_numsymbolsvisible;
10221022
1023        int ourheight = bounds.height();
1023      int ourheight = bounds.height();
10241024
1025        for (int fruit = 0;fruit<m_numstops;fruit++)
1026        {
1027            int basey;
1025      for (int fruit = 0;fruit<m_numstops;fruit++)
1026      {
1027         int basey;
10281028
1029            if (m_reelreversed==1)
1030            {
1031                basey = bounds.min_y + ((use_state)*(ourheight/num_shown)/(max_state_used/m_numstops)) + curry;
1032            }
1033            else
1034            {
1035                basey = bounds.min_y - ((use_state)*(ourheight/num_shown)/(max_state_used/m_numstops)) + curry;
1036            }
1029         if (m_reelreversed==1)
1030         {
1031            basey = bounds.min_y + ((use_state)*(ourheight/num_shown)/(max_state_used/m_numstops)) + curry;
1032         }
1033         else
1034         {
1035            basey = bounds.min_y - ((use_state)*(ourheight/num_shown)/(max_state_used/m_numstops)) + curry;
1036         }
10371037
1038            // wrap around...
1039            if (basey < bounds.min_y)
1040                basey += ((max_state_used)*(ourheight/num_shown)/(max_state_used/m_numstops));
1041            if (basey > bounds.max_y)
1042                basey -= ((max_state_used)*(ourheight/num_shown)/(max_state_used/m_numstops));
1038         // wrap around...
1039         if (basey < bounds.min_y)
1040            basey += ((max_state_used)*(ourheight/num_shown)/(max_state_used/m_numstops));
1041         if (basey > bounds.max_y)
1042            basey -= ((max_state_used)*(ourheight/num_shown)/(max_state_used/m_numstops));
10431043
1044            int endpos = basey+ourheight/num_shown;
1044         int endpos = basey+ourheight/num_shown;
10451045
1046            // only render the symbol / text if it's atually in view because the code is SLOW
1047            if ((endpos >= bounds.min_y) && (basey <= bounds.max_y))
1048            {
1049                while (1)
1050                {
1051                    width = font->string_width(ourheight/num_shown, aspect, m_stopnames[fruit]);
1052                    if (width < bounds.width())
1053                        break;
1054                    aspect *= 0.9f;
1055                }
1046         // only render the symbol / text if it's atually in view because the code is SLOW
1047         if ((endpos >= bounds.min_y) && (basey <= bounds.max_y))
1048         {
1049            while (1)
1050            {
1051               width = font->string_width(ourheight/num_shown, aspect, m_stopnames[fruit]);
1052               if (width < bounds.width())
1053                  break;
1054               aspect *= 0.9f;
1055            }
10561056
1057                INT32 curx;
1058                curx = bounds.min_x + (bounds.width() - width) / 2;
1057            INT32 curx;
1058            curx = bounds.min_x + (bounds.width() - width) / 2;
10591059
1060                if (m_file[fruit])
1061                    if (!m_bitmap[fruit].valid())
1062                        load_reel_bitmap(fruit);
1060            if (m_file[fruit])
1061               if (!m_bitmap[fruit].valid())
1062                  load_reel_bitmap(fruit);
10631063
1064                if (m_file[fruit]) // render gfx
1065                {
1066                    bitmap_argb32 tempbitmap2(dest.width(), ourheight/num_shown);
1064            if (m_file[fruit]) // render gfx
1065            {
1066               bitmap_argb32 tempbitmap2(dest.width(), ourheight/num_shown);
10671067
1068                    if (m_bitmap[fruit].valid())
1069                    {
1070                        render_resample_argb_bitmap_hq(tempbitmap2, m_bitmap[fruit], m_color);
1068               if (m_bitmap[fruit].valid())
1069               {
1070                  render_resample_argb_bitmap_hq(tempbitmap2, m_bitmap[fruit], m_color);
10711071
1072                        for (int y = 0; y < ourheight/num_shown; y++)
1073                        {
1074                            int effy = basey + y;
1072                  for (int y = 0; y < ourheight/num_shown; y++)
1073                  {
1074                     int effy = basey + y;
10751075
1076                            if (effy >= bounds.min_y && effy <= bounds.max_y)
1077                            {
1078                                UINT32 *src = &tempbitmap2.pix32(y);
1079                                UINT32 *d = &dest.pix32(effy);
1080                                for (int x = 0; x < dest.width(); x++)
1081                                {
1082                                    int effx = x;
1083                                    if (effx >= bounds.min_x && effx <= bounds.max_x)
1084                                    {
1085                                        UINT32 spix = rgb_t(src[x]).a();
1086                                        if (spix != 0)
1087                                        {
1088                                            d[effx] = src[x];
1089                                        }
1090                                    }
1091                                }
1092                            }
1076                     if (effy >= bounds.min_y && effy <= bounds.max_y)
1077                     {
1078                        UINT32 *src = &tempbitmap2.pix32(y);
1079                        UINT32 *d = &dest.pix32(effy);
1080                        for (int x = 0; x < dest.width(); x++)
1081                        {
1082                           int effx = x;
1083                           if (effx >= bounds.min_x && effx <= bounds.max_x)
1084                           {
1085                              UINT32 spix = rgb_t(src[x]).a();
1086                              if (spix != 0)
1087                              {
1088                                 d[effx] = src[x];
1089                              }
1090                           }
1091                        }
1092                     }
10931093
1094                        }
1095                    }
1096                }
1097                else // render text (fallback)
1098                {
1099                    // allocate a temporary bitmap
1100                    bitmap_argb32 tempbitmap(dest.width(), dest.height());
1094                  }
1095               }
1096            }
1097            else // render text (fallback)
1098            {
1099               // allocate a temporary bitmap
1100               bitmap_argb32 tempbitmap(dest.width(), dest.height());
11011101
1102                    // loop over characters
1103                    for (const char *s = m_stopnames[fruit]; *s != 0; s++)
1104                    {
1105                        // get the font bitmap
1106                        rectangle chbounds;
1107                        font->get_scaled_bitmap_and_bounds(tempbitmap, ourheight/num_shown, aspect, *s, chbounds);
1102               // loop over characters
1103               for (const char *s = m_stopnames[fruit]; *s != 0; s++)
1104               {
1105                  // get the font bitmap
1106                  rectangle chbounds;
1107                  font->get_scaled_bitmap_and_bounds(tempbitmap, ourheight/num_shown, aspect, *s, chbounds);
11081108
1109                        // copy the data into the target
1110                        for (int y = 0; y < chbounds.height(); y++)
1111                        {
1112                            int effy = basey + y;
1109                  // copy the data into the target
1110                  for (int y = 0; y < chbounds.height(); y++)
1111                  {
1112                     int effy = basey + y;
11131113
1114                            if (effy >= bounds.min_y && effy <= bounds.max_y)
1115                            {
1116                                UINT32 *src = &tempbitmap.pix32(y);
1117                                UINT32 *d = &dest.pix32(effy);
1118                                for (int x = 0; x < chbounds.width(); x++)
1119                                {
1120                                    int effx = curx + x + chbounds.min_x;
1121                                    if (effx >= bounds.min_x && effx <= bounds.max_x)
1122                                    {
1123                                        UINT32 spix = rgb_t(src[x]).a();
1124                                        if (spix != 0)
1125                                        {
1126                                            rgb_t dpix = d[effx];
1127                                            UINT32 ta = (a * (spix + 1)) >> 8;
1128                                            UINT32 tr = (r * ta + dpix.r() * (0x100 - ta)) >> 8;
1129                                            UINT32 tg = (g * ta + dpix.g() * (0x100 - ta)) >> 8;
1130                                            UINT32 tb = (b * ta + dpix.b() * (0x100 - ta)) >> 8;
1131                                            d[effx] = rgb_t(tr, tg, tb);
1132                                        }
1133                                    }
1134                                }
1135                            }
1136                        }
1114                     if (effy >= bounds.min_y && effy <= bounds.max_y)
1115                     {
1116                        UINT32 *src = &tempbitmap.pix32(y);
1117                        UINT32 *d = &dest.pix32(effy);
1118                        for (int x = 0; x < chbounds.width(); x++)
1119                        {
1120                           int effx = curx + x + chbounds.min_x;
1121                           if (effx >= bounds.min_x && effx <= bounds.max_x)
1122                           {
1123                              UINT32 spix = rgb_t(src[x]).a();
1124                              if (spix != 0)
1125                              {
1126                                 rgb_t dpix = d[effx];
1127                                 UINT32 ta = (a * (spix + 1)) >> 8;
1128                                 UINT32 tr = (r * ta + dpix.r() * (0x100 - ta)) >> 8;
1129                                 UINT32 tg = (g * ta + dpix.g() * (0x100 - ta)) >> 8;
1130                                 UINT32 tb = (b * ta + dpix.b() * (0x100 - ta)) >> 8;
1131                                 d[effx] = rgb_t(tr, tg, tb);
1132                              }
1133                           }
1134                        }
1135                     }
1136                  }
11371137
1138                        // advance in the X direction
1139                        curx += font->char_width(ourheight/num_shown, aspect, *s);
1138                  // advance in the X direction
1139                  curx += font->char_width(ourheight/num_shown, aspect, *s);
11401140
1141                    }
1141               }
11421142
1143                }
1144            }
1143            }
1144         }
11451145
1146            curry += ourheight/num_shown;
1147        }
1148    // free the temporary bitmap and font
1149    machine.render().font_free(font);
1150    }
1146         curry += ourheight/num_shown;
1147      }
1148   // free the temporary bitmap and font
1149   machine.render().font_free(font);
1150   }
11511151}
11521152
11531153
11541154void layout_element::component::draw_beltreel(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state)
11551155{
1156    const int max_state_used = 0x10000;
1156   const int max_state_used = 0x10000;
11571157
1158    // shift the reels a bit based on this param, allows fine tuning
1159    int use_state = (state + m_stateoffset) % max_state_used;
1158   // shift the reels a bit based on this param, allows fine tuning
1159   int use_state = (state + m_stateoffset) % max_state_used;
11601160
1161    // compute premultiplied colors
1162    UINT32 r = m_color.r * 255.0;
1163    UINT32 g = m_color.g * 255.0;
1164    UINT32 b = m_color.b * 255.0;
1165    UINT32 a = m_color.a * 255.0;
1161   // compute premultiplied colors
1162   UINT32 r = m_color.r * 255.0;
1163   UINT32 g = m_color.g * 255.0;
1164   UINT32 b = m_color.b * 255.0;
1165   UINT32 a = m_color.a * 255.0;
11661166
1167    // get the width of the string
1168    render_font *font = machine.render().font_alloc("default");
1169    float aspect = 1.0f;
1170    INT32 width;
1171    int currx = 0;
1172    int num_shown = m_numsymbolsvisible;
1167   // get the width of the string
1168   render_font *font = machine.render().font_alloc("default");
1169   float aspect = 1.0f;
1170   INT32 width;
1171   int currx = 0;
1172   int num_shown = m_numsymbolsvisible;
11731173
1174    int ourwidth = bounds.width();
1174   int ourwidth = bounds.width();
11751175
1176    for (int fruit = 0;fruit<m_numstops;fruit++)
1177    {
1178        int basex;
1179        if (m_reelreversed==1)
1180        {
1181            basex = bounds.min_x + ((use_state)*(ourwidth/num_shown)/(max_state_used/m_numstops)) + currx;
1182        }
1183        else
1184        {
1185            basex = bounds.min_x - ((use_state)*(ourwidth/num_shown)/(max_state_used/m_numstops)) + currx;
1186        }
1176   for (int fruit = 0;fruit<m_numstops;fruit++)
1177   {
1178      int basex;
1179      if (m_reelreversed==1)
1180      {
1181         basex = bounds.min_x + ((use_state)*(ourwidth/num_shown)/(max_state_used/m_numstops)) + currx;
1182      }
1183      else
1184      {
1185         basex = bounds.min_x - ((use_state)*(ourwidth/num_shown)/(max_state_used/m_numstops)) + currx;
1186      }
11871187
1188        // wrap around...
1189        if (basex < bounds.min_x)
1190            basex += ((max_state_used)*(ourwidth/num_shown)/(max_state_used/m_numstops));
1191        if (basex > bounds.max_x)
1192            basex -= ((max_state_used)*(ourwidth/num_shown)/(max_state_used/m_numstops));
1188      // wrap around...
1189      if (basex < bounds.min_x)
1190         basex += ((max_state_used)*(ourwidth/num_shown)/(max_state_used/m_numstops));
1191      if (basex > bounds.max_x)
1192         basex -= ((max_state_used)*(ourwidth/num_shown)/(max_state_used/m_numstops));
11931193
1194        int endpos = basex+(ourwidth/num_shown);
1194      int endpos = basex+(ourwidth/num_shown);
11951195
1196        // only render the symbol / text if it's atually in view because the code is SLOW
1197        if ((endpos >= bounds.min_x) && (basex <= bounds.max_x))
1198        {
1199            while (1)
1200            {
1201                width = font->string_width(dest.height(), aspect, m_stopnames[fruit]);
1202                if (width < bounds.width())
1203                    break;
1204                aspect *= 0.9f;
1205            }
1196      // only render the symbol / text if it's atually in view because the code is SLOW
1197      if ((endpos >= bounds.min_x) && (basex <= bounds.max_x))
1198      {
1199         while (1)
1200         {
1201            width = font->string_width(dest.height(), aspect, m_stopnames[fruit]);
1202            if (width < bounds.width())
1203               break;
1204            aspect *= 0.9f;
1205         }
12061206
1207            INT32 curx;
1208            curx = bounds.min_x;
1207         INT32 curx;
1208         curx = bounds.min_x;
12091209
1210            if (m_file[fruit])
1211                if (!m_bitmap[fruit].valid())
1212                    load_reel_bitmap(fruit);
1210         if (m_file[fruit])
1211            if (!m_bitmap[fruit].valid())
1212               load_reel_bitmap(fruit);
12131213
1214            if (m_file[fruit]) // render gfx
1215            {
1216                bitmap_argb32 tempbitmap2(ourwidth/num_shown, dest.height());
1214         if (m_file[fruit]) // render gfx
1215         {
1216            bitmap_argb32 tempbitmap2(ourwidth/num_shown, dest.height());
12171217
1218                if (m_bitmap[fruit].valid())
1219                {
1220                    render_resample_argb_bitmap_hq(tempbitmap2, m_bitmap[fruit], m_color);
1218            if (m_bitmap[fruit].valid())
1219            {
1220               render_resample_argb_bitmap_hq(tempbitmap2, m_bitmap[fruit], m_color);
12211221
1222                    for (int y = 0; y < dest.height(); y++)
1223                    {
1224                        int effy = y;
1222               for (int y = 0; y < dest.height(); y++)
1223               {
1224                  int effy = y;
12251225
1226                        if (effy >= bounds.min_y && effy <= bounds.max_y)
1227                        {
1228                            UINT32 *src = &tempbitmap2.pix32(y);
1229                            UINT32 *d = &dest.pix32(effy);
1230                            for (int x = 0; x < ourwidth/num_shown; x++)
1231                            {
1232                                int effx = basex + x;
1233                                if (effx >= bounds.min_x && effx <= bounds.max_x)
1234                                {
1235                                    UINT32 spix = rgb_t(src[x]).a();
1236                                    if (spix != 0)
1237                                    {
1238                                        d[effx] = src[x];
1239                                    }
1240                                }
1241                            }
1242                        }
1226                  if (effy >= bounds.min_y && effy <= bounds.max_y)
1227                  {
1228                     UINT32 *src = &tempbitmap2.pix32(y);
1229                     UINT32 *d = &dest.pix32(effy);
1230                     for (int x = 0; x < ourwidth/num_shown; x++)
1231                     {
1232                        int effx = basex + x;
1233                        if (effx >= bounds.min_x && effx <= bounds.max_x)
1234                        {
1235                           UINT32 spix = rgb_t(src[x]).a();
1236                           if (spix != 0)
1237                           {
1238                              d[effx] = src[x];
1239                           }
1240                        }
1241                     }
1242                  }
12431243
1244                    }
1245                }
1246            }
1247            else // render text (fallback)
1248            {
1249                // allocate a temporary bitmap
1250                bitmap_argb32 tempbitmap(dest.width(), dest.height());
1244               }
1245            }
1246         }
1247         else // render text (fallback)
1248         {
1249            // allocate a temporary bitmap
1250            bitmap_argb32 tempbitmap(dest.width(), dest.height());
12511251
1252                // loop over characters
1253                for (const char *s = m_stopnames[fruit]; *s != 0; s++)
1254                {
1255                    // get the font bitmap
1256                    rectangle chbounds;
1257                    font->get_scaled_bitmap_and_bounds(tempbitmap, dest.height(), aspect, *s, chbounds);
1252            // loop over characters
1253            for (const char *s = m_stopnames[fruit]; *s != 0; s++)
1254            {
1255               // get the font bitmap
1256               rectangle chbounds;
1257               font->get_scaled_bitmap_and_bounds(tempbitmap, dest.height(), aspect, *s, chbounds);
12581258
1259                    // copy the data into the target
1260                    for (int y = 0; y < chbounds.height(); y++)
1261                    {
1262                        int effy = y;
1259               // copy the data into the target
1260               for (int y = 0; y < chbounds.height(); y++)
1261               {
1262                  int effy = y;
12631263
1264                        if (effy >= bounds.min_y && effy <= bounds.max_y)
1265                        {
1266                            UINT32 *src = &tempbitmap.pix32(y);
1267                            UINT32 *d = &dest.pix32(effy);
1268                            for (int x = 0; x < chbounds.width(); x++)
1269                            {
1270                                int effx = basex + curx + x;
1271                                if (effx >= bounds.min_x && effx <= bounds.max_x)
1272                                {
1273                                    UINT32 spix = rgb_t(src[x]).a();
1274                                    if (spix != 0)
1275                                    {
1276                                        rgb_t dpix = d[effx];
1277                                        UINT32 ta = (a * (spix + 1)) >> 8;
1278                                        UINT32 tr = (r * ta + dpix.r() * (0x100 - ta)) >> 8;
1279                                        UINT32 tg = (g * ta + dpix.g() * (0x100 - ta)) >> 8;
1280                                        UINT32 tb = (b * ta + dpix.b() * (0x100 - ta)) >> 8;
1281                                        d[effx] = rgb_t(tr, tg, tb);
1282                                    }
1283                                }
1284                            }
1285                        }
1286                    }
1264                  if (effy >= bounds.min_y && effy <= bounds.max_y)
1265                  {
1266                     UINT32 *src = &tempbitmap.pix32(y);
1267                     UINT32 *d = &dest.pix32(effy);
1268                     for (int x = 0; x < chbounds.width(); x++)
1269                     {
1270                        int effx = basex + curx + x;
1271                        if (effx >= bounds.min_x && effx <= bounds.max_x)
1272                        {
1273                           UINT32 spix = rgb_t(src[x]).a();
1274                           if (spix != 0)
1275                           {
1276                              rgb_t dpix = d[effx];
1277                              UINT32 ta = (a * (spix + 1)) >> 8;
1278                              UINT32 tr = (r * ta + dpix.r() * (0x100 - ta)) >> 8;
1279                              UINT32 tg = (g * ta + dpix.g() * (0x100 - ta)) >> 8;
1280                              UINT32 tb = (b * ta + dpix.b() * (0x100 - ta)) >> 8;
1281                              d[effx] = rgb_t(tr, tg, tb);
1282                           }
1283                        }
1284                     }
1285                  }
1286               }
12871287
1288                    // advance in the X direction
1289                    curx += font->char_width(dest.height(), aspect, *s);
1288               // advance in the X direction
1289               curx += font->char_width(dest.height(), aspect, *s);
12901290
1291                }
1291            }
12921292
1293            }
1294        }
1293         }
1294      }
12951295
1296        currx += ourwidth/num_shown;
1297    }
1296      currx += ourwidth/num_shown;
1297   }
12981298
1299    // free the temporary bitmap and font
1300    machine.render().font_free(font);
1299   // free the temporary bitmap and font
1300   machine.render().font_free(font);
13011301}
13021302
13031303
r242301r242302
13081308
13091309void layout_element::component::load_bitmap()
13101310{
1311    // load the basic bitmap
1312    assert(m_file[0] != NULL);
1313    m_hasalpha[0] = render_load_png(m_bitmap[0], *m_file[0], m_dirname, m_imagefile[0]);
1311   // load the basic bitmap
1312   assert(m_file[0] != NULL);
1313   m_hasalpha[0] = render_load_png(m_bitmap[0], *m_file[0], m_dirname, m_imagefile[0]);
13141314
1315    // load the alpha bitmap if specified
1316    if (m_bitmap[0].valid() && m_alphafile[0])
1317        render_load_png(m_bitmap[0], *m_file[0], m_dirname, m_alphafile[0], true);
1315   // load the alpha bitmap if specified
1316   if (m_bitmap[0].valid() && m_alphafile[0])
1317      render_load_png(m_bitmap[0], *m_file[0], m_dirname, m_alphafile[0], true);
13181318
1319    // if we can't load the bitmap, allocate a dummy one and report an error
1320    if (!m_bitmap[0].valid())
1321    {
1322        // draw some stripes in the bitmap
1323        m_bitmap[0].allocate(100, 100);
1324        m_bitmap[0].fill(0);
1325        for (int step = 0; step < 100; step += 25)
1326            for (int line = 0; line < 100; line++)
1327                m_bitmap[0].pix32((step + line) % 100, line % 100) = rgb_t(0xff,0xff,0xff,0xff);
1319   // if we can't load the bitmap, allocate a dummy one and report an error
1320   if (!m_bitmap[0].valid())
1321   {
1322      // draw some stripes in the bitmap
1323      m_bitmap[0].allocate(100, 100);
1324      m_bitmap[0].fill(0);
1325      for (int step = 0; step < 100; step += 25)
1326         for (int line = 0; line < 100; line++)
1327            m_bitmap[0].pix32((step + line) % 100, line % 100) = rgb_t(0xff,0xff,0xff,0xff);
13281328
1329        // log an error
1330        if (!m_alphafile[0])
1331            osd_printf_warning("Unable to load component bitmap '%s'\n", m_imagefile[0].cstr());
1332        else
1333            osd_printf_warning("Unable to load component bitmap '%s'/'%s'\n", m_imagefile[0].cstr(), m_alphafile[0].cstr());
1334    }
1329      // log an error
1330      if (!m_alphafile[0])
1331         osd_printf_warning("Unable to load component bitmap '%s'\n", m_imagefile[0].cstr());
1332      else
1333         osd_printf_warning("Unable to load component bitmap '%s'/'%s'\n", m_imagefile[0].cstr(), m_alphafile[0].cstr());
1334   }
13351335}
13361336
13371337
13381338void layout_element::component::load_reel_bitmap(int number)
13391339{
1340    // load the basic bitmap
1341    assert(m_file != NULL);
1342    /*m_hasalpha[number] = */ render_load_png(m_bitmap[number], *m_file[number], m_dirname, m_imagefile[number]);
1340   // load the basic bitmap
1341   assert(m_file != NULL);
1342   /*m_hasalpha[number] = */ render_load_png(m_bitmap[number], *m_file[number], m_dirname, m_imagefile[number]);
13431343
1344    // load the alpha bitmap if specified
1345    //if (m_bitmap[number].valid() && m_alphafile[number])
1346    //  render_load_png(m_bitmap[number], *m_file[number], m_dirname, m_alphafile[number], true);
1344   // load the alpha bitmap if specified
1345   //if (m_bitmap[number].valid() && m_alphafile[number])
1346   //  render_load_png(m_bitmap[number], *m_file[number], m_dirname, m_alphafile[number], true);
13471347
1348    // if we can't load the bitmap just use text rendering
1349    if (!m_bitmap[number].valid())
1350    {
1351        // fallback to text rendering
1352        m_file[number].reset();
1353    }
1348   // if we can't load the bitmap just use text rendering
1349   if (!m_bitmap[number].valid())
1350   {
1351      // fallback to text rendering
1352      m_file[number].reset();
1353   }
13541354
13551355}
13561356
r242301r242302
13621362
13631363void layout_element::component::draw_led7seg(bitmap_argb32 &dest, const rectangle &bounds, int pattern)
13641364{
1365    const rgb_t onpen = rgb_t(0xff,0xff,0xff,0xff);
1366    const rgb_t offpen = rgb_t(0xff,0x20,0x20,0x20);
1365   const rgb_t onpen = rgb_t(0xff,0xff,0xff,0xff);
1366   const rgb_t offpen = rgb_t(0xff,0x20,0x20,0x20);
13671367
1368    // sizes for computation
1369    int bmwidth = 250;
1370    int bmheight = 400;
1371    int segwidth = 40;
1372    int skewwidth = 40;
1368   // sizes for computation
1369   int bmwidth = 250;
1370   int bmheight = 400;
1371   int segwidth = 40;
1372   int skewwidth = 40;
13731373
1374    // allocate a temporary bitmap for drawing
1375    bitmap_argb32 tempbitmap(bmwidth + skewwidth, bmheight);
1376    tempbitmap.fill(rgb_t(0xff,0x00,0x00,0x00));
1374   // allocate a temporary bitmap for drawing
1375   bitmap_argb32 tempbitmap(bmwidth + skewwidth, bmheight);
1376   tempbitmap.fill(rgb_t(0xff,0x00,0x00,0x00));
13771377
1378    // top bar
1379    draw_segment_horizontal(tempbitmap, 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, 0 + segwidth/2, segwidth, (pattern & (1 << 0)) ? onpen : offpen);
1378   // top bar
1379   draw_segment_horizontal(tempbitmap, 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, 0 + segwidth/2, segwidth, (pattern & (1 << 0)) ? onpen : offpen);
13801380
1381    // top-right bar
1382    draw_segment_vertical(tempbitmap, 0 + 2*segwidth/3, bmheight/2 - segwidth/3, bmwidth - segwidth/2, segwidth, (pattern & (1 << 1)) ? onpen : offpen);
1381   // top-right bar
1382   draw_segment_vertical(tempbitmap, 0 + 2*segwidth/3, bmheight/2 - segwidth/3, bmwidth - segwidth/2, segwidth, (pattern & (1 << 1)) ? onpen : offpen);
13831383
1384    // bottom-right bar
1385    draw_segment_vertical(tempbitmap, bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, bmwidth - segwidth/2, segwidth, (pattern & (1 << 2)) ? onpen : offpen);
1384   // bottom-right bar
1385   draw_segment_vertical(tempbitmap, bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, bmwidth - segwidth/2, segwidth, (pattern & (1 << 2)) ? onpen : offpen);
13861386
1387    // bottom bar
1388    draw_segment_horizontal(tempbitmap, 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, bmheight - segwidth/2, segwidth, (pattern & (1 << 3)) ? onpen : offpen);
1387   // bottom bar
1388   draw_segment_horizontal(tempbitmap, 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, bmheight - segwidth/2, segwidth, (pattern & (1 << 3)) ? onpen : offpen);
13891389
1390    // bottom-left bar
1391    draw_segment_vertical(tempbitmap, bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, 0 + segwidth/2, segwidth, (pattern & (1 << 4)) ? onpen : offpen);
1390   // bottom-left bar
1391   draw_segment_vertical(tempbitmap, bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, 0 + segwidth/2, segwidth, (pattern & (1 << 4)) ? onpen : offpen);
13921392
1393    // top-left bar
1394    draw_segment_vertical(tempbitmap, 0 + 2*segwidth/3, bmheight/2 - segwidth/3, 0 + segwidth/2, segwidth, (pattern & (1 << 5)) ? onpen : offpen);
1393   // top-left bar
1394   draw_segment_vertical(tempbitmap, 0 + 2*segwidth/3, bmheight/2 - segwidth/3, 0 + segwidth/2, segwidth, (pattern & (1 << 5)) ? onpen : offpen);
13951395
1396    // middle bar
1397    draw_segment_horizontal(tempbitmap, 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, bmheight/2, segwidth, (pattern & (1 << 6)) ? onpen : offpen);
1396   // middle bar
1397   draw_segment_horizontal(tempbitmap, 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, bmheight/2, segwidth, (pattern & (1 << 6)) ? onpen : offpen);
13981398
1399    // apply skew
1400    apply_skew(tempbitmap, 40);
1399   // apply skew
1400   apply_skew(tempbitmap, 40);
14011401
1402    // decimal point
1403    draw_segment_decimal(tempbitmap, bmwidth + segwidth/2, bmheight - segwidth/2, segwidth, (pattern & (1 << 7)) ? onpen : offpen);
1402   // decimal point
1403   draw_segment_decimal(tempbitmap, bmwidth + segwidth/2, bmheight - segwidth/2, segwidth, (pattern & (1 << 7)) ? onpen : offpen);
14041404
1405    // resample to the target size
1406    render_resample_argb_bitmap_hq(dest, tempbitmap, m_color);
1405   // resample to the target size
1406   render_resample_argb_bitmap_hq(dest, tempbitmap, m_color);
14071407}
14081408
14091409
14101410//-----------------------------------------------------------------
1411//  draw_led8seg_gts1 - draw a 8-segment fluorescent (Gottlieb System 1)
1411//  draw_led8seg - draw a 8-segment fluorescent (Gottlieb System 1)
14121412//-----------------------------------------------------------------
14131413
1414void layout_element::component::draw_led8seg_gts1(bitmap_argb32 &dest, const rectangle &bounds, int pattern)
1414void layout_element::component::draw_led8seg(bitmap_argb32 &dest, const rectangle &bounds, int pattern)
14151415{
1416    const rgb_t onpen = rgb_t(0xff,0xff,0xff,0xff);
1417    const rgb_t offpen = rgb_t(0xff,0x20,0x20,0x20);
1418    const rgb_t backpen = rgb_t(0xff,0x00,0x00,0x00);
1416   const rgb_t onpen = rgb_t(0xff,0xff,0xff,0xff);
1417   const rgb_t offpen = rgb_t(0xff,0x20,0x20,0x20);
1418   const rgb_t backpen = rgb_t(0xff,0x00,0x00,0x00);
14191419
1420    // sizes for computation
1421    int bmwidth = 250;
1422    int bmheight = 400;
1423    int segwidth = 40;
1424    int skewwidth = 40;
1420   // sizes for computation
1421   int bmwidth = 250;
1422   int bmheight = 400;
1423   int segwidth = 40;
1424   int skewwidth = 40;
14251425
1426    // allocate a temporary bitmap for drawing
1427    bitmap_argb32 tempbitmap(bmwidth + skewwidth, bmheight);
1428    tempbitmap.fill(backpen);
1426   // allocate a temporary bitmap for drawing
1427   bitmap_argb32 tempbitmap(bmwidth + skewwidth, bmheight);
1428   tempbitmap.fill(backpen);
14291429
1430    // top bar
1431    draw_segment_horizontal(tempbitmap, 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, 0 + segwidth/2, segwidth, (pattern & (1 << 0)) ? onpen : offpen);
1430   // top bar
1431   draw_segment_horizontal(tempbitmap, 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, 0 + segwidth/2, segwidth, (pattern & (1 << 0)) ? onpen : offpen);
14321432
1433    // top-right bar
1434    draw_segment_vertical(tempbitmap, 0 + 2*segwidth/3, bmheight/2 - segwidth/3, bmwidth - segwidth/2, segwidth, (pattern & (1 << 1)) ? onpen : offpen);
1433   // top-right bar
1434   draw_segment_vertical(tempbitmap, 0 + 2*segwidth/3, bmheight/2 - segwidth/3, bmwidth - segwidth/2, segwidth, (pattern & (1 << 1)) ? onpen : offpen);
14351435
1436    // bottom-right bar
1437    draw_segment_vertical(tempbitmap, bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, bmwidth - segwidth/2, segwidth, (pattern & (1 << 2)) ? onpen : offpen);
1436   // bottom-right bar
1437   draw_segment_vertical(tempbitmap, bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, bmwidth - segwidth/2, segwidth, (pattern & (1 << 2)) ? onpen : offpen);
14381438
1439    // bottom bar
1440    draw_segment_horizontal(tempbitmap, 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, bmheight - segwidth/2, segwidth, (pattern & (1 << 3)) ? onpen : offpen);
1439   // bottom bar
1440   draw_segment_horizontal(tempbitmap, 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, bmheight - segwidth/2, segwidth, (pattern & (1 << 3)) ? onpen : offpen);
14411441
1442    // bottom-left bar
1443    draw_segment_vertical(tempbitmap, bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, 0 + segwidth/2, segwidth, (pattern & (1 << 4)) ? onpen : offpen);
1442   // bottom-left bar
1443   draw_segment_vertical(tempbitmap, bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, 0 + segwidth/2, segwidth, (pattern & (1 << 4)) ? onpen : offpen);
14441444
1445    // top-left bar
1446    draw_segment_vertical(tempbitmap, 0 + 2*segwidth/3, bmheight/2 - segwidth/3, 0 + segwidth/2, segwidth, (pattern & (1 << 5)) ? onpen : offpen);
1445   // top-left bar
1446   draw_segment_vertical(tempbitmap, 0 + 2*segwidth/3, bmheight/2 - segwidth/3, 0 + segwidth/2, segwidth, (pattern & (1 << 5)) ? onpen : offpen);
14471447
1448    // horizontal bars
1449    draw_segment_horizontal(tempbitmap, 0 + 2*segwidth/3, 2*bmwidth/3 - 2*segwidth/3, bmheight/2, segwidth, (pattern & (1 << 6)) ? onpen : offpen);
1450    draw_segment_horizontal(tempbitmap, 0 + 2*segwidth/3 + bmwidth/2, bmwidth - 2*segwidth/3, bmheight/2, segwidth, (pattern & (1 << 6)) ? onpen : offpen);
1448   // horizontal bars
1449   draw_segment_horizontal(tempbitmap, 0 + 2*segwidth/3, 2*bmwidth/3 - 2*segwidth/3, bmheight/2, segwidth, (pattern & (1 << 6)) ? onpen : offpen);
1450   draw_segment_horizontal(tempbitmap, 0 + 2*segwidth/3 + bmwidth/2, bmwidth - 2*segwidth/3, bmheight/2, segwidth, (pattern & (1 << 6)) ? onpen : offpen);
14511451
1452    // vertical bars
1453    draw_segment_vertical(tempbitmap, 0 + segwidth/3 - 8, bmheight/2 - segwidth/3 + 2, 2*bmwidth/3 - segwidth/2 - 4, segwidth + 8, backpen);
1454    draw_segment_vertical(tempbitmap, 0 + segwidth/3, bmheight/2 - segwidth/3, 2*bmwidth/3 - segwidth/2 - 4, segwidth, (pattern & (1 << 7)) ? onpen : offpen);
1452   // vertical bars
1453   draw_segment_vertical(tempbitmap, 0 + segwidth/3 - 8, bmheight/2 - segwidth/3 + 2, 2*bmwidth/3 - segwidth/2 - 4, segwidth + 8, backpen);
1454   draw_segment_vertical(tempbitmap, 0 + segwidth/3, bmheight/2 - segwidth/3, 2*bmwidth/3 - segwidth/2 - 4, segwidth, (pattern & (1 << 7)) ? onpen : offpen);
14551455
1456    draw_segment_vertical(tempbitmap, bmheight/2 + segwidth/3 - 2, bmheight - segwidth/3 + 8, 2*bmwidth/3 - segwidth/2 - 4, segwidth + 8, backpen);
1457    draw_segment_vertical(tempbitmap, bmheight/2 + segwidth/3, bmheight - segwidth/3, 2*bmwidth/3 - segwidth/2 - 4, segwidth, (pattern & (1 << 7)) ? onpen : offpen);
1456   draw_segment_vertical(tempbitmap, bmheight/2 + segwidth/3 - 2, bmheight - segwidth/3 + 8, 2*bmwidth/3 - segwidth/2 - 4, segwidth + 8, backpen);
1457   draw_segment_vertical(tempbitmap, bmheight/2 + segwidth/3, bmheight - segwidth/3, 2*bmwidth/3 - segwidth/2 - 4, segwidth, (pattern & (1 << 7)) ? onpen : offpen);
14581458
1459    // apply skew
1460    apply_skew(tempbitmap, 40);
1459   // apply skew
1460   apply_skew(tempbitmap, 40);
14611461
1462    // resample to the target size
1463    render_resample_argb_bitmap_hq(dest, tempbitmap, m_color);
1462   // resample to the target size
1463   render_resample_argb_bitmap_hq(dest, tempbitmap, m_color);
14641464}
14651465
14661466
r242301r242302
14701470
14711471void layout_element::component::draw_led14seg(bitmap_argb32 &dest, const rectangle &bounds, int pattern)
14721472{
1473    const rgb_t onpen = rgb_t(0xff, 0xff, 0xff, 0xff);
1474    const rgb_t offpen = rgb_t(0xff, 0x20, 0x20, 0x20);
1473   const rgb_t onpen = rgb_t(0xff, 0xff, 0xff, 0xff);
1474   const rgb_t offpen = rgb_t(0xff, 0x20, 0x20, 0x20);
14751475
1476    // sizes for computation
1477    int bmwidth = 250;
1478    int bmheight = 400;
1479    int segwidth = 40;
1480    int skewwidth = 40;
1476   // sizes for computation
1477   int bmwidth = 250;
1478   int bmheight = 400;
1479   int segwidth = 40;
1480   int skewwidth = 40;
14811481
1482    // allocate a temporary bitmap for drawing
1483    bitmap_argb32 tempbitmap(bmwidth + skewwidth, bmheight);
1484    tempbitmap.fill(rgb_t(0xff, 0x00, 0x00, 0x00));
1482   // allocate a temporary bitmap for drawing
1483   bitmap_argb32 tempbitmap(bmwidth + skewwidth, bmheight);
1484   tempbitmap.fill(rgb_t(0xff, 0x00, 0x00, 0x00));
14851485
1486    // top bar
1487    draw_segment_horizontal(tempbitmap,
1488        0 + 2*segwidth/3, bmwidth - 2*segwidth/3, 0 + segwidth/2,
1489        segwidth, (pattern & (1 << 0)) ? onpen : offpen);
1486   // top bar
1487   draw_segment_horizontal(tempbitmap,
1488      0 + 2*segwidth/3, bmwidth - 2*segwidth/3, 0 + segwidth/2,
1489      segwidth, (pattern & (1 << 0)) ? onpen : offpen);
14901490
1491    // right-top bar
1492    draw_segment_vertical(tempbitmap,
1493        0 + 2*segwidth/3, bmheight/2 - segwidth/3, bmwidth - segwidth/2,
1494        segwidth, (pattern & (1 << 1)) ? onpen : offpen);
1491   // right-top bar
1492   draw_segment_vertical(tempbitmap,
1493      0 + 2*segwidth/3, bmheight/2 - segwidth/3, bmwidth - segwidth/2,
1494      segwidth, (pattern & (1 << 1)) ? onpen : offpen);
14951495
1496    // right-bottom bar
1497    draw_segment_vertical(tempbitmap,
1498        bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, bmwidth - segwidth/2,
1499        segwidth, (pattern & (1 << 2)) ? onpen : offpen);
1496   // right-bottom bar
1497   draw_segment_vertical(tempbitmap,
1498      bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, bmwidth - segwidth/2,
1499      segwidth, (pattern & (1 << 2)) ? onpen : offpen);
15001500
1501    // bottom bar
1502    draw_segment_horizontal(tempbitmap,
1503        0 + 2*segwidth/3, bmwidth - 2*segwidth/3, bmheight - segwidth/2,
1504        segwidth, (pattern & (1 << 3)) ? onpen : offpen);
1501   // bottom bar
1502   draw_segment_horizontal(tempbitmap,
1503      0 + 2*segwidth/3, bmwidth - 2*segwidth/3, bmheight - segwidth/2,
1504      segwidth, (pattern & (1 << 3)) ? onpen : offpen);
15051505
1506    // left-bottom bar
1507    draw_segment_vertical(tempbitmap,
1508        bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, 0 + segwidth/2,
1509        segwidth, (pattern & (1 << 4)) ? onpen : offpen);
1506   // left-bottom bar
1507   draw_segment_vertical(tempbitmap,
1508      bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, 0 + segwidth/2,
1509      segwidth, (pattern & (1 << 4)) ? onpen : offpen);
15101510
1511    // left-top bar
1512    draw_segment_vertical(tempbitmap,
1513        0 + 2*segwidth/3, bmheight/2 - segwidth/3, 0 + segwidth/2,
1514        segwidth, (pattern & (1 << 5)) ? onpen : offpen);
1511   // left-top bar
1512   draw_segment_vertical(tempbitmap,
1513      0 + 2*segwidth/3, bmheight/2 - segwidth/3, 0 + segwidth/2,
1514      segwidth, (pattern & (1 << 5)) ? onpen : offpen);
15151515
1516    // horizontal-middle-left bar
1517    draw_segment_horizontal_caps(tempbitmap,
1518        0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight/2,
1519        segwidth, LINE_CAP_START, (pattern & (1 << 6)) ? onpen : offpen);
1516   // horizontal-middle-left bar
1517   draw_segment_horizontal_caps(tempbitmap,
1518      0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight/2,
1519      segwidth, LINE_CAP_START, (pattern & (1 << 6)) ? onpen : offpen);
15201520
1521    // horizontal-middle-right bar
1522    draw_segment_horizontal_caps(tempbitmap,
1523        0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight/2,
1524        segwidth, LINE_CAP_END, (pattern & (1 << 7)) ? onpen : offpen);
1521   // horizontal-middle-right bar
1522   draw_segment_horizontal_caps(tempbitmap,
1523      0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight/2,
1524      segwidth, LINE_CAP_END, (pattern & (1 << 7)) ? onpen : offpen);
15251525
1526    // vertical-middle-top bar
1527    draw_segment_vertical_caps(tempbitmap,
1528        0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, bmwidth/2,
1529        segwidth, LINE_CAP_NONE, (pattern & (1 << 8)) ? onpen : offpen);
1526   // vertical-middle-top bar
1527   draw_segment_vertical_caps(tempbitmap,
1528      0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, bmwidth/2,
1529      segwidth, LINE_CAP_NONE, (pattern & (1 << 8)) ? onpen : offpen);
15301530
1531    // vertical-middle-bottom bar
1532    draw_segment_vertical_caps(tempbitmap,
1533        bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, bmwidth/2,
1534        segwidth, LINE_CAP_NONE, (pattern & (1 << 9)) ? onpen : offpen);
1531   // vertical-middle-bottom bar
1532   draw_segment_vertical_caps(tempbitmap,
1533      bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, bmwidth/2,
1534      segwidth, LINE_CAP_NONE, (pattern & (1 << 9)) ? onpen : offpen);
15351535
1536    // diagonal-left-bottom bar
1537    draw_segment_diagonal_1(tempbitmap,
1538        0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
1539        bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
1540        segwidth, (pattern & (1 << 10)) ? onpen : offpen);
1536   // diagonal-left-bottom bar
1537   draw_segment_diagonal_1(tempbitmap,
1538      0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
1539      bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
1540      segwidth, (pattern & (1 << 10)) ? onpen : offpen);
15411541
1542    // diagonal-left-top bar
1543    draw_segment_diagonal_2(tempbitmap,
1544        0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
1545        0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
1546        segwidth, (pattern & (1 << 11)) ? onpen : offpen);
1542   // diagonal-left-top bar
1543   draw_segment_diagonal_2(tempbitmap,
1544      0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
1545      0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
1546      segwidth, (pattern & (1 << 11)) ? onpen : offpen);
15471547
1548    // diagonal-right-top bar
1549    draw_segment_diagonal_1(tempbitmap,
1550        bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
1551        0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
1552        segwidth, (pattern & (1 << 12)) ? onpen : offpen);
1548   // diagonal-right-top bar
1549   draw_segment_diagonal_1(tempbitmap,
1550      bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
1551      0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
1552      segwidth, (pattern & (1 << 12)) ? onpen : offpen);
15531553
1554    // diagonal-right-bottom bar
1555    draw_segment_diagonal_2(tempbitmap,
1556        bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
1557        bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
1558        segwidth, (pattern & (1 << 13)) ? onpen : offpen);
1554   // diagonal-right-bottom bar
1555   draw_segment_diagonal_2(tempbitmap,
1556      bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
1557      bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
1558      segwidth, (pattern & (1 << 13)) ? onpen : offpen);
15591559
1560    // apply skew
1561    apply_skew(tempbitmap, 40);
1560   // apply skew
1561   apply_skew(tempbitmap, 40);
15621562
1563    // resample to the target size
1564    render_resample_argb_bitmap_hq(dest, tempbitmap, m_color);
1563   // resample to the target size
1564   render_resample_argb_bitmap_hq(dest, tempbitmap, m_color);
15651565}
15661566
15671567
r242301r242302
15721572
15731573void layout_element::component::draw_led14segsc(bitmap_argb32 &dest, const rectangle &bounds, int pattern)
15741574{
1575    const rgb_t onpen = rgb_t(0xff, 0xff, 0xff, 0xff);
1576    const rgb_t offpen = rgb_t(0xff, 0x20, 0x20, 0x20);
1575   const rgb_t onpen = rgb_t(0xff, 0xff, 0xff, 0xff);
1576   const rgb_t offpen = rgb_t(0xff, 0x20, 0x20, 0x20);
15771577
1578    // sizes for computation
1579    int bmwidth = 250;
1580    int bmheight = 400;
1581    int segwidth = 40;
1582    int skewwidth = 40;
1578   // sizes for computation
1579   int bmwidth = 250;
1580   int bmheight = 400;
1581   int segwidth = 40;
1582   int skewwidth = 40;
15831583
1584    // allocate a temporary bitmap for drawing, adding some extra space for the tail
1585    bitmap_argb32 tempbitmap(bmwidth + skewwidth, bmheight + segwidth);
1586    tempbitmap.fill(rgb_t(0xff, 0x00, 0x00, 0x00));
1584   // allocate a temporary bitmap for drawing, adding some extra space for the tail
1585   bitmap_argb32 tempbitmap(bmwidth + skewwidth, bmheight + segwidth);
1586   tempbitmap.fill(rgb_t(0xff, 0x00, 0x00, 0x00));
15871587
1588    // top bar
1589    draw_segment_horizontal(tempbitmap,
1590        0 + 2*segwidth/3, bmwidth - 2*segwidth/3, 0 + segwidth/2,
1591        segwidth, (pattern & (1 << 0)) ? onpen : offpen);
1588   // top bar
1589   draw_segment_horizontal(tempbitmap,
1590      0 + 2*segwidth/3, bmwidth - 2*segwidth/3, 0 + segwidth/2,
1591      segwidth, (pattern & (1 << 0)) ? onpen : offpen);
15921592
1593    // right-top bar
1594    draw_segment_vertical(tempbitmap,
1595        0 + 2*segwidth/3, bmheight/2 - segwidth/3, bmwidth - segwidth/2,
1596        segwidth, (pattern & (1 << 1)) ? onpen : offpen);
1593   // right-top bar
1594   draw_segment_vertical(tempbitmap,
1595      0 + 2*segwidth/3, bmheight/2 - segwidth/3, bmwidth - segwidth/2,
1596      segwidth, (pattern & (1 << 1)) ? onpen : offpen);
15971597
1598    // right-bottom bar
1599    draw_segment_vertical(tempbitmap,
1600        bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, bmwidth - segwidth/2,
1601        segwidth, (pattern & (1 << 2)) ? onpen : offpen);
1598   // right-bottom bar
1599   draw_segment_vertical(tempbitmap,
1600      bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, bmwidth - segwidth/2,
1601      segwidth, (pattern & (1 << 2)) ? onpen : offpen);
16021602
1603    // bottom bar
1604    draw_segment_horizontal(tempbitmap,
1605        0 + 2*segwidth/3, bmwidth - 2*segwidth/3, bmheight - segwidth/2,
1606        segwidth, (pattern & (1 << 3)) ? onpen : offpen);
1603   // bottom bar
1604   draw_segment_horizontal(tempbitmap,
1605      0 + 2*segwidth/3, bmwidth - 2*segwidth/3, bmheight - segwidth/2,
1606      segwidth, (pattern & (1 << 3)) ? onpen : offpen);
16071607
1608    // left-bottom bar
1609    draw_segment_vertical(tempbitmap,
1610        bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, 0 + segwidth/2,
1611        segwidth, (pattern & (1 << 4)) ? onpen : offpen);
1608   // left-bottom bar
1609   draw_segment_vertical(tempbitmap,
1610      bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, 0 + segwidth/2,
1611      segwidth, (pattern & (1 << 4)) ? onpen : offpen);
16121612
1613    // left-top bar
1614    draw_segment_vertical(tempbitmap,
1615        0 + 2*segwidth/3, bmheight/2 - segwidth/3, 0 + segwidth/2,
1616        segwidth, (pattern & (1 << 5)) ? onpen : offpen);
1613   // left-top bar
1614   draw_segment_vertical(tempbitmap,
1615      0 + 2*segwidth/3, bmheight/2 - segwidth/3, 0 + segwidth/2,
1616      segwidth, (pattern & (1 << 5)) ? onpen : offpen);
16171617
1618    // horizontal-middle-left bar
1619    draw_segment_horizontal_caps(tempbitmap,
1620        0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight/2,
1621        segwidth, LINE_CAP_START, (pattern & (1 << 6)) ? onpen : offpen);
1618   // horizontal-middle-left bar
1619   draw_segment_horizontal_caps(tempbitmap,
1620      0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight/2,
1621      segwidth, LINE_CAP_START, (pattern & (1 << 6)) ? onpen : offpen);
16221622
1623    // horizontal-middle-right bar
1624    draw_segment_horizontal_caps(tempbitmap,
1625        0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight/2,
1626        segwidth, LINE_CAP_END, (pattern & (1 << 7)) ? onpen : offpen);
1623   // horizontal-middle-right bar
1624   draw_segment_horizontal_caps(tempbitmap,
1625      0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight/2,
1626      segwidth, LINE_CAP_END, (pattern & (1 << 7)) ? onpen : offpen);
16271627
1628    // vertical-middle-top bar
1629    draw_segment_vertical_caps(tempbitmap,
1630        0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, bmwidth/2,
1631        segwidth, LINE_CAP_NONE, (pattern & (1 << 8)) ? onpen : offpen);
1628   // vertical-middle-top bar
1629   draw_segment_vertical_caps(tempbitmap,
1630      0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, bmwidth/2,
1631      segwidth, LINE_CAP_NONE, (pattern & (1 << 8)) ? onpen : offpen);
16321632
1633    // vertical-middle-bottom bar
1634    draw_segment_vertical_caps(tempbitmap,
1635        bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, bmwidth/2,
1636        segwidth, LINE_CAP_NONE, (pattern & (1 << 9)) ? onpen : offpen);
1633   // vertical-middle-bottom bar
1634   draw_segment_vertical_caps(tempbitmap,
1635      bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, bmwidth/2,
1636      segwidth, LINE_CAP_NONE, (pattern & (1 << 9)) ? onpen : offpen);
16371637
1638    // diagonal-left-bottom bar
1639    draw_segment_diagonal_1(tempbitmap,
1640        0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
1641        bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
1642        segwidth, (pattern & (1 << 10)) ? onpen : offpen);
1638   // diagonal-left-bottom bar
1639   draw_segment_diagonal_1(tempbitmap,
1640      0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
1641      bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
1642      segwidth, (pattern & (1 << 10)) ? onpen : offpen);
16431643
1644    // diagonal-left-top bar
1645    draw_segment_diagonal_2(tempbitmap,
1646        0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
1647        0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
1648        segwidth, (pattern & (1 << 11)) ? onpen : offpen);
1644   // diagonal-left-top bar
1645   draw_segment_diagonal_2(tempbitmap,
1646      0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
1647      0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
1648      segwidth, (pattern & (1 << 11)) ? onpen : offpen);
16491649
1650    // diagonal-right-top bar
1651    draw_segment_diagonal_1(tempbitmap,
1652        bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
1653        0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
1654        segwidth, (pattern & (1 << 12)) ? onpen : offpen);
1650   // diagonal-right-top bar
1651   draw_segment_diagonal_1(tempbitmap,
1652      bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
1653      0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
1654      segwidth, (pattern & (1 << 12)) ? onpen : offpen);
16551655
1656    // diagonal-right-bottom bar
1657    draw_segment_diagonal_2(tempbitmap,
1658        bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
1659        bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
1660        segwidth, (pattern & (1 << 13)) ? onpen : offpen);
1656   // diagonal-right-bottom bar
1657   draw_segment_diagonal_2(tempbitmap,
1658      bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
1659      bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
1660      segwidth, (pattern & (1 << 13)) ? onpen : offpen);
16611661
1662    // apply skew
1663    apply_skew(tempbitmap, 40);
1662   // apply skew
1663   apply_skew(tempbitmap, 40);
16641664
1665    // comma tail
1666    draw_segment_diagonal_1(tempbitmap,
1667        bmwidth - (segwidth/2), bmwidth + segwidth,
1668        bmheight - (segwidth), bmheight + segwidth*1.5,
1669        segwidth/2, (pattern & (1 << 15)) ? onpen : offpen);
1665   // comma tail
1666   draw_segment_diagonal_1(tempbitmap,
1667      bmwidth - (segwidth/2), bmwidth + segwidth,
1668      bmheight - (segwidth), bmheight + segwidth*1.5,
1669      segwidth/2, (pattern & (1 << 15)) ? onpen : offpen);
16701670
1671    // decimal point
1672    draw_segment_decimal(tempbitmap, bmwidth + segwidth/2, bmheight - segwidth/2, segwidth, (pattern & (1 << 14)) ? onpen : offpen);
1671   // decimal point
1672   draw_segment_decimal(tempbitmap, bmwidth + segwidth/2, bmheight - segwidth/2, segwidth, (pattern & (1 << 14)) ? onpen : offpen);
16731673
1674    // resample to the target size
1675    render_resample_argb_bitmap_hq(dest, tempbitmap, m_color);
1674   // resample to the target size
1675   render_resample_argb_bitmap_hq(dest, tempbitmap, m_color);
16761676}
16771677
16781678
r242301r242302
16821682
16831683void layout_element::component::draw_led16seg(bitmap_argb32 &dest, const rectangle &bounds, int pattern)
16841684{
1685    const rgb_t onpen = rgb_t(0xff, 0xff, 0xff, 0xff);
1686    const rgb_t offpen = rgb_t(0xff, 0x20, 0x20, 0x20);
1685   const rgb_t onpen = rgb_t(0xff, 0xff, 0xff, 0xff);
1686   const rgb_t offpen = rgb_t(0xff, 0x20, 0x20, 0x20);
16871687
1688    // sizes for computation
1689    int bmwidth = 250;
1690    int bmheight = 400;
1691    int segwidth = 40;
1692    int skewwidth = 40;
1688   // sizes for computation
1689   int bmwidth = 250;
1690   int bmheight = 400;
1691   int segwidth = 40;
1692   int skewwidth = 40;
16931693
1694    // allocate a temporary bitmap for drawing
1695    bitmap_argb32 tempbitmap(bmwidth + skewwidth, bmheight);
1696    tempbitmap.fill(rgb_t(0xff, 0x00, 0x00, 0x00));
1694   // allocate a temporary bitmap for drawing
1695   bitmap_argb32 tempbitmap(bmwidth + skewwidth, bmheight);
1696   tempbitmap.fill(rgb_t(0xff, 0x00, 0x00, 0x00));
16971697
1698    // top-left bar
1699    draw_segment_horizontal_caps(tempbitmap,
1700        0 + 2*segwidth/3, bmwidth/2 - segwidth/10, 0 + segwidth/2,
1701        segwidth, LINE_CAP_START, (pattern & (1 << 0)) ? onpen : offpen);
1698   // top-left bar
1699   draw_segment_horizontal_caps(tempbitmap,
1700      0 + 2*segwidth/3, bmwidth/2 - segwidth/10, 0 + segwidth/2,
1701      segwidth, LINE_CAP_START, (pattern & (1 << 0)) ? onpen : offpen);
17021702
1703    // top-right bar
1704    draw_segment_horizontal_caps(tempbitmap,
1705        0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, 0 + segwidth/2,
1706        segwidth, LINE_CAP_END, (pattern & (1 << 1)) ? onpen : offpen);
1703   // top-right bar
1704   draw_segment_horizontal_caps(tempbitmap,
1705      0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, 0 + segwidth/2,
1706      segwidth, LINE_CAP_END, (pattern & (1 << 1)) ? onpen : offpen);
17071707
1708    // right-top bar
1709    draw_segment_vertical(tempbitmap,
1710        0 + 2*segwidth/3, bmheight/2 - segwidth/3, bmwidth - segwidth/2,
1711        segwidth, (pattern & (1 << 2)) ? onpen : offpen);
1708   // right-top bar
1709   draw_segment_vertical(tempbitmap,
1710      0 + 2*segwidth/3, bmheight/2 - segwidth/3, bmwidth - segwidth/2,
1711      segwidth, (pattern & (1 << 2)) ? onpen : offpen);
17121712
1713    // right-bottom bar
1714    draw_segment_vertical(tempbitmap,
1715        bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, bmwidth - segwidth/2,
1716        segwidth, (pattern & (1 << 3)) ? onpen : offpen);
1713   // right-bottom bar
1714   draw_segment_vertical(tempbitmap,
1715      bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, bmwidth - segwidth/2,
1716      segwidth, (pattern & (1 << 3)) ? onpen : offpen);
17171717
1718    // bottom-right bar
1719    draw_segment_horizontal_caps(tempbitmap,
1720        0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight - segwidth/2,
1721        segwidth, LINE_CAP_END, (pattern & (1 << 4)) ? onpen : offpen);
1718   // bottom-right bar
1719   draw_segment_horizontal_caps(tempbitmap,
1720      0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight - segwidth/2,
1721      segwidth, LINE_CAP_END, (pattern & (1 << 4)) ? onpen : offpen);
17221722
1723    // bottom-left bar
1724    draw_segment_horizontal_caps(tempbitmap,
1725        0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight - segwidth/2,
1726        segwidth, LINE_CAP_START, (pattern & (1 << 5)) ? onpen : offpen);
1723   // bottom-left bar
1724   draw_segment_horizontal_caps(tempbitmap,
1725      0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight - segwidth/2,
1726      segwidth, LINE_CAP_START, (pattern & (1 << 5)) ? onpen : offpen);
17271727
1728    // left-bottom bar
1729    draw_segment_vertical(tempbitmap,
1730        bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, 0 + segwidth/2,
1731        segwidth, (pattern & (1 << 6)) ? onpen : offpen);
1728   // left-bottom bar
1729   draw_segment_vertical(tempbitmap,
1730      bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, 0 + segwidth/2,
1731      segwidth, (pattern & (1 << 6)) ? onpen : offpen);
17321732
1733    // left-top bar
1734    draw_segment_vertical(tempbitmap,
1735        0 + 2*segwidth/3, bmheight/2 - segwidth/3, 0 + segwidth/2,
1736        segwidth, (pattern & (1 << 7)) ? onpen : offpen);
1733   // left-top bar
1734   draw_segment_vertical(tempbitmap,
1735      0 + 2*segwidth/3, bmheight/2 - segwidth/3, 0 + segwidth/2,
1736      segwidth, (pattern & (1 << 7)) ? onpen : offpen);
17371737
1738    // horizontal-middle-left bar
1739    draw_segment_horizontal_caps(tempbitmap,
1740        0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight/2,
1741        segwidth, LINE_CAP_START, (pattern & (1 << 8)) ? onpen : offpen);
1738   // horizontal-middle-left bar
1739   draw_segment_horizontal_caps(tempbitmap,
1740      0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight/2,
1741      segwidth, LINE_CAP_START, (pattern & (1 << 8)) ? onpen : offpen);
17421742
1743    // horizontal-middle-right bar
1744    draw_segment_horizontal_caps(tempbitmap,
1745        0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight/2,
1746        segwidth, LINE_CAP_END, (pattern & (1 << 9)) ? onpen : offpen);
1743   // horizontal-middle-right bar
1744   draw_segment_horizontal_caps(tempbitmap,
1745      0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight/2,
1746      segwidth, LINE_CAP_END, (pattern & (1 << 9)) ? onpen : offpen);
17471747
1748    // vertical-middle-top bar
1749    draw_segment_vertical_caps(tempbitmap,
1750        0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, bmwidth/2,
1751        segwidth, LINE_CAP_NONE, (pattern & (1 << 10)) ? onpen : offpen);
1748   // vertical-middle-top bar
1749   draw_segment_vertical_caps(tempbitmap,
1750      0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, bmwidth/2,
1751      segwidth, LINE_CAP_NONE, (pattern & (1 << 10)) ? onpen : offpen);
17521752
1753    // vertical-middle-bottom bar
1754    draw_segment_vertical_caps(tempbitmap,
1755        bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, bmwidth/2,
1756        segwidth, LINE_CAP_NONE, (pattern & (1 << 11)) ? onpen : offpen);
1753   // vertical-middle-bottom bar
1754   draw_segment_vertical_caps(tempbitmap,
1755      bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, bmwidth/2,
1756      segwidth, LINE_CAP_NONE, (pattern & (1 << 11)) ? onpen : offpen);
17571757
1758    // diagonal-left-bottom bar
1759    draw_segment_diagonal_1(tempbitmap,
1760        0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
1761        bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
1762        segwidth, (pattern & (1 << 12)) ? onpen : offpen);
1758   // diagonal-left-bottom bar
1759   draw_segment_diagonal_1(tempbitmap,
1760      0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
1761      bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
1762      segwidth, (pattern & (1 << 12)) ? onpen : offpen);
17631763
1764    // diagonal-left-top bar
1765    draw_segment_diagonal_2(tempbitmap,
1766        0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
1767        0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
1768        segwidth, (pattern & (1 << 13)) ? onpen : offpen);
1764   // diagonal-left-top bar
1765   draw_segment_diagonal_2(tempbitmap,
1766      0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
1767      0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
1768      segwidth, (pattern & (1 << 13)) ? onpen : offpen);
17691769
1770    // diagonal-right-top bar
1771    draw_segment_diagonal_1(tempbitmap,
1772        bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
1773        0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
1774        segwidth, (pattern & (1 << 14)) ? onpen : offpen);
1770   // diagonal-right-top bar
1771   draw_segment_diagonal_1(tempbitmap,
1772      bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
1773      0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
1774      segwidth, (pattern & (1 << 14)) ? onpen : offpen);
17751775
1776    // diagonal-right-bottom bar
1777    draw_segment_diagonal_2(tempbitmap,
1778        bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
1779        bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
1780        segwidth, (pattern & (1 << 15)) ? onpen : offpen);
1776   // diagonal-right-bottom bar
1777   draw_segment_diagonal_2(tempbitmap,
1778      bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
1779      bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
1780      segwidth, (pattern & (1 << 15)) ? onpen : offpen);
17811781
1782    // apply skew
1783    apply_skew(tempbitmap, 40);
1782   // apply skew
1783   apply_skew(tempbitmap, 40);
17841784
1785    // resample to the target size
1786    render_resample_argb_bitmap_hq(dest, tempbitmap, m_color);
1785   // resample to the target size
1786   render_resample_argb_bitmap_hq(dest, tempbitmap, m_color);
17871787}
17881788
17891789
r242301r242302
17941794
17951795void layout_element::component::draw_led16segsc(bitmap_argb32 &dest, const rectangle &bounds, int pattern)
17961796{
1797    const rgb_t onpen = rgb_t(0xff, 0xff, 0xff, 0xff);
1798    const rgb_t offpen = rgb_t(0xff, 0x20, 0x20, 0x20);
1797   const rgb_t onpen = rgb_t(0xff, 0xff, 0xff, 0xff);
1798   const rgb_t offpen = rgb_t(0xff, 0x20, 0x20, 0x20);
17991799
1800    // sizes for computation
1801    int bmwidth = 250;
1802    int bmheight = 400;
1803    int segwidth = 40;
1804    int skewwidth = 40;
1800   // sizes for computation
1801   int bmwidth = 250;
1802   int bmheight = 400;
1803   int segwidth = 40;
1804   int skewwidth = 40;
18051805
1806    // allocate a temporary bitmap for drawing
1807    bitmap_argb32 tempbitmap(bmwidth + skewwidth, bmheight + segwidth);
1808    tempbitmap.fill(rgb_t(0xff, 0x00, 0x00, 0x00));
1806   // allocate a temporary bitmap for drawing
1807   bitmap_argb32 tempbitmap(bmwidth + skewwidth, bmheight + segwidth);
1808   tempbitmap.fill(rgb_t(0xff, 0x00, 0x00, 0x00));
18091809
1810    // top-left bar
1811    draw_segment_horizontal_caps(tempbitmap,
1812        0 + 2*segwidth/3, bmwidth/2 - segwidth/10, 0 + segwidth/2,
1813        segwidth, LINE_CAP_START, (pattern & (1 << 0)) ? onpen : offpen);
1810   // top-left bar
1811   draw_segment_horizontal_caps(tempbitmap,
1812      0 + 2*segwidth/3, bmwidth/2 - segwidth/10, 0 + segwidth/2,
1813      segwidth, LINE_CAP_START, (pattern & (1 << 0)) ? onpen : offpen);
18141814
1815    // top-right bar
1816    draw_segment_horizontal_caps(tempbitmap,
1817        0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, 0 + segwidth/2,
1818        segwidth, LINE_CAP_END, (pattern & (1 << 1)) ? onpen : offpen);
1815   // top-right bar
1816   draw_segment_horizontal_caps(tempbitmap,
1817      0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, 0 + segwidth/2,
1818      segwidth, LINE_CAP_END, (pattern & (1 << 1)) ? onpen : offpen);
18191819
1820    // right-top bar
1821    draw_segment_vertical(tempbitmap,
1822        0 + 2*segwidth/3, bmheight/2 - segwidth/3, bmwidth - segwidth/2,
1823        segwidth, (pattern & (1 << 2)) ? onpen : offpen);
1820   // right-top bar
1821   draw_segment_vertical(tempbitmap,
1822      0 + 2*segwidth/3, bmheight/2 - segwidth/3, bmwidth - segwidth/2,
1823      segwidth, (pattern & (1 << 2)) ? onpen : offpen);
18241824
1825    // right-bottom bar
1826    draw_segment_vertical(tempbitmap,
1827        bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, bmwidth - segwidth/2,
1828        segwidth, (pattern & (1 << 3)) ? onpen : offpen);
1825   // right-bottom bar
1826   draw_segment_vertical(tempbitmap,
1827      bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, bmwidth - segwidth/2,
1828      segwidth, (pattern & (1 << 3)) ? onpen : offpen);
18291829
1830    // bottom-right bar
1831    draw_segment_horizontal_caps(tempbitmap,
1832        0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight - segwidth/2,
1833        segwidth, LINE_CAP_END, (pattern & (1 << 4)) ? onpen : offpen);
1830   // bottom-right bar
1831   draw_segment_horizontal_caps(tempbitmap,
1832      0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight - segwidth/2,
1833      segwidth, LINE_CAP_END, (pattern & (1 << 4)) ? onpen : offpen);
18341834
1835    // bottom-left bar
1836    draw_segment_horizontal_caps(tempbitmap,
1837        0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight - segwidth/2,
1838        segwidth, LINE_CAP_START, (pattern & (1 << 5)) ? onpen : offpen);
1835   // bottom-left bar
1836   draw_segment_horizontal_caps(tempbitmap,
1837      0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight - segwidth/2,
1838      segwidth, LINE_CAP_START, (pattern & (1 << 5)) ? onpen : offpen);
18391839
1840    // left-bottom bar
1841    draw_segment_vertical(tempbitmap,
1842        bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, 0 + segwidth/2,
1843        segwidth, (pattern & (1 << 6)) ? onpen : offpen);
1840   // left-bottom bar
1841   draw_segment_vertical(tempbitmap,
1842      bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, 0 + segwidth/2,
1843      segwidth, (pattern & (1 << 6)) ? onpen : offpen);
18441844
1845    // left-top bar
1846    draw_segment_vertical(tempbitmap,
1847        0 + 2*segwidth/3, bmheight/2 - segwidth/3, 0 + segwidth/2,
1848        segwidth, (pattern & (1 << 7)) ? onpen : offpen);
1845   // left-top bar
1846   draw_segment_vertical(tempbitmap,
1847      0 + 2*segwidth/3, bmheight/2 - segwidth/3, 0 + segwidth/2,
1848      segwidth, (pattern & (1 << 7)) ? onpen : offpen);
18491849
1850    // horizontal-middle-left bar
1851    draw_segment_horizontal_caps(tempbitmap,
1852        0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight/2,
1853        segwidth, LINE_CAP_START, (pattern & (1 << 8)) ? onpen : offpen);
1850   // horizontal-middle-left bar
1851   draw_segment_horizontal_caps(tempbitmap,
1852      0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight/2,
1853      segwidth, LINE_CAP_START, (pattern & (1 << 8)) ? onpen : offpen);
18541854
1855    // horizontal-middle-right bar
1856    draw_segment_horizontal_caps(tempbitmap,
1857        0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight/2,
1858        segwidth, LINE_CAP_END, (pattern & (1 << 9)) ? onpen : offpen);
1855   // horizontal-middle-right bar
1856   draw_segment_horizontal_caps(tempbitmap,
1857      0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight/2,
1858      segwidth, LINE_CAP_END, (pattern & (1 << 9)) ? onpen : offpen);
18591859
1860    // vertical-middle-top bar
1861    draw_segment_vertical_caps(tempbitmap,
1862        0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, bmwidth/2,
1863        segwidth, LINE_CAP_NONE, (pattern & (1 << 10)) ? onpen : offpen);
1860   // vertical-middle-top bar
1861   draw_segment_vertical_caps(tempbitmap,
1862      0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, bmwidth/2,
1863      segwidth, LINE_CAP_NONE, (pattern & (1 << 10)) ? onpen : offpen);
18641864
1865    // vertical-middle-bottom bar
1866    draw_segment_vertical_caps(tempbitmap,
1867        bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, bmwidth/2,
1868        segwidth, LINE_CAP_NONE, (pattern & (1 << 11)) ? onpen : offpen);
1865   // vertical-middle-bottom bar
1866   draw_segment_vertical_caps(tempbitmap,
1867      bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, bmwidth/2,
1868      segwidth, LINE_CAP_NONE, (pattern & (1 << 11)) ? onpen : offpen);
18691869
1870    // diagonal-left-bottom bar
1871    draw_segment_diagonal_1(tempbitmap,
1872        0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
1873        bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
1874        segwidth, (pattern & (1 << 12)) ? onpen : offpen);
1870   // diagonal-left-bottom bar
1871   draw_segment_diagonal_1(tempbitmap,
1872      0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
1873      bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
1874      segwidth, (pattern & (1 << 12)) ? onpen : offpen);
18751875
1876    // diagonal-left-top bar
1877    draw_segment_diagonal_2(tempbitmap,
1878        0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
1879        0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
1880        segwidth, (pattern & (1 << 13)) ? onpen : offpen);
1876   // diagonal-left-top bar
1877   draw_segment_diagonal_2(tempbitmap,
1878      0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
1879      0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
1880      segwidth, (pattern & (1 << 13)) ? onpen : offpen);
18811881
1882    // diagonal-right-top bar
1883    draw_segment_diagonal_1(tempbitmap,
1884        bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
1885        0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
1886        segwidth, (pattern & (1 << 14)) ? onpen : offpen);
1882   // diagonal-right-top bar
1883   draw_segment_diagonal_1(tempbitmap,
1884      bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
1885      0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
1886      segwidth, (pattern & (1 << 14)) ? onpen : offpen);
18871887
1888    // diagonal-right-bottom bar
1889    draw_segment_diagonal_2(tempbitmap,
1890        bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
1891        bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
1892        segwidth, (pattern & (1 << 15)) ? onpen : offpen);
1888   // diagonal-right-bottom bar
1889   draw_segment_diagonal_2(tempbitmap,
1890      bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
1891      bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
1892      segwidth, (pattern & (1 << 15)) ? onpen : offpen);
18931893
1894    // comma tail
1895    draw_segment_diagonal_1(tempbitmap,
1896        bmwidth - (segwidth/2), bmwidth + segwidth,
1897        bmheight - (segwidth), bmheight + segwidth*1.5,
1898        segwidth/2, (pattern & (1 << 17)) ? onpen : offpen);
1894   // comma tail
1895   draw_segment_diagonal_1(tempbitmap,
1896      bmwidth - (segwidth/2), bmwidth + segwidth,
1897      bmheight - (segwidth), bmheight + segwidth*1.5,
1898      segwidth/2, (pattern & (1 << 17)) ? onpen : offpen);
18991899
1900    // decimal point (draw last for priority)
1901    draw_segment_decimal(tempbitmap, bmwidth + segwidth/2, bmheight - segwidth/2, segwidth, (pattern & (1 << 16)) ? onpen : offpen);
1900   // decimal point (draw last for priority)
1901   draw_segment_decimal(tempbitmap, bmwidth + segwidth/2, bmheight - segwidth/2, segwidth, (pattern & (1 << 16)) ? onpen : offpen);
19021902
1903    // apply skew
1904    apply_skew(tempbitmap, 40);
1903   // apply skew
1904   apply_skew(tempbitmap, 40);
19051905
1906    // resample to the target size
1907    render_resample_argb_bitmap_hq(dest, tempbitmap, m_color);
1906   // resample to the target size
1907   render_resample_argb_bitmap_hq(dest, tempbitmap, m_color);
19081908}
19091909
19101910
r242301r242302
19151915
19161916void layout_element::component::draw_dotmatrix(int dots, bitmap_argb32 &dest, const rectangle &bounds, int pattern)
19171917{
1918    const rgb_t onpen = rgb_t(0xff, 0xff, 0xff, 0xff);
1919    const rgb_t offpen = rgb_t(0xff, 0x20, 0x20, 0x20);
1918   const rgb_t onpen = rgb_t(0xff, 0xff, 0xff, 0xff);
1919   const rgb_t offpen = rgb_t(0xff, 0x20, 0x20, 0x20);
19201920
1921    // sizes for computation
1922    int bmheight = 300;
1923    int dotwidth = 250;
1921   // sizes for computation
1922   int bmheight = 300;
1923   int dotwidth = 250;
19241924
1925    // allocate a temporary bitmap for drawing
1926    bitmap_argb32 tempbitmap(dotwidth*dots, bmheight);
1927    tempbitmap.fill(rgb_t(0xff, 0x00, 0x00, 0x00));
1925   // allocate a temporary bitmap for drawing
1926   bitmap_argb32 tempbitmap(dotwidth*dots, bmheight);
1927   tempbitmap.fill(rgb_t(0xff, 0x00, 0x00, 0x00));
19281928
1929    for (int i = 0; i < dots; i++)
1930        draw_segment_decimal(tempbitmap, ((dotwidth/2 )+ (i * dotwidth)), bmheight/2, dotwidth, (pattern & (1 << i))?onpen:offpen);
1929   for (int i = 0; i < dots; i++)
1930      draw_segment_decimal(tempbitmap, ((dotwidth/2 )+ (i * dotwidth)), bmheight/2, dotwidth, (pattern & (1 << i))?onpen:offpen);
19311931
1932    // resample to the target size
1933    render_resample_argb_bitmap_hq(dest, tempbitmap, m_color);
1932   // resample to the target size
1933   render_resample_argb_bitmap_hq(dest, tempbitmap, m_color);
19341934}
19351935
19361936
r242301r242302
19421942
19431943void layout_element::component::draw_segment_horizontal_caps(bitmap_argb32 &dest, int minx, int maxx, int midy, int width, int caps, rgb_t color)
19441944{
1945    // loop over the width of the segment
1946    for (int y = 0; y < width / 2; y++)
1947    {
1948        UINT32 *d0 = &dest.pix32(midy - y);
1949        UINT32 *d1 = &dest.pix32(midy + y);
1950        int ty = (y < width / 8) ? width / 8 : y;
1945   // loop over the width of the segment
1946   for (int y = 0; y < width / 2; y++)
1947   {
1948      UINT32 *d0 = &dest.pix32(midy - y);
1949      UINT32 *d1 = &dest.pix32(midy + y);
1950      int ty = (y < width / 8) ? width / 8 : y;
19511951
1952        // loop over the length of the segment
1953        for (int x = minx + ((caps & LINE_CAP_START) ? ty : 0); x < maxx - ((caps & LINE_CAP_END) ? ty : 0); x++)
1954            d0[x] = d1[x] = color;
1955    }
1952      // loop over the length of the segment
1953      for (int x = minx + ((caps & LINE_CAP_START) ? ty : 0); x < maxx - ((caps & LINE_CAP_END) ? ty : 0); x++)
1954         d0[x] = d1[x] = color;
1955   }
19561956}
19571957
19581958
r242301r242302
19631963
19641964void layout_element::component::draw_segment_horizontal(bitmap_argb32 &dest, int minx, int maxx, int midy, int width, rgb_t color)
19651965{
1966    draw_segment_horizontal_caps(dest, minx, maxx, midy, width, LINE_CAP_START | LINE_CAP_END, color);
1966   draw_segment_horizontal_caps(dest, minx, maxx, midy, width, LINE_CAP_START | LINE_CAP_END, color);
19671967}
19681968
19691969
r242301r242302
19751975
19761976void layout_element::component::draw_segment_vertical_caps(bitmap_argb32 &dest, int miny, int maxy, int midx, int width, int caps, rgb_t color)
19771977{
1978    // loop over the width of the segment
1979    for (int x = 0; x < width / 2; x++)
1980    {
1981        UINT32 *d0 = &dest.pix32(0, midx - x);
1982        UINT32 *d1 = &dest.pix32(0, midx + x);
1983        int tx = (x < width / 8) ? width / 8 : x;
1978   // loop over the width of the segment
1979   for (int x = 0; x < width / 2; x++)
1980   {
1981      UINT32 *d0 = &dest.pix32(0, midx - x);
1982      UINT32 *d1 = &dest.pix32(0, midx + x);
1983      int tx = (x < width / 8) ? width / 8 : x;
19841984
1985        // loop over the length of the segment
1986        for (int y = miny + ((caps & LINE_CAP_START) ? tx : 0); y < maxy - ((caps & LINE_CAP_END) ? tx : 0); y++)
1987            d0[y * dest.rowpixels()] = d1[y * dest.rowpixels()] = color;
1988    }
1985      // loop over the length of the segment
1986      for (int y = miny + ((caps & LINE_CAP_START) ? tx : 0); y < maxy - ((caps & LINE_CAP_END) ? tx : 0); y++)
1987         d0[y * dest.rowpixels()] = d1[y * dest.rowpixels()] = color;
1988   }
19891989}
19901990
19911991
r242301r242302
19961996
19971997void layout_element::component::draw_segment_vertical(bitmap_argb32 &dest, int miny, int maxy, int midx, int width, rgb_t color)
19981998{
1999    draw_segment_vertical_caps(dest, miny, maxy, midx, width, LINE_CAP_START | LINE_CAP_END, color);
1999   draw_segment_vertical_caps(dest, miny, maxy, midx, width, LINE_CAP_START | LINE_CAP_END, color);
20002000}
20012001
20022002
r242301r242302
20072007
20082008void layout_element::component::draw_segment_diagonal_1(bitmap_argb32 &dest, int minx, int maxx, int miny, int maxy, int width, rgb_t color)
20092009{
2010    // compute parameters
2011    width *= 1.5;
2012    float ratio = (maxy - miny - width) / (float)(maxx - minx);
2010   // compute parameters
2011   width *= 1.5;
2012   float ratio = (maxy - miny - width) / (float)(maxx - minx);
20132013
2014    // draw line
2015    for (int x = minx; x < maxx; x++)
2016        if (x >= 0 && x < dest.width())
2017        {
2018            UINT32 *d = &dest.pix32(0, x);
2019            int step = (x - minx) * ratio;
2014   // draw line
2015   for (int x = minx; x < maxx; x++)
2016      if (x >= 0 && x < dest.width())
2017      {
2018         UINT32 *d = &dest.pix32(0, x);
2019         int step = (x - minx) * ratio;
20202020
2021            for (int y = maxy - width - step; y < maxy - step; y++)
2022                if (y >= 0 && y < dest.height())
2023                    d[y * dest.rowpixels()] = color;
2024        }
2021         for (int y = maxy - width - step; y < maxy - step; y++)
2022            if (y >= 0 && y < dest.height())
2023               d[y * dest.rowpixels()] = color;
2024      }
20252025}
20262026
20272027
r242301r242302
20322032
20332033void layout_element::component::draw_segment_diagonal_2(bitmap_argb32 &dest, int minx, int maxx, int miny, int maxy, int width, rgb_t color)
20342034{
2035    // compute parameters
2036    width *= 1.5;
2037    float ratio = (maxy - miny - width) / (float)(maxx - minx);
2035   // compute parameters
2036   width *= 1.5;
2037   float ratio = (maxy - miny - width) / (float)(maxx - minx);
20382038
2039    // draw line
2040    for (int x = minx; x < maxx; x++)
2041        if (x >= 0 && x < dest.width())
2042        {
2043            UINT32 *d = &dest.pix32(0, x);
2044            int step = (x - minx) * ratio;
2039   // draw line
2040   for (int x = minx; x < maxx; x++)
2041      if (x >= 0 && x < dest.width())
2042      {
2043         UINT32 *d = &dest.pix32(0, x);
2044         int step = (x - minx) * ratio;
20452045
2046            for (int y = miny + step; y < miny + step + width; y++)
2047                if (y >= 0 && y < dest.height())
2048                    d[y * dest.rowpixels()] = color;
2049        }
2046         for (int y = miny + step; y < miny + step + width; y++)
2047            if (y >= 0 && y < dest.height())
2048               d[y * dest.rowpixels()] = color;
2049      }
20502050}
20512051
20522052
r242301r242302
20562056
20572057void layout_element::component::draw_segment_decimal(bitmap_argb32 &dest, int midx, int midy, int width, rgb_t color)
20582058{
2059    // compute parameters
2060    width /= 2;
2061    float ooradius2 = 1.0f / (float)(width * width);
2059   // compute parameters
2060   width /= 2;
2061   float ooradius2 = 1.0f / (float)(width * width);
20622062
2063    // iterate over y
2064    for (UINT32 y = 0; y <= width; y++)
2065    {
2066        UINT32 *d0 = &dest.pix32(midy - y);
2067        UINT32 *d1 = &dest.pix32(midy + y);
2068        float xval = width * sqrt(1.0f - (float)(y * y) * ooradius2);
2069        INT32 left, right;
2063   // iterate over y
2064   for (UINT32 y = 0; y <= width; y++)
2065   {
2066      UINT32 *d0 = &dest.pix32(midy - y);
2067      UINT32 *d1 = &dest.pix32(midy + y);
2068      float xval = width * sqrt(1.0f - (float)(y * y) * ooradius2);
2069      INT32 left, right;
20702070
2071        // compute left/right coordinates
2072        left = midx - (INT32)(xval + 0.5f);
2073        right = midx + (INT32)(xval + 0.5f);
2071      // compute left/right coordinates
2072      left = midx - (INT32)(xval + 0.5f);
2073      right = midx + (INT32)(xval + 0.5f);
20742074
2075        // draw this scanline
2076        for (UINT32 x = left; x < right; x++)
2077            d0[x] = d1[x] = color;
2078    }
2075      // draw this scanline
2076      for (UINT32 x = left; x < right; x++)
2077         d0[x] = d1[x] = color;
2078   }
20792079}
20802080
20812081
r242301r242302
20852085
20862086void layout_element::component::draw_segment_comma(bitmap_argb32 &dest, int minx, int maxx, int miny, int maxy, int width, rgb_t color)
20872087{
2088    // compute parameters
2089    width *= 1.5;
2090    float ratio = (maxy - miny - width) / (float)(maxx - minx);
2088   // compute parameters
2089   width *= 1.5;
2090   float ratio = (maxy - miny - width) / (float)(maxx - minx);
20912091
2092    // draw line
2093    for (int x = minx; x < maxx; x++)
2094    {
2095        UINT32 *d = &dest.pix32(0, x);
2096        int step = (x - minx) * ratio;
2092   // draw line
2093   for (int x = minx; x < maxx; x++)
2094   {
2095      UINT32 *d = &dest.pix32(0, x);
2096      int step = (x - minx) * ratio;
20972097
2098        for (int y = maxy; y < maxy  - width - step; y--)
2099            d[y * dest.rowpixels()] = color;
2100    }
2098      for (int y = maxy; y < maxy  - width - step; y--)
2099         d[y * dest.rowpixels()] = color;
2100   }
21012101}
21022102
21032103
r242301r242302
21072107
21082108void layout_element::component::apply_skew(bitmap_argb32 &dest, int skewwidth)
21092109{
2110    for (int y = 0; y < dest.height(); y++)
2111    {
2112        UINT32 *destrow = &dest.pix32(y);
2113        int offs = skewwidth * (dest.height() - y) / dest.height();
2114        for (int x = dest.width() - skewwidth - 1; x >= 0; x--)
2115            destrow[x + offs] = destrow[x];
2116        for (int x = 0; x < offs; x++)
2117            destrow[x] = 0;
2118    }
2110   for (int y = 0; y < dest.height(); y++)
2111   {
2112      UINT32 *destrow = &dest.pix32(y);
2113      int offs = skewwidth * (dest.height() - y) / dest.height();
2114      for (int x = dest.width() - skewwidth - 1; x >= 0; x--)
2115         destrow[x + offs] = destrow[x];
2116      for (int x = 0; x < offs; x++)
2117         destrow[x] = 0;
2118   }
21192119}
21202120
21212121
r242301r242302
21292129//-------------------------------------------------
21302130
21312131layout_view::layout_view(running_machine &machine, xml_data_node &viewnode, simple_list<layout_element> &elemlist)
2132    : m_next(NULL),
2133        m_aspect(1.0f),
2134        m_scraspect(1.0f)
2132   : m_next(NULL),
2133      m_aspect(1.0f),
2134      m_scraspect(1.0f)
21352135{
2136    // allocate a copy of the name
2137    m_name = xml_get_attribute_string_with_subst(machine, viewnode, "name", "");
2136   // allocate a copy of the name
2137   m_name = xml_get_attribute_string_with_subst(machine, viewnode, "name", "");
21382138
2139    // if we have a bounds item, load it
2140    xml_data_node *boundsnode = xml_get_sibling(viewnode.child, "bounds");
2141    m_expbounds.x0 = m_expbounds.y0 = m_expbounds.x1 = m_expbounds.y1 = 0;
2142    if (boundsnode != NULL)
2143        parse_bounds(machine, xml_get_sibling(boundsnode, "bounds"), m_expbounds);
2139   // if we have a bounds item, load it
2140   xml_data_node *boundsnode = xml_get_sibling(viewnode.child, "bounds");
2141   m_expbounds.x0 = m_expbounds.y0 = m_expbounds.x1 = m_expbounds.y1 = 0;
2142   if (boundsnode != NULL)
2143      parse_bounds(machine, xml_get_sibling(boundsnode, "bounds"), m_expbounds);
21442144
2145    // load backdrop items
2146    for (xml_data_node *itemnode = xml_get_sibling(viewnode.child, "backdrop"); itemnode != NULL; itemnode = xml_get_sibling(itemnode->next, "backdrop"))
2147        m_backdrop_list.append(*global_alloc(item(machine, *itemnode, elemlist)));
2145   // load backdrop items
2146   for (xml_data_node *itemnode = xml_get_sibling(viewnode.child, "backdrop"); itemnode != NULL; itemnode = xml_get_sibling(itemnode->next, "backdrop"))
2147      m_backdrop_list.append(*global_alloc(item(machine, *itemnode, elemlist)));
21482148
2149    // load screen items
2150    for (xml_data_node *itemnode = xml_get_sibling(viewnode.child, "screen"); itemnode != NULL; itemnode = xml_get_sibling(itemnode->next, "screen"))
2151        m_screen_list.append(*global_alloc(item(machine, *itemnode, elemlist)));
2149   // load screen items
2150   for (xml_data_node *itemnode = xml_get_sibling(viewnode.child, "screen"); itemnode != NULL; itemnode = xml_get_sibling(itemnode->next, "screen"))
2151      m_screen_list.append(*global_alloc(item(machine, *itemnode, elemlist)));
21522152
2153    // load overlay items
2154    for (xml_data_node *itemnode = xml_get_sibling(viewnode.child, "overlay"); itemnode != NULL; itemnode = xml_get_sibling(itemnode->next, "overlay"))
2155        m_overlay_list.append(*global_alloc(item(machine, *itemnode, elemlist)));
2153   // load overlay items
2154   for (xml_data_node *itemnode = xml_get_sibling(viewnode.child, "overlay"); itemnode != NULL; itemnode = xml_get_sibling(itemnode->next, "overlay"))
2155      m_overlay_list.append(*global_alloc(item(machine, *itemnode, elemlist)));
21562156
2157    // load bezel items
2158    for (xml_data_node *itemnode = xml_get_sibling(viewnode.child, "bezel"); itemnode != NULL; itemnode = xml_get_sibling(itemnode->next, "bezel"))
2159        m_bezel_list.append(*global_alloc(item(machine, *itemnode, elemlist)));
2157   // load bezel items
2158   for (xml_data_node *itemnode = xml_get_sibling(viewnode.child, "bezel"); itemnode != NULL; itemnode = xml_get_sibling(itemnode->next, "bezel"))
2159      m_bezel_list.append(*global_alloc(item(machine, *itemnode, elemlist)));
21602160
2161    // load cpanel items
2162    for (xml_data_node *itemnode = xml_get_sibling(viewnode.child, "cpanel"); itemnode != NULL; itemnode = xml_get_sibling(itemnode->next, "cpanel"))
2163        m_cpanel_list.append(*global_alloc(item(machine, *itemnode, elemlist)));
2161   // load cpanel items
2162   for (xml_data_node *itemnode = xml_get_sibling(viewnode.child, "cpanel"); itemnode != NULL; itemnode = xml_get_sibling(itemnode->next, "cpanel"))
2163      m_cpanel_list.append(*global_alloc(item(machine, *itemnode, elemlist)));
21642164
2165    // load marquee items
2166    for (xml_data_node *itemnode = xml_get_sibling(viewnode.child, "marquee"); itemnode != NULL; itemnode = xml_get_sibling(itemnode->next, "marquee"))
2167        m_marquee_list.append(*global_alloc(item(machine, *itemnode, elemlist)));
2165   // load marquee items
2166   for (xml_data_node *itemnode = xml_get_sibling(viewnode.child, "marquee"); itemnode != NULL; itemnode = xml_get_sibling(itemnode->next, "marquee"))
2167      m_marquee_list.append(*global_alloc(item(machine, *itemnode, elemlist)));
21682168
2169    // recompute the data for the view based on a default layer config
2170    recompute(render_layer_config());
2169   // recompute the data for the view based on a default layer config
2170   recompute(render_layer_config());
21712171}
21722172
21732173
r242301r242302
21872187
21882188layout_view::item *layout_view::first_item(item_layer layer) const
21892189{
2190    switch (layer)
2191    {
2192        case ITEM_LAYER_BACKDROP:   return m_backdrop_list.first();
2193        case ITEM_LAYER_SCREEN:     return m_screen_list.first();
2194        case ITEM_LAYER_OVERLAY:    return m_overlay_list.first();
2195        case ITEM_LAYER_BEZEL:      return m_bezel_list.first();
2196        case ITEM_LAYER_CPANEL:     return m_cpanel_list.first();
2197        case ITEM_LAYER_MARQUEE:    return m_marquee_list.first();
2198        default:                    return NULL;
2199    }
2190   switch (layer)
2191   {
2192      case ITEM_LAYER_BACKDROP:   return m_backdrop_list.first();
2193      case ITEM_LAYER_SCREEN:     return m_screen_list.first();
2194      case ITEM_LAYER_OVERLAY:    return m_overlay_list.first();
2195      case ITEM_LAYER_BEZEL:      return m_bezel_list.first();
2196      case ITEM_LAYER_CPANEL:     return m_cpanel_list.first();
2197      case ITEM_LAYER_MARQUEE:    return m_marquee_list.first();
2198      default:                    return NULL;
2199   }
22002200}
22012201
22022202
r242301r242302
22072207
22082208void layout_view::recompute(render_layer_config layerconfig)
22092209{
2210    // reset the bounds
2211    m_bounds.x0 = m_bounds.y0 = m_bounds.x1 = m_bounds.y1 = 0.0f;
2212    m_scrbounds.x0 = m_scrbounds.y0 = m_scrbounds.x1 = m_scrbounds.y1 = 0.0f;
2213    m_screens.reset();
2210   // reset the bounds
2211   m_bounds.x0 = m_bounds.y0 = m_bounds.x1 = m_bounds.y1 = 0.0f;
2212   m_scrbounds.x0 = m_scrbounds.y0 = m_scrbounds.x1 = m_scrbounds.y1 = 0.0f;
2213   m_screens.reset();
22142214
2215    // loop over all layers
2216    bool first = true;
2217    bool scrfirst = true;
2218    for (item_layer layer = ITEM_LAYER_FIRST; layer < ITEM_LAYER_MAX; layer++)
2219    {
2220        // determine if this layer should be visible
2221        switch (layer)
2222        {
2223            case ITEM_LAYER_BACKDROP:   m_layenabled[layer] = layerconfig.backdrops_enabled();  break;
2224            case ITEM_LAYER_OVERLAY:    m_layenabled[layer] = layerconfig.overlays_enabled();   break;
2225            case ITEM_LAYER_BEZEL:      m_layenabled[layer] = layerconfig.bezels_enabled();     break;
2226            case ITEM_LAYER_CPANEL:     m_layenabled[layer] = layerconfig.cpanels_enabled();    break;
2227            case ITEM_LAYER_MARQUEE:    m_layenabled[layer] = layerconfig.marquees_enabled();   break;
2228            default:                    m_layenabled[layer] = true;                             break;
2229        }
2215   // loop over all layers
2216   bool first = true;
2217   bool scrfirst = true;
2218   for (item_layer layer = ITEM_LAYER_FIRST; layer < ITEM_LAYER_MAX; layer++)
2219   {
2220      // determine if this layer should be visible
2221      switch (layer)
2222      {
2223         case ITEM_LAYER_BACKDROP:   m_layenabled[layer] = layerconfig.backdrops_enabled();  break;
2224         case ITEM_LAYER_OVERLAY:    m_layenabled[layer] = layerconfig.overlays_enabled();   break;
2225         case ITEM_LAYER_BEZEL:      m_layenabled[layer] = layerconfig.bezels_enabled();     break;
2226         case ITEM_LAYER_CPANEL:     m_layenabled[layer] = layerconfig.cpanels_enabled();    break;
2227         case ITEM_LAYER_MARQUEE:    m_layenabled[layer] = layerconfig.marquees_enabled();   break;
2228         default:                    m_layenabled[layer] = true;                             break;
2229      }
22302230
2231        // only do it if requested
2232        if (m_layenabled[layer])
2233            for (item *curitem = first_item(layer); curitem != NULL; curitem = curitem->next())
2234            {
2235                // accumulate bounds
2236                if (first)
2237                    m_bounds = curitem->m_rawbounds;
2238                else
2239                    union_render_bounds(&m_bounds, &curitem->m_rawbounds);
2240                first = false;
2231      // only do it if requested
2232      if (m_layenabled[layer])
2233         for (item *curitem = first_item(layer); curitem != NULL; curitem = curitem->next())
2234         {
2235            // accumulate bounds
2236            if (first)
2237               m_bounds = curitem->m_rawbounds;
2238            else
2239               union_render_bounds(&m_bounds, &curitem->m_rawbounds);
2240            first = false;
22412241
2242                // accumulate screen bounds
2243                if (curitem->m_screen != NULL)
2244                {
2245                    if (scrfirst)
2246                        m_scrbounds = curitem->m_rawbounds;
2247                    else
2248                        union_render_bounds(&m_scrbounds, &curitem->m_rawbounds);
2249                    scrfirst = false;
2242            // accumulate screen bounds
2243            if (curitem->m_screen != NULL)
2244            {
2245               if (scrfirst)
2246                  m_scrbounds = curitem->m_rawbounds;
2247               else
2248                  union_render_bounds(&m_scrbounds, &curitem->m_rawbounds);
2249               scrfirst = false;
22502250
2251                    // accumulate the screens in use while we're scanning
2252                    m_screens.add(*curitem->m_screen);
2253                }
2254            }
2255    }
2251               // accumulate the screens in use while we're scanning
2252               m_screens.add(*curitem->m_screen);
2253            }
2254         }
2255   }
22562256
2257    // if we have an explicit bounds, override it
2258    if (m_expbounds.x1 > m_expbounds.x0)
2259        m_bounds = m_expbounds;
2257   // if we have an explicit bounds, override it
2258   if (m_expbounds.x1 > m_expbounds.x0)
2259      m_bounds = m_expbounds;
22602260
2261    // if we're handling things normally, the target bounds are (0,0)-(1,1)
2262    render_bounds target_bounds;
2263    if (!layerconfig.zoom_to_screen() || m_screens.count() == 0)
2264    {
2265        // compute the aspect ratio of the view
2266        m_aspect = (m_bounds.x1 - m_bounds.x0) / (m_bounds.y1 - m_bounds.y0);
2261   // if we're handling things normally, the target bounds are (0,0)-(1,1)
2262   render_bounds target_bounds;
2263   if (!layerconfig.zoom_to_screen() || m_screens.count() == 0)
2264   {
2265      // compute the aspect ratio of the view
2266      m_aspect = (m_bounds.x1 - m_bounds.x0) / (m_bounds.y1 - m_bounds.y0);
22672267
2268        target_bounds.x0 = target_bounds.y0 = 0.0f;
2269        target_bounds.x1 = target_bounds.y1 = 1.0f;
2270    }
2268      target_bounds.x0 = target_bounds.y0 = 0.0f;
2269      target_bounds.x1 = target_bounds.y1 = 1.0f;
2270   }
22712271
2272    // if we're cropping, we want the screen area to fill (0,0)-(1,1)
2273    else
2274    {
2275        // compute the aspect ratio of the screen
2276        m_scraspect = (m_scrbounds.x1 - m_scrbounds.x0) / (m_scrbounds.y1 - m_scrbounds.y0);
2272   // if we're cropping, we want the screen area to fill (0,0)-(1,1)
2273   else
2274   {
2275      // compute the aspect ratio of the screen
2276      m_scraspect = (m_scrbounds.x1 - m_scrbounds.x0) / (m_scrbounds.y1 - m_scrbounds.y0);
22772277
2278        float targwidth = (m_bounds.x1 - m_bounds.x0) / (m_scrbounds.x1 - m_scrbounds.x0);
2279        float targheight = (m_bounds.y1 - m_bounds.y0) / (m_scrbounds.y1 - m_scrbounds.y0);
2280        target_bounds.x0 = (m_bounds.x0 - m_scrbounds.x0) / (m_bounds.x1 - m_bounds.x0) * targwidth;
2281        target_bounds.y0 = (m_bounds.y0 - m_scrbounds.y0) / (m_bounds.y1 - m_bounds.y0) * targheight;
2282        target_bounds.x1 = target_bounds.x0 + targwidth;
2283        target_bounds.y1 = target_bounds.y0 + targheight;
2284    }
2278      float targwidth = (m_bounds.x1 - m_bounds.x0) / (m_scrbounds.x1 - m_scrbounds.x0);
2279      float targheight = (m_bounds.y1 - m_bounds.y0) / (m_scrbounds.y1 - m_scrbounds.y0);
2280      target_bounds.x0 = (m_bounds.x0 - m_scrbounds.x0) / (m_bounds.x1 - m_bounds.x0) * targwidth;
2281      target_bounds.y0 = (m_bounds.y0 - m_scrbounds.y0) / (m_bounds.y1 - m_bounds.y0) * targheight;
2282      target_bounds.x1 = target_bounds.x0 + targwidth;
2283      target_bounds.y1 = target_bounds.y0 + targheight;
2284   }
22852285
2286    // determine the scale/offset for normalization
2287    float xoffs = m_bounds.x0;
2288    float yoffs = m_bounds.y0;
2289    float xscale = (target_bounds.x1 - target_bounds.x0) / (m_bounds.x1 - m_bounds.x0);
2290    float yscale = (target_bounds.y1 - target_bounds.y0) / (m_bounds.y1 - m_bounds.y0);
2286   // determine the scale/offset for normalization
2287   float xoffs = m_bounds.x0;
2288   float yoffs = m_bounds.y0;
2289   float xscale = (target_bounds.x1 - target_bounds.x0) / (m_bounds.x1 - m_bounds.x0);
2290   float yscale = (target_bounds.y1 - target_bounds.y0) / (m_bounds.y1 - m_bounds.y0);
22912291
2292    // normalize all the item bounds
2293    for (item_layer layer = ITEM_LAYER_FIRST; layer < ITEM_LAYER_MAX; layer++)
2294        for (item *curitem = first_item(layer); curitem != NULL; curitem = curitem->next())
2295        {
2296            curitem->m_bounds.x0 = target_bounds.x0 + (curitem->m_rawbounds.x0 - xoffs) * xscale;
2297            curitem->m_bounds.x1 = target_bounds.x0 + (curitem->m_rawbounds.x1 - xoffs) * xscale;
2298            curitem->m_bounds.y0 = target_bounds.y0 + (curitem->m_rawbounds.y0 - yoffs) * yscale;
2299            curitem->m_bounds.y1 = target_bounds.y0 + (curitem->m_rawbounds.y1 - yoffs) * yscale;
2300        }
2292   // normalize all the item bounds
2293   for (item_layer layer = ITEM_LAYER_FIRST; layer < ITEM_LAYER_MAX; layer++)
2294      for (item *curitem = first_item(layer); curitem != NULL; curitem = curitem->next())
2295      {
2296         curitem->m_bounds.x0 = target_bounds.x0 + (curitem->m_rawbounds.x0 - xoffs) * xscale;
2297         curitem->m_bounds.x1 = target_bounds.x0 + (curitem->m_rawbounds.x1 - xoffs) * xscale;
2298         curitem->m_bounds.y0 = target_bounds.y0 + (curitem->m_rawbounds.y0 - yoffs) * yscale;
2299         curitem->m_bounds.y1 = target_bounds.y0 + (curitem->m_rawbounds.y1 - yoffs) * yscale;
2300      }
23012301}
23022302
23032303
r242301r242302
23112311//-------------------------------------------------
23122312
23132313layout_view::item::item(running_machine &machine, xml_data_node &itemnode, simple_list<layout_element> &elemlist)
2314    : m_next(NULL),
2315        m_element(NULL),
2316        m_input_mask(0),
2317        m_screen(NULL),
2318        m_orientation(ROT0)
2314   : m_next(NULL),
2315      m_element(NULL),
2316      m_input_mask(0),
2317      m_screen(NULL),
2318      m_orientation(ROT0)
23192319{
2320    // allocate a copy of the output name
2321    m_output_name = xml_get_attribute_string_with_subst(machine, itemnode, "name", "");
2320   // allocate a copy of the output name
2321   m_output_name = xml_get_attribute_string_with_subst(machine, itemnode, "name", "");
23222322
2323    // allocate a copy of the input tag
2324    m_input_tag = xml_get_attribute_string_with_subst(machine, itemnode, "inputtag", "");
2323   // allocate a copy of the input tag
2324   m_input_tag = xml_get_attribute_string_with_subst(machine, itemnode, "inputtag", "");
23252325
2326    // find the associated element
2327    const char *name = xml_get_attribute_string_with_subst(machine, itemnode, "element", NULL);
2328    if (name != NULL)
2329    {
2330        // search the list of elements for a match
2331        for (m_element = elemlist.first(); m_element != NULL; m_element = m_element->next())
2332            if (strcmp(name, m_element->name()) == 0)
2333                break;
2326   // find the associated element
2327   const char *name = xml_get_attribute_string_with_subst(machine, itemnode, "element", NULL);
2328   if (name != NULL)
2329   {
2330      // search the list of elements for a match
2331      for (m_element = elemlist.first(); m_element != NULL; m_element = m_element->next())
2332         if (strcmp(name, m_element->name()) == 0)
2333            break;
23342334
2335        // error if not found
2336        if (m_element == NULL)
2337            throw emu_fatalerror("Unable to find layout element %s", name);
2338    }
2335      // error if not found
2336      if (m_element == NULL)
2337         throw emu_fatalerror("Unable to find layout element %s", name);
2338   }
23392339
2340    // fetch common data
2341    int index = xml_get_attribute_int_with_subst(machine, itemnode, "index", -1);
2342    if (index != -1)
2343    {
2344        screen_device_iterator iter(machine.root_device());
2345        m_screen = iter.byindex(index);
2346    }
2347    m_input_mask = xml_get_attribute_int_with_subst(machine, itemnode, "inputmask", 0);
2348    if (m_output_name[0] != 0 && m_element != NULL)
2349        output_set_value(m_output_name, m_element->default_state());
2350    parse_bounds(machine, xml_get_sibling(itemnode.child, "bounds"), m_rawbounds);
2351    parse_color(machine, xml_get_sibling(itemnode.child, "color"), m_color);
2352    parse_orientation(machine, xml_get_sibling(itemnode.child, "orientation"), m_orientation);
2340   // fetch common data
2341   int index = xml_get_attribute_int_with_subst(machine, itemnode, "index", -1);
2342   if (index != -1)
2343   {
2344      screen_device_iterator iter(machine.root_device());
2345      m_screen = iter.byindex(index);
2346   }
2347   m_input_mask = xml_get_attribute_int_with_subst(machine, itemnode, "inputmask", 0);
2348   if (m_output_name[0] != 0 && m_element != NULL)
2349      output_set_value(m_output_name, m_element->default_state());
2350   parse_bounds(machine, xml_get_sibling(itemnode.child, "bounds"), m_rawbounds);
2351   parse_color(machine, xml_get_sibling(itemnode.child, "color"), m_color);
2352   parse_orientation(machine, xml_get_sibling(itemnode.child, "orientation"), m_orientation);
23532353
2354    // sanity checks
2355    if (strcmp(itemnode.name, "screen") == 0)
2356    {
2357        if (m_screen == NULL)
2358            throw emu_fatalerror("Layout references invalid screen index %d", index);
2359    }
2360    else
2361    {
2362        if (m_element == NULL)
2363            throw emu_fatalerror("Layout item of type %s require an element tag", itemnode.name);
2364    }
2354   // sanity checks
2355   if (strcmp(itemnode.name, "screen") == 0)
2356   {
2357      if (m_screen == NULL)
2358         throw emu_fatalerror("Layout references invalid screen index %d", index);
2359   }
2360   else
2361   {
2362      if (m_element == NULL)
2363         throw emu_fatalerror("Layout item of type %s require an element tag", itemnode.name);
2364   }
23652365}
23662366
23672367
r242301r242302
23812381
23822382render_container *layout_view::item::screen_container(running_machine &machine) const
23832383{
2384    return (m_screen != NULL) ? &m_screen->container() : NULL;
2384   return (m_screen != NULL) ? &m_screen->container() : NULL;
23852385}
23862386
23872387//-------------------------------------------------
r242301r242302
23902390
23912391int layout_view::item::state() const
23922392{
2393    int state = 0;
2393   int state = 0;
23942394
2395    assert(m_element != NULL);
2395   assert(m_element != NULL);
23962396
2397    // if configured to an output, fetch the output value
2398    if (m_output_name[0] != 0)
2399        state = output_get_value(m_output_name);
2397   // if configured to an output, fetch the output value
2398   if (m_output_name[0] != 0)
2399      state = output_get_value(m_output_name);
24002400
2401    // if configured to an input, fetch the input value
2402    else if (m_input_tag[0] != 0)
2403    {
2404        ioport_port *port = m_element->machine().root_device().ioport(m_input_tag);
2405        if (port != NULL)
2406        {
2407            ioport_field *field = port->field(m_input_mask);
2408            if (field != NULL)
2409                state = ((port->read() ^ field->defvalue()) & m_input_mask) ? 1 : 0;
2410        }
2411    }
2412    return state;
2401   // if configured to an input, fetch the input value
2402   else if (m_input_tag[0] != 0)
2403   {
2404      ioport_port *port = m_element->machine().root_device().ioport(m_input_tag);
2405      if (port != NULL)
2406      {
2407         ioport_field *field = port->field(m_input_mask);
2408         if (field != NULL)
2409            state = ((port->read() ^ field->defvalue()) & m_input_mask) ? 1 : 0;
2410      }
2411   }
2412   return state;
24132413}
24142414
24152415
r242301r242302
24232423//-------------------------------------------------
24242424
24252425layout_file::layout_file(running_machine &machine, xml_data_node &rootnode, const char *dirname)
2426    : m_next(NULL)
2426   : m_next(NULL)
24272427{
2428    // find the layout node
2429    xml_data_node *mamelayoutnode = xml_get_sibling(rootnode.child, "mamelayout");
2430    if (mamelayoutnode == NULL)
2431        throw emu_fatalerror("Invalid XML file: missing mamelayout node");
2428   // find the layout node
2429   xml_data_node *mamelayoutnode = xml_get_sibling(rootnode.child, "mamelayout");
2430   if (mamelayoutnode == NULL)
2431      throw emu_fatalerror("Invalid XML file: missing mamelayout node");
24322432
2433    // validate the config data version
2434    int version = xml_get_attribute_int(mamelayoutnode, "version", 0);
2435    if (version != LAYOUT_VERSION)
2436        throw emu_fatalerror("Invalid XML file: unsupported version");
2433   // validate the config data version
2434   int version = xml_get_attribute_int(mamelayoutnode, "version", 0);
2435   if (version != LAYOUT_VERSION)
2436      throw emu_fatalerror("Invalid XML file: unsupported version");
24372437
2438    // parse all the elements
2439    for (xml_data_node *elemnode = xml_get_sibling(mamelayoutnode->child, "element"); elemnode != NULL; elemnode = xml_get_sibling(elemnode->next, "element"))
2440        m_elemlist.append(*global_alloc(layout_element(machine, *elemnode, dirname)));
2438   // parse all the elements
2439   for (xml_data_node *elemnode = xml_get_sibling(mamelayoutnode->child, "element"); elemnode != NULL; elemnode = xml_get_sibling(elemnode->next, "element"))
2440      m_elemlist.append(*global_alloc(layout_element(machine, *elemnode, dirname)));
24412441
2442    // parse all the views
2443    for (xml_data_node *viewnode = xml_get_sibling(mamelayoutnode->child, "view"); viewnode != NULL; viewnode = xml_get_sibling(viewnode->next, "view"))
2444        m_viewlist.append(*global_alloc(layout_view(machine, *viewnode, m_elemlist)));
2442   // parse all the views
2443   for (xml_data_node *viewnode = xml_get_sibling(mamelayoutnode->child, "view"); viewnode != NULL; viewnode = xml_get_sibling(viewnode->next, "view"))
2444      m_viewlist.append(*global_alloc(layout_view(machine, *viewnode, m_elemlist)));
24452445}
24462446
24472447
trunk/src/emu/rendlay.h
r242301r242302
2020
2121enum item_layer
2222{
23    ITEM_LAYER_FIRST = 0,
24    ITEM_LAYER_BACKDROP = ITEM_LAYER_FIRST,
25    ITEM_LAYER_SCREEN,
26    ITEM_LAYER_OVERLAY,
27    ITEM_LAYER_BEZEL,
28    ITEM_LAYER_CPANEL,
29    ITEM_LAYER_MARQUEE,
30    ITEM_LAYER_MAX
23   ITEM_LAYER_FIRST = 0,
24   ITEM_LAYER_BACKDROP = ITEM_LAYER_FIRST,
25   ITEM_LAYER_SCREEN,
26   ITEM_LAYER_OVERLAY,
27   ITEM_LAYER_BEZEL,
28   ITEM_LAYER_CPANEL,
29   ITEM_LAYER_MARQUEE,
30   ITEM_LAYER_MAX
3131};
3232DECLARE_ENUM_OPERATORS(item_layer);
3333
r242301r242302
4343// a layout_element is a single named element, which may have multiple components
4444class layout_element
4545{
46    friend class simple_list<layout_element>;
46   friend class simple_list<layout_element>;
4747
4848public:
49    // construction/destruction
50    layout_element(running_machine &machine, xml_data_node &elemnode, const char *dirname);
51    virtual ~layout_element();
49   // construction/destruction
50   layout_element(running_machine &machine, xml_data_node &elemnode, const char *dirname);
51   virtual ~layout_element();
5252
53    // getters
54    layout_element *next() const { return m_next; }
55    const char *name() const { return m_name; }
56    running_machine &machine() const { return m_machine; }
57    int default_state() const { return m_defstate; }
58    int maxstate() const { return m_maxstate; }
59    render_texture *state_texture(int state);
53   // getters
54   layout_element *next() const { return m_next; }
55   const char *name() const { return m_name; }
56   running_machine &machine() const { return m_machine; }
57   int default_state() const { return m_defstate; }
58   int maxstate() const { return m_maxstate; }
59   render_texture *state_texture(int state);
6060
6161private:
62    // a component represents an image, rectangle, or disk in an element
63    class component
64    {
65        friend class layout_element;
66        friend class simple_list<component>;
62   // a component represents an image, rectangle, or disk in an element
63   class component
64   {
65      friend class layout_element;
66      friend class simple_list<component>;
6767
68    public:
69        // construction/destruction
70        component(running_machine &machine, xml_data_node &compnode, const char *dirname);
71        ~component();
68   public:
69      // construction/destruction
70      component(running_machine &machine, xml_data_node &compnode, const char *dirname);
71      ~component();
7272
73        // getters
74        component *next() const { return m_next; }
75        const render_bounds &bounds() const { return m_bounds; }
73      // getters
74      component *next() const { return m_next; }
75      const render_bounds &bounds() const { return m_bounds; }
7676
77        // operations
78        void draw(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state);
77      // operations
78      void draw(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state);
7979
80    private:
81        // component types
82        enum component_type
83        {
84            CTYPE_INVALID = 0,
85            CTYPE_IMAGE,
86            CTYPE_RECT,
87            CTYPE_DISK,
88            CTYPE_TEXT,
89            CTYPE_LED7SEG,
90            CTYPE_LED8SEG_GTS1,
91            CTYPE_LED14SEG,
92            CTYPE_LED16SEG,
93            CTYPE_LED14SEGSC,
94            CTYPE_LED16SEGSC,
95            CTYPE_DOTMATRIX,
96            CTYPE_DOTMATRIX5DOT,
97            CTYPE_DOTMATRIXDOT,
98            CTYPE_SIMPLECOUNTER,
99            CTYPE_REEL,
100            CTYPE_MAX
101        };
80   private:
81      // component types
82      enum component_type
83      {
84         CTYPE_INVALID = 0,
85         CTYPE_IMAGE,
86         CTYPE_RECT,
87         CTYPE_DISK,
88         CTYPE_TEXT,
89         CTYPE_LED7SEG,
90         CTYPE_LED8SEG,
91         CTYPE_LED14SEG,
92         CTYPE_LED16SEG,
93         CTYPE_LED14SEGSC,
94         CTYPE_LED16SEGSC,
95         CTYPE_DOTMATRIX,
96         CTYPE_DOTMATRIX5DOT,
97         CTYPE_DOTMATRIXDOT,
98         CTYPE_SIMPLECOUNTER,
99         CTYPE_REEL,
100         CTYPE_MAX
101      };
102102
103        // helpers
104        void draw_rect(bitmap_argb32 &dest, const rectangle &bounds);
105        void draw_disk(bitmap_argb32 &dest, const rectangle &bounds);
106        void draw_text(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds);
107        void draw_simplecounter(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state);
108        void draw_reel(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state);
109        void draw_beltreel(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state);
110        void load_bitmap();
111        void load_reel_bitmap(int number);
112        void draw_led7seg(bitmap_argb32 &dest, const rectangle &bounds, int pattern);
113        void draw_led8seg_gts1(bitmap_argb32 &dest, const rectangle &bounds, int pattern);
114        void draw_led14seg(bitmap_argb32 &dest, const rectangle &bounds, int pattern);
115        void draw_led14segsc(bitmap_argb32 &dest, const rectangle &bounds, int pattern);
116        void draw_led16seg(bitmap_argb32 &dest, const rectangle &bounds, int pattern);
117        void draw_led16segsc(bitmap_argb32 &dest, const rectangle &bounds, int pattern);
118        void draw_dotmatrix(int dots,bitmap_argb32 &dest, const rectangle &bounds, int pattern);
119        void draw_segment_horizontal_caps(bitmap_argb32 &dest, int minx, int maxx, int midy, int width, int caps, rgb_t color);
120        void draw_segment_horizontal(bitmap_argb32 &dest, int minx, int maxx, int midy, int width, rgb_t color);
121        void draw_segment_vertical_caps(bitmap_argb32 &dest, int miny, int maxy, int midx, int width, int caps, rgb_t color);
122        void draw_segment_vertical(bitmap_argb32 &dest, int miny, int maxy, int midx, int width, rgb_t color);
123        void draw_segment_diagonal_1(bitmap_argb32 &dest, int minx, int maxx, int miny, int maxy, int width, rgb_t color);
124        void draw_segment_diagonal_2(bitmap_argb32 &dest, int minx, int maxx, int miny, int maxy, int width, rgb_t color);
125        void draw_segment_decimal(bitmap_argb32 &dest, int midx, int midy, int width, rgb_t color);
126        void draw_segment_comma(bitmap_argb32 &dest, int minx, int maxx, int miny, int maxy, int width, rgb_t color);
127        void apply_skew(bitmap_argb32 &dest, int skewwidth);
103      // helpers
104      void draw_rect(bitmap_argb32 &dest, const rectangle &bounds);
105      void draw_disk(bitmap_argb32 &dest, const rectangle &bounds);
106      void draw_text(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds);
107      void draw_simplecounter(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state);
108      void draw_reel(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state);
109      void draw_beltreel(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state);
110      void load_bitmap();
111      void load_reel_bitmap(int number);
112      void draw_led7seg(bitmap_argb32 &dest, const rectangle &bounds, int pattern);
113      void draw_led8seg(bitmap_argb32 &dest, const rectangle &bounds, int pattern);
114      void draw_led14seg(bitmap_argb32 &dest, const rectangle &bounds, int pattern);
115      void draw_led14segsc(bitmap_argb32 &dest, const rectangle &bounds, int pattern);
116      void draw_led16seg(bitmap_argb32 &dest, const rectangle &bounds, int pattern);
117      void draw_led16segsc(bitmap_argb32 &dest, const rectangle &bounds, int pattern);
118      void draw_dotmatrix(int dots,bitmap_argb32 &dest, const rectangle &bounds, int pattern);
119      void draw_segment_horizontal_caps(bitmap_argb32 &dest, int minx, int maxx, int midy, int width, int caps, rgb_t color);
120      void draw_segment_horizontal(bitmap_argb32 &dest, int minx, int maxx, int midy, int width, rgb_t color);
121      void draw_segment_vertical_caps(bitmap_argb32 &dest, int miny, int maxy, int midx, int width, int caps, rgb_t color);
122      void draw_segment_vertical(bitmap_argb32 &dest, int miny, int maxy, int midx, int width, rgb_t color);
123      void draw_segment_diagonal_1(bitmap_argb32 &dest, int minx, int maxx, int miny, int maxy, int width, rgb_t color);
124      void draw_segment_diagonal_2(bitmap_argb32 &dest, int minx, int maxx, int miny, int maxy, int width, rgb_t color);
125      void draw_segment_decimal(bitmap_argb32 &dest, int midx, int midy, int width, rgb_t color);
126      void draw_segment_comma(bitmap_argb32 &dest, int minx, int maxx, int miny, int maxy, int width, rgb_t color);
127      void apply_skew(bitmap_argb32 &dest, int skewwidth);
128128
129        #define MAX_BITMAPS 32
129      #define MAX_BITMAPS 32
130130
131        // internal state
132        component *         m_next;                     // link to next component
133        component_type      m_type;                     // type of component
134        int                 m_state;                    // state where this component is visible (-1 means all states)
135        render_bounds       m_bounds;                   // bounds of the element
136        render_color        m_color;                    // color of the element
137        astring             m_string;                   // string for text components
138        int                 m_digits;                   // number of digits for simple counters
139        int                 m_textalign;                // text alignment to box
140        bitmap_argb32       m_bitmap[MAX_BITMAPS];      // source bitmap for images
141        astring             m_dirname;                  // directory name of image file (for lazy loading)
142        auto_pointer<emu_file> m_file[MAX_BITMAPS];        // file object for reading image/alpha files
143        astring             m_imagefile[MAX_BITMAPS];   // name of the image file (for lazy loading)
144        astring             m_alphafile[MAX_BITMAPS];   // name of the alpha file (for lazy loading)
145        bool                m_hasalpha[MAX_BITMAPS];    // is there any alpha component present?
131      // internal state
132      component *         m_next;                     // link to next component
133      component_type      m_type;                     // type of component
134      int                 m_state;                    // state where this component is visible (-1 means all states)
135      render_bounds       m_bounds;                   // bounds of the element
136      render_color        m_color;                    // color of the element
137      astring             m_string;                   // string for text components
138      int                 m_digits;                   // number of digits for simple counters
139      int                 m_textalign;                // text alignment to box
140      bitmap_argb32       m_bitmap[MAX_BITMAPS];      // source bitmap for images
141      astring             m_dirname;                  // directory name of image file (for lazy loading)
142      auto_pointer<emu_file> m_file[MAX_BITMAPS];        // file object for reading image/alpha files
143      astring             m_imagefile[MAX_BITMAPS];   // name of the image file (for lazy loading)
144      astring             m_alphafile[MAX_BITMAPS];   // name of the alpha file (for lazy loading)
145      bool                m_hasalpha[MAX_BITMAPS];    // is there any alpha component present?
146146
147        // stuff for fruit machine reels
148        // basically made up of multiple text strings / gfx
149        int                 m_numstops;
150        astring             m_stopnames[MAX_BITMAPS];
151        int                 m_stateoffset;
152        int                 m_reelreversed;
153        int                 m_numsymbolsvisible;
154        int                 m_beltreel;
155    };
147      // stuff for fruit machine reels
148      // basically made up of multiple text strings / gfx
149      int                 m_numstops;
150      astring             m_stopnames[MAX_BITMAPS];
151      int                 m_stateoffset;
152      int                 m_reelreversed;
153      int                 m_numsymbolsvisible;
154      int                 m_beltreel;
155   };
156156
157    // a texture encapsulates a texture for a given element in a given state
158    class texture
159    {
160    public:
161        texture();
162        ~texture();
157   // a texture encapsulates a texture for a given element in a given state
158   class texture
159   {
160   public:
161      texture();
162      ~texture();
163163
164        layout_element *    m_element;      // pointer back to the element
165        render_texture *    m_texture;      // texture for this state
166        int                 m_state;        // associated state number
167    };
164      layout_element *    m_element;      // pointer back to the element
165      render_texture *    m_texture;      // texture for this state
166      int                 m_state;        // associated state number
167   };
168168
169    // internal helpers
170    static void element_scale(bitmap_argb32 &dest, bitmap_argb32 &source, const rectangle &sbounds, void *param);
169   // internal helpers
170   static void element_scale(bitmap_argb32 &dest, bitmap_argb32 &source, const rectangle &sbounds, void *param);
171171
172    // internal state
173    layout_element *    m_next;             // link to next element
174    running_machine &   m_machine;          // reference to the owning machine
175    astring             m_name;             // name of this element
176    simple_list<component> m_complist;      // list of components
177    int                 m_defstate;         // default state of this element
178    int                 m_maxstate;         // maximum state value for all components
179    dynamic_array<texture> m_elemtex;       // array of element textures used for managing the scaled bitmaps
172   // internal state
173   layout_element *    m_next;             // link to next element
174   running_machine &   m_machine;          // reference to the owning machine
175   astring             m_name;             // name of this element
176   simple_list<component> m_complist;      // list of components
177   int                 m_defstate;         // default state of this element
178   int                 m_maxstate;         // maximum state value for all components
179   dynamic_array<texture> m_elemtex;       // array of element textures used for managing the scaled bitmaps
180180};
181181
182182
r242301r242302
185185// a layout_view encapsulates a named list of items
186186class layout_view
187187{
188    friend class simple_list<layout_view>;
188   friend class simple_list<layout_view>;
189189
190190public:
191    // an item is a single backdrop, screen, overlay, bezel, cpanel, or marquee item
192    class item
193    {
194        friend class layout_view;
195        friend class simple_list<item>;
191   // an item is a single backdrop, screen, overlay, bezel, cpanel, or marquee item
192   class item
193   {
194      friend class layout_view;
195      friend class simple_list<item>;
196196
197    public:
198        // construction/destruction
199        item(running_machine &machine, xml_data_node &itemnode, simple_list<layout_element> &elemlist);
200        virtual ~item();
197   public:
198      // construction/destruction
199      item(running_machine &machine, xml_data_node &itemnode, simple_list<layout_element> &elemlist);
200      virtual ~item();
201201
202        // getters
203        item *next() const { return m_next; }
204        layout_element *element() const { return m_element; }
205        screen_device *screen() { return m_screen; }
206        const render_bounds &bounds() const { return m_bounds; }
207        const render_color &color() const { return m_color; }
208        int orientation() const { return m_orientation; }
209        render_container *screen_container(running_machine &machine) const;
210        bool has_input() const { return bool(m_input_tag); }
211        const char *input_tag_and_mask(ioport_value &mask) const { mask = m_input_mask; return m_input_tag; }
202      // getters
203      item *next() const { return m_next; }
204      layout_element *element() const { return m_element; }
205      screen_device *screen() { return m_screen; }
206      const render_bounds &bounds() const { return m_bounds; }
207      const render_color &color() const { return m_color; }
208      int orientation() const { return m_orientation; }
209      render_container *screen_container(running_machine &machine) const;
210      bool has_input() const { return bool(m_input_tag); }
211      const char *input_tag_and_mask(ioport_value &mask) const { mask = m_input_mask; return m_input_tag; }
212212
213        // fetch state based on configured source
214        int state() const;
213      // fetch state based on configured source
214      int state() const;
215215
216    private:
217        // internal state
218        item *              m_next;             // link to next item
219        layout_element *    m_element;          // pointer to the associated element (non-screens only)
220        astring             m_output_name;      // name of this item
221        astring             m_input_tag;        // input tag of this item
222        ioport_value        m_input_mask;       // input mask of this item
223        screen_device *     m_screen;           // pointer to screen
224        int                 m_orientation;      // orientation of this item
225        render_bounds       m_bounds;           // bounds of the item
226        render_bounds       m_rawbounds;        // raw (original) bounds of the item
227        render_color        m_color;            // color of the item
228    };
216   private:
217      // internal state
218      item *              m_next;             // link to next item
219      layout_element *    m_element;          // pointer to the associated element (non-screens only)
220      astring             m_output_name;      // name of this item
221      astring             m_input_tag;        // input tag of this item
222      ioport_value        m_input_mask;       // input mask of this item
223      screen_device *     m_screen;           // pointer to screen
224      int                 m_orientation;      // orientation of this item
225      render_bounds       m_bounds;           // bounds of the item
226      render_bounds       m_rawbounds;        // raw (original) bounds of the item
227      render_color        m_color;            // color of the item
228   };
229229
230    // construction/destruction
231    layout_view(running_machine &machine, xml_data_node &viewnode, simple_list<layout_element> &elemlist);
232    virtual ~layout_view();
230   // construction/destruction
231   layout_view(running_machine &machine, xml_data_node &viewnode, simple_list<layout_element> &elemlist);
232   virtual ~layout_view();
233233
234    // getters
235    layout_view *next() const { return m_next; }
236    item *first_item(item_layer layer) const;
237    const char *name() const { return m_name; }
238    const render_screen_list &screens() const { return m_screens; }
239    bool layer_enabled(item_layer layer) const { return m_layenabled[layer]; }
234   // getters
235   layout_view *next() const { return m_next; }
236   item *first_item(item_layer layer) const;
237   const char *name() const { return m_name; }
238   const render_screen_list &screens() const { return m_screens; }
239   bool layer_enabled(item_layer layer) const { return m_layenabled[layer]; }
240240
241    //
242    bool has_art() const { return (m_backdrop_list.count() + m_overlay_list.count() + m_bezel_list.count() + m_cpanel_list.count() + m_marquee_list.count() != 0); }
243    float effective_aspect(render_layer_config config) const { return (config.zoom_to_screen() && m_screens.count() != 0) ? m_scraspect : m_aspect; }
241   //
242   bool has_art() const { return (m_backdrop_list.count() + m_overlay_list.count() + m_bezel_list.count() + m_cpanel_list.count() + m_marquee_list.count() != 0); }
243   float effective_aspect(render_layer_config config) const { return (config.zoom_to_screen() && m_screens.count() != 0) ? m_scraspect : m_aspect; }
244244
245    // operations
246    void recompute(render_layer_config layerconfig);
245   // operations
246   void recompute(render_layer_config layerconfig);
247247
248248private:
249    // internal state
250    layout_view *       m_next;             // pointer to next layout in the list
251    astring             m_name;             // name of the layout
252    float               m_aspect;           // X/Y of the layout
253    float               m_scraspect;        // X/Y of the screen areas
254    render_screen_list  m_screens;          // list of active screens
255    render_bounds       m_bounds;           // computed bounds of the view
256    render_bounds       m_scrbounds;        // computed bounds of the screens within the view
257    render_bounds       m_expbounds;        // explicit bounds of the view
258    bool                m_layenabled[ITEM_LAYER_MAX]; // is this layer enabled?
259    simple_list<item>   m_backdrop_list;    // list of backdrop items
260    simple_list<item>   m_screen_list;      // list of screen items
261    simple_list<item>   m_overlay_list;     // list of overlay items
262    simple_list<item>   m_bezel_list;       // list of bezel items
263    simple_list<item>   m_cpanel_list;      // list of marquee items
264    simple_list<item>   m_marquee_list;     // list of marquee items
249   // internal state
250   layout_view *       m_next;             // pointer to next layout in the list
251   astring             m_name;             // name of the layout
252   float               m_aspect;           // X/Y of the layout
253   float               m_scraspect;        // X/Y of the screen areas
254   render_screen_list  m_screens;          // list of active screens
255   render_bounds       m_bounds;           // computed bounds of the view
256   render_bounds       m_scrbounds;        // computed bounds of the screens within the view
257   render_bounds       m_expbounds;        // explicit bounds of the view
258   bool                m_layenabled[ITEM_LAYER_MAX]; // is this layer enabled?
259   simple_list<item>   m_backdrop_list;    // list of backdrop items
260   simple_list<item>   m_screen_list;      // list of screen items
261   simple_list<item>   m_overlay_list;     // list of overlay items
262   simple_list<item>   m_bezel_list;       // list of bezel items
263   simple_list<item>   m_cpanel_list;      // list of marquee items
264   simple_list<item>   m_marquee_list;     // list of marquee items
265265};
266266
267267
r242301r242302
270270// a layout_file consists of a list of elements and a list of views
271271class layout_file
272272{
273    friend class simple_list<layout_file>;
273   friend class simple_list<layout_file>;
274274
275275public:
276    // construction/destruction
277    layout_file(running_machine &machine, xml_data_node &rootnode, const char *dirname);
278    virtual ~layout_file();
276   // construction/destruction
277   layout_file(running_machine &machine, xml_data_node &rootnode, const char *dirname);
278   virtual ~layout_file();
279279
280    // getters
281    layout_file *next() const { return m_next; }
282    layout_element *first_element() const { return m_elemlist.first(); }
283    layout_view *first_view() const { return m_viewlist.first(); }
280   // getters
281   layout_file *next() const { return m_next; }
282   layout_element *first_element() const { return m_elemlist.first(); }
283   layout_view *first_view() const { return m_viewlist.first(); }
284284
285285private:
286    // internal state
287    layout_file *       m_next;             // pointer to the next file in the list
288    simple_list<layout_element> m_elemlist; // list of shared layout elements
289    simple_list<layout_view> m_viewlist;    // list of views
286   // internal state
287   layout_file *       m_next;             // pointer to the next file in the list
288   simple_list<layout_element> m_elemlist; // list of shared layout elements
289   simple_list<layout_view> m_viewlist;    // list of views
290290};
291291
292292
trunk/src/emu/video/gf6800gt.c
r0r242302
1#include "gf6800gt.h"
2
3const device_type GEFORCE_6800GT = &device_creator<geforce_6800gt_device>;
4
5DEVICE_ADDRESS_MAP_START(map1, 32, geforce_6800gt_device)
6ADDRESS_MAP_END
7
8DEVICE_ADDRESS_MAP_START(map2, 32, geforce_6800gt_device)
9ADDRESS_MAP_END
10
11DEVICE_ADDRESS_MAP_START(map3, 32, geforce_6800gt_device)
12ADDRESS_MAP_END
13
14geforce_6800gt_device::geforce_6800gt_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
15   : pci_device(mconfig, GEFORCE_6800GT, "NVidia GeForce 6800GT", tag, owner, clock, "geforce_6800gt", __FILE__)
16{
17}
18
19void geforce_6800gt_device::device_start()
20{
21   pci_device::device_start();
22   add_map( 16*1024*1024, M_MEM, FUNC(geforce_6800gt_device::map1));
23   add_map(256*1024*1024, M_MEM, FUNC(geforce_6800gt_device::map2));
24   add_map( 16*1024*1024, M_MEM, FUNC(geforce_6800gt_device::map3));
25}
26
27void geforce_6800gt_device::device_reset()
28{
29   pci_device::device_reset();
30}
trunk/src/emu/video/gf6800gt.h
r0r242302
1#ifndef GF6800GT_H
2#define GF6800GT_H
3
4#include "machine/pci.h"
5
6#define MCFG_GEFORCE_6800GT_ADD(_tag, _subdevice_id) \
7   MCFG_AGP_DEVICE_ADD(_tag, GEFORCE_6800GT, 0x10de00f9, 0xa1, _subdevice_id)
8
9class geforce_6800gt_device : public pci_device {
10public:
11   geforce_6800gt_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
12
13protected:
14   virtual void device_start();
15   virtual void device_reset();
16
17private:
18   DECLARE_ADDRESS_MAP(map1, 32);
19   DECLARE_ADDRESS_MAP(map2, 32);
20   DECLARE_ADDRESS_MAP(map3, 32);
21};
22
23extern const device_type GEFORCE_6800GT;
24
25#endif
trunk/src/emu/video/gf7600gs.c
r242301r242302
1#include "gf7600gs.h"
2
3const device_type GEFORCE_7600GS = &device_creator<geforce_7600gs_device>;
4
5DEVICE_ADDRESS_MAP_START(map1, 32, geforce_7600gs_device)
6ADDRESS_MAP_END
7
8DEVICE_ADDRESS_MAP_START(map2, 32, geforce_7600gs_device)
9ADDRESS_MAP_END
10
11DEVICE_ADDRESS_MAP_START(map3, 32, geforce_7600gs_device)
12ADDRESS_MAP_END
13
14geforce_7600gs_device::geforce_7600gs_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
15   : pci_device(mconfig, GEFORCE_7600GS, "NVidia GeForce 7600GS", tag, owner, clock, "geforce_7600gs", __FILE__)
16{
17}
18
19void geforce_7600gs_device::device_start()
20{
21   pci_device::device_start();
22   add_map( 16*1024*1024, M_MEM, FUNC(geforce_7600gs_device::map1));
23   add_map(256*1024*1024, M_MEM, FUNC(geforce_7600gs_device::map2));
24   add_map( 16*1024*1024, M_MEM, FUNC(geforce_7600gs_device::map3));
25   add_rom_from_region();
26}
27
28void geforce_7600gs_device::device_reset()
29{
30   pci_device::device_reset();
31}
trunk/src/emu/video/gf7600gs.h
r242301r242302
1#ifndef GF7600GS_H
2#define GF7600GS_H
3
4#include "machine/pci.h"
5
6#define MCFG_GEFORCE_7600GS_ADD(_tag, _subdevice_id) \
7   MCFG_AGP_DEVICE_ADD(_tag, GEFORCE_7600GS, 0x10de02e1, 0xa1, _subdevice_id)
8
9class geforce_7600gs_device : public pci_device {
10public:
11   geforce_7600gs_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
12
13protected:
14   virtual void device_start();
15   virtual void device_reset();
16
17private:
18   DECLARE_ADDRESS_MAP(map1, 32);
19   DECLARE_ADDRESS_MAP(map2, 32);
20   DECLARE_ADDRESS_MAP(map3, 32);
21};
22
23extern const device_type GEFORCE_7600GS;
24
25#endif
trunk/src/emu/video/video.mak
r242301r242302
174174
175175#-------------------------------------------------
176176#
177#@src/emu/video/gf7600gs.h,VIDEOS += GF7600GS
177#@src/emu/video/gf6800gt.h,VIDEOS += GF6800GT
178178#-------------------------------------------------
179179
180ifneq ($(filter GF7600GS,$(VIDEOS)),)
181VIDEOOBJS+= $(VIDEOOBJ)/gf7600gs.o
180ifneq ($(filter GF6800GT,$(VIDEOS)),)
181VIDEOOBJS+= $(VIDEOOBJ)/gf6800gt.o
182182endif
183183
184184#-------------------------------------------------
trunk/src/lib/formats/victor9k_dsk.c
r242301r242302
210210   static floppy_image_format_t::desc_e desc[] = {
211211      /* 00 */ { SECTOR_INTERLEAVE_SKEW, 0, 0},
212212      /* 01 */ { SECTOR_LOOP_START, 0, -1 },
213      /* 02 */ {   SYNC_GCR5, 9 },
213      /* 02 */ {   SYNC_GCR5, 6 },
214214      /* 03 */ {   GCR5, 0x07, 1 },
215215      /* 04 */ {   CRC_VICTOR_HDR_START, 1 },
216216      /* 05 */ {     TRACK_ID_VICTOR_GCR5 },
r242301r242302
231231      /* 20 */ { END }
232232   };
233233
234   current_size = 90 + (1+1+1+1)*10 + 8*8 + 50 + (1+f.sector_base_size+2)*10 + 8*8;
234   current_size = 60 + (1+1+1+1)*10 + 8*8 + 50 + (1+f.sector_base_size+2)*10 + 8*8;
235235
236236   current_size *= sector_count;
237237   return desc;
trunk/src/mame/drivers/dooyong.c
r242301r242302
11671167
11681168ROM_START( lastday )
11691169   ROM_REGION( 0x30000, "maincpu", 0 ) /* 64k for code + 128k for banks */
1170   ROM_LOAD( "lday3.s5",     0x00000, 0x10000, CRC(a06dfb1e) SHA1(c6220eda8c01d55862700e369db7291dbbedc8c8) )
1170   ROM_LOAD( "lday3.bin",    0x00000, 0x10000, CRC(a06dfb1e) SHA1(c6220eda8c01d55862700e369db7291dbbedc8c8) )
11711171   ROM_RELOAD(               0x10000, 0x10000 )                /* banked at 0x8000-0xbfff */
1172   ROM_LOAD( "4.u5",         0x20000, 0x10000, CRC(70961ea6) SHA1(245d3da67abb4a511a024f030de461b9a2b4804e) )  /* banked at 0x8000-0xbfff */
1172   ROM_LOAD( "lday4.bin",    0x20000, 0x10000, CRC(70961ea6) SHA1(245d3da67abb4a511a024f030de461b9a2b4804e) )  /* banked at 0x8000-0xbfff */
11731173
11741174   ROM_REGION( 0x10000, "audiocpu", 0 )    /* sound */
1175   ROM_LOAD( "1.d3",    0x0000, 0x8000, CRC(dd4316fd) SHA1(496e6657bb76d91f488a2464d1af1be095ab9105) )    /* empty */
1176   ROM_CONTINUE(        0x0000, 0x8000 )
1175   ROM_LOAD( "lday1.bin",    0x0000, 0x8000, CRC(dd4316fd) SHA1(496e6657bb76d91f488a2464d1af1be095ab9105) )    /* empty */
1176   ROM_CONTINUE(             0x0000, 0x8000 )
11771177
11781178   ROM_REGION( 0x8000, "gfx1", 0 ) /* chars */
1179   ROM_LOAD( "2.j4",    0x0000, 0x8000, CRC(83eb572c) SHA1(e915afd55d505bce202206c9ecfa89bad561ef6c) )    /* empty */
1180   ROM_CONTINUE(        0x0000, 0x8000 )
1179   ROM_LOAD( "lday2.bin",    0x0000, 0x8000, CRC(83eb572c) SHA1(e915afd55d505bce202206c9ecfa89bad561ef6c) )    /* empty */
1180   ROM_CONTINUE(             0x0000, 0x8000 )
11811181
11821182   ROM_REGION( 0x40000, "gfx2", 0 )    /* sprites */
1183   ROM_LOAD16_BYTE( "16.d14",   0x00000, 0x20000, CRC(df503504) SHA1(daa58a7bc24415b5f59b7c7cc918bc85de9702a3) )
1184   ROM_LOAD16_BYTE( "15.a14",   0x00001, 0x20000, CRC(cd990442) SHA1(891b2163db23ab0bb40cbadce6e06fc067d0532f) )
1183   ROM_LOAD16_BYTE( "lday16.bin",   0x00000, 0x20000, CRC(df503504) SHA1(daa58a7bc24415b5f59b7c7cc918bc85de9702a3) )
1184   ROM_LOAD16_BYTE( "lday15.bin",   0x00001, 0x20000, CRC(cd990442) SHA1(891b2163db23ab0bb40cbadce6e06fc067d0532f) )
11851185
11861186   ROM_REGION( 0x80000, "gfx3", 0 )    /* tiles */
1187   ROM_LOAD16_BYTE( "6.s9",     0x00000, 0x20000, CRC(1054361d) SHA1(52566786ca8177404be8b66fd7de94ac25fc49ea) )
1188   ROM_LOAD16_BYTE( "9.s11",    0x00001, 0x20000, CRC(6952ef4d) SHA1(b4e5ec02e97df213fe0bd4cd8a2ca77d7ecf8ad5) )
1189   ROM_LOAD16_BYTE( "7.u9",     0x40000, 0x20000, CRC(6e57a888) SHA1(8efe876ea3c788b83e8291f7fc6f55b90de158c8) )
1190   ROM_LOAD16_BYTE( "10.u11",   0x40001, 0x20000, CRC(a5548dca) SHA1(9914e01c1739c3bfd868a01e53c9030726ced4ea) )
1187   ROM_LOAD16_BYTE( "lday6.bin",    0x00000, 0x20000, CRC(1054361d) SHA1(52566786ca8177404be8b66fd7de94ac25fc49ea) )
1188   ROM_LOAD16_BYTE( "lday9.bin",    0x00001, 0x20000, CRC(6952ef4d) SHA1(b4e5ec02e97df213fe0bd4cd8a2ca77d7ecf8ad5) )
1189   ROM_LOAD16_BYTE( "lday7.bin",    0x40000, 0x20000, CRC(6e57a888) SHA1(8efe876ea3c788b83e8291f7fc6f55b90de158c8) )
1190   ROM_LOAD16_BYTE( "lday10.bin",   0x40001, 0x20000, CRC(a5548dca) SHA1(9914e01c1739c3bfd868a01e53c9030726ced4ea) )
11911191
11921192   ROM_REGION( 0x40000, "gfx4", 0 )    /* tiles */
1193   ROM_LOAD16_BYTE( "12.s13",   0x00000, 0x20000, CRC(992bc4af) SHA1(94570ebd1ee6acf1871cf914907acd12dca4026e) )
1194   ROM_LOAD16_BYTE( "14.s14",   0x00001, 0x20000, CRC(a79abc85) SHA1(3e63dad11db9b7420331403a1d551d8c041c4cc2) )
1193   ROM_LOAD16_BYTE( "lday12.bin",   0x00000, 0x20000, CRC(992bc4af) SHA1(94570ebd1ee6acf1871cf914907acd12dca4026e) )
1194   ROM_LOAD16_BYTE( "lday14.bin",   0x00001, 0x20000, CRC(a79abc85) SHA1(3e63dad11db9b7420331403a1d551d8c041c4cc2) )
11951195
11961196   ROM_REGION( 0x20000, "gfx5", 0 )    /* background tilemaps */
1197   ROM_LOAD16_BYTE( "5.r9",     0x00000, 0x10000, CRC(4789bae8) SHA1(6ffecc16eb8c9c783b02c4ef68cb5098b01fafef) )
1198   ROM_LOAD16_BYTE( "8.r11",    0x00001, 0x10000, CRC(92402b9a) SHA1(2ca8078d2687afbe7b6fc5412de16c6fbc11a650) )
1197   ROM_LOAD16_BYTE( "lday5.bin",    0x00000, 0x10000, CRC(4789bae8) SHA1(6ffecc16eb8c9c783b02c4ef68cb5098b01fafef) )
1198   ROM_LOAD16_BYTE( "lday8.bin",    0x00001, 0x10000, CRC(92402b9a) SHA1(2ca8078d2687afbe7b6fc5412de16c6fbc11a650) )
11991199
12001200   ROM_REGION( 0x20000, "gfx6", 0 )    /* fg tilemaps */
1201   ROM_LOAD16_BYTE( "11.r13",   0x00000, 0x10000, CRC(04b961de) SHA1(7a94c9d0800d79048660cf3758708a346ead33f9) )
1202   ROM_LOAD16_BYTE( "13.r14",   0x00001, 0x10000, CRC(6bdbd887) SHA1(a54f26f9ddd72b8b8f7a030610c1c4a5f94a3358) )ROM_END
1201   ROM_LOAD16_BYTE( "lday11.bin",   0x00000, 0x10000, CRC(04b961de) SHA1(7a94c9d0800d79048660cf3758708a346ead33f9) )
1202   ROM_LOAD16_BYTE( "lday13.bin",   0x00001, 0x10000, CRC(6bdbd887) SHA1(a54f26f9ddd72b8b8f7a030610c1c4a5f94a3358) )
1203ROM_END
12031204
12041205ROM_START( lastdaya )
12051206   ROM_REGION( 0x30000, "maincpu", 0 ) /* 64k for code + 128k for banks */
1206   ROM_LOAD( "lday3.s5",     0x00000, 0x10000, CRC(a06dfb1e) SHA1(c6220eda8c01d55862700e369db7291dbbedc8c8) )
1207   ROM_LOAD( "lday3.bin",    0x00000, 0x10000, CRC(a06dfb1e) SHA1(c6220eda8c01d55862700e369db7291dbbedc8c8) )
12071208   ROM_RELOAD(               0x10000, 0x10000 )                /* banked at 0x8000-0xbfff */
1208   ROM_LOAD( "4.u5",         0x20000, 0x10000, CRC(70961ea6) SHA1(245d3da67abb4a511a024f030de461b9a2b4804e) )  /* banked at 0x8000-0xbfff */
1209   ROM_LOAD( "lday4.bin",    0x20000, 0x10000, CRC(70961ea6) SHA1(245d3da67abb4a511a024f030de461b9a2b4804e) )  /* banked at 0x8000-0xbfff */
12091210
12101211   ROM_REGION( 0x10000, "audiocpu", 0 )    /* sound */
1211   ROM_LOAD( "e1.d3",        0x0000, 0x8000, CRC(ce96e106) SHA1(5ef1f221618abd757e02db79c3d7016100f30c07) )    /* empty */
1212   ROM_LOAD( "e1",           0x0000, 0x8000, CRC(ce96e106) SHA1(5ef1f221618abd757e02db79c3d7016100f30c07) )    /* empty */
12121213   ROM_CONTINUE(             0x0000, 0x8000 )
12131214
12141215   ROM_REGION( 0x8000, "gfx1", 0 ) /* chars */
1215   ROM_LOAD( "2.j4",    0x0000, 0x8000, CRC(83eb572c) SHA1(e915afd55d505bce202206c9ecfa89bad561ef6c) )    /* empty */
1216   ROM_CONTINUE(        0x0000, 0x8000 )
1216   ROM_LOAD( "lday2.bin",    0x0000, 0x8000, CRC(83eb572c) SHA1(e915afd55d505bce202206c9ecfa89bad561ef6c) )    /* empty */
1217   ROM_CONTINUE(             0x0000, 0x8000 )
12171218
12181219   ROM_REGION( 0x40000, "gfx2", 0 )    /* sprites */
1219   ROM_LOAD16_BYTE( "16.d14",   0x00000, 0x20000, CRC(df503504) SHA1(daa58a7bc24415b5f59b7c7cc918bc85de9702a3) )
1220   ROM_LOAD16_BYTE( "15.a14",   0x00001, 0x20000, CRC(cd990442) SHA1(891b2163db23ab0bb40cbadce6e06fc067d0532f) )
1220   ROM_LOAD16_BYTE( "lday16.bin",   0x00000, 0x20000, CRC(df503504) SHA1(daa58a7bc24415b5f59b7c7cc918bc85de9702a3) )
1221   ROM_LOAD16_BYTE( "lday15.bin",   0x00001, 0x20000, CRC(cd990442) SHA1(891b2163db23ab0bb40cbadce6e06fc067d0532f) )
12211222
12221223   ROM_REGION( 0x80000, "gfx3", 0 )    /* tiles */
1223   ROM_LOAD16_BYTE( "e6.s9",    0x00000, 0x20000, CRC(7623c443) SHA1(abfed648a8cc438dbb7de9c23a663082667ca366) )
1224   ROM_LOAD16_BYTE( "e9.s11",   0x00001, 0x20000, CRC(717f6a0e) SHA1(0b2d98fa5b8734210df18bce7725972fd42a6e4a) )
1225   ROM_LOAD16_BYTE( "7.u9",     0x40000, 0x20000, CRC(6e57a888) SHA1(8efe876ea3c788b83e8291f7fc6f55b90de158c8) )
1226   ROM_LOAD16_BYTE( "10.u11",   0x40001, 0x20000, CRC(a5548dca) SHA1(9914e01c1739c3bfd868a01e53c9030726ced4ea) )
1224   ROM_LOAD16_BYTE( "e6",           0x00000, 0x20000, CRC(7623c443) SHA1(abfed648a8cc438dbb7de9c23a663082667ca366) )
1225   ROM_LOAD16_BYTE( "e9",           0x00001, 0x20000, CRC(717f6a0e) SHA1(0b2d98fa5b8734210df18bce7725972fd42a6e4a) )
1226   ROM_LOAD16_BYTE( "lday7.bin",    0x40000, 0x20000, CRC(6e57a888) SHA1(8efe876ea3c788b83e8291f7fc6f55b90de158c8) )
1227   ROM_LOAD16_BYTE( "lday10.bin",   0x40001, 0x20000, CRC(a5548dca) SHA1(9914e01c1739c3bfd868a01e53c9030726ced4ea) )
12271228
12281229   ROM_REGION( 0x40000, "gfx4", 0 )    /* tiles */
1229   ROM_LOAD16_BYTE( "12.s13",   0x00000, 0x20000, CRC(992bc4af) SHA1(94570ebd1ee6acf1871cf914907acd12dca4026e) )
1230   ROM_LOAD16_BYTE( "14.s14",   0x00001, 0x20000, CRC(a79abc85) SHA1(3e63dad11db9b7420331403a1d551d8c041c4cc2) )
1230   ROM_LOAD16_BYTE( "lday12.bin",   0x00000, 0x20000, CRC(992bc4af) SHA1(94570ebd1ee6acf1871cf914907acd12dca4026e) )
1231   ROM_LOAD16_BYTE( "lday14.bin",   0x00001, 0x20000, CRC(a79abc85) SHA1(3e63dad11db9b7420331403a1d551d8c041c4cc2) )
12311232
12321233   ROM_REGION( 0x20000, "gfx5", 0 )    /* bg tilemaps */
1233   ROM_LOAD16_BYTE( "e5.r9",           0x00000, 0x10000, CRC(5f801410) SHA1(382c1bcd69a6a5c245d2ba7603bc273fba840c8f) )
1234   ROM_LOAD16_BYTE( "e8.r11",          0x00001, 0x10000, CRC(a7b8250b) SHA1(4bd79c09dacf69e1993353d7fcc7746d1324e9b0) )
1234   ROM_LOAD16_BYTE( "e5",           0x00000, 0x10000, CRC(5f801410) SHA1(382c1bcd69a6a5c245d2ba7603bc273fba840c8f) )
1235   ROM_LOAD16_BYTE( "e8",           0x00001, 0x10000, CRC(a7b8250b) SHA1(4bd79c09dacf69e1993353d7fcc7746d1324e9b0) )
12351236
12361237   ROM_REGION( 0x20000, "gfx6", 0 )    /* fg tilemaps */
1237   ROM_LOAD16_BYTE( "11.r13",   0x00000, 0x10000, CRC(04b961de) SHA1(7a94c9d0800d79048660cf3758708a346ead33f9) )
1238   ROM_LOAD16_BYTE( "13.r14",   0x00001, 0x10000, CRC(6bdbd887) SHA1(a54f26f9ddd72b8b8f7a030610c1c4a5f94a3358) )
1238   ROM_LOAD16_BYTE( "lday11.bin",   0x00000, 0x10000, CRC(04b961de) SHA1(7a94c9d0800d79048660cf3758708a346ead33f9) )
1239   ROM_LOAD16_BYTE( "lday13.bin",   0x00001, 0x10000, CRC(6bdbd887) SHA1(a54f26f9ddd72b8b8f7a030610c1c4a5f94a3358) )
12391240ROM_END
12401241
1241ROM_START( ddaydoo ) // closest to 'lastday' set
1242   ROM_REGION( 0x30000, "maincpu", 0 ) /* 64k for code + 128k for banks */
1243   ROM_LOAD( "3.s5",    0x00000, 0x10000, CRC(7817d4f3) SHA1(b85db234c04f248fd2927a2224380783780673f5))
1244   ROM_RELOAD(          0x10000, 0x10000 )                /* banked at 0x8000-0xbfff */
1245   ROM_LOAD( "4.u5",    0x20000, 0x10000, CRC(70961ea6) SHA1(245d3da67abb4a511a024f030de461b9a2b4804e) )  /* banked at 0x8000-0xbfff */
1246
1247   ROM_REGION( 0x10000, "audiocpu", 0 )    /* sound */
1248   ROM_LOAD( "1.d3",    0x0000, 0x8000, CRC(dd4316fd) SHA1(496e6657bb76d91f488a2464d1af1be095ab9105) )    /* empty */
1249   ROM_CONTINUE(        0x0000, 0x8000 )
1250
1251   ROM_REGION( 0x8000, "gfx1", 0 ) /* chars */
1252   ROM_LOAD( "2.j4",    0x0000, 0x8000, CRC(83eb572c) SHA1(e915afd55d505bce202206c9ecfa89bad561ef6c) )    /* empty */
1253   ROM_CONTINUE(        0x0000, 0x8000 )
1254
1255   ROM_REGION( 0x40000, "gfx2", 0 )    /* sprites */
1256   ROM_LOAD16_BYTE( "16.d14",   0x00000, 0x20000, CRC(df503504) SHA1(daa58a7bc24415b5f59b7c7cc918bc85de9702a3) )
1257   ROM_LOAD16_BYTE( "15.a14",   0x00001, 0x20000, CRC(cd990442) SHA1(891b2163db23ab0bb40cbadce6e06fc067d0532f) )
1258
1259   ROM_REGION( 0x80000, "gfx3", 0 )    /* tiles */
1260   ROM_LOAD16_BYTE( "6.s9",     0x00000, 0x20000, CRC(1054361d) SHA1(52566786ca8177404be8b66fd7de94ac25fc49ea) )
1261   ROM_LOAD16_BYTE( "9.s11",    0x00001, 0x20000, CRC(6952ef4d) SHA1(b4e5ec02e97df213fe0bd4cd8a2ca77d7ecf8ad5) )
1262   ROM_LOAD16_BYTE( "7.u9",     0x40000, 0x20000, CRC(6e57a888) SHA1(8efe876ea3c788b83e8291f7fc6f55b90de158c8) )
1263   ROM_LOAD16_BYTE( "10.u11",   0x40001, 0x20000, CRC(a5548dca) SHA1(9914e01c1739c3bfd868a01e53c9030726ced4ea) )
1264
1265   ROM_REGION( 0x40000, "gfx4", 0 )    /* tiles */
1266   ROM_LOAD16_BYTE( "12.s13",   0x00000, 0x20000, CRC(992bc4af) SHA1(94570ebd1ee6acf1871cf914907acd12dca4026e) )
1267   ROM_LOAD16_BYTE( "14.s14",   0x00001, 0x20000, CRC(a79abc85) SHA1(3e63dad11db9b7420331403a1d551d8c041c4cc2) )
1268
1269   ROM_REGION( 0x20000, "gfx5", 0 )    /* background tilemaps */
1270   ROM_LOAD16_BYTE( "5.r9",     0x00000, 0x10000, CRC(4789bae8) SHA1(6ffecc16eb8c9c783b02c4ef68cb5098b01fafef) )
1271   ROM_LOAD16_BYTE( "8.r11",    0x00001, 0x10000, CRC(92402b9a) SHA1(2ca8078d2687afbe7b6fc5412de16c6fbc11a650) )
1272
1273   ROM_REGION( 0x20000, "gfx6", 0 )    /* fg tilemaps */
1274   ROM_LOAD16_BYTE( "11.r13",   0x00000, 0x10000, CRC(04b961de) SHA1(7a94c9d0800d79048660cf3758708a346ead33f9) )
1275   ROM_LOAD16_BYTE( "13.r14",   0x00001, 0x10000, CRC(6bdbd887) SHA1(a54f26f9ddd72b8b8f7a030610c1c4a5f94a3358) )
1276ROM_END
1277
12781242ROM_START( gulfstrm )
12791243   ROM_REGION( 0x30000, "maincpu", 0 ) /* 64k for code + 128k for banks */
12801244   ROM_LOAD( "1.l4",         0x00000, 0x20000, CRC(59e0478b) SHA1(dd6e48c6e91ddb087d20336eab79bbadd968d4b1) )
r242301r242302
20732037
20742038GAME( 1990, lastday,  0,        lastday,  lastday, driver_device,  0, ROT270, "Dooyong",                       "The Last Day (set 1)", GAME_SUPPORTS_SAVE )
20752039GAME( 1990, lastdaya, lastday,  lastday,  lastday, driver_device,  0, ROT270, "Dooyong",                       "The Last Day (set 2)", GAME_SUPPORTS_SAVE )
2076GAME( 1990, ddaydoo,  lastday,  lastday,  lastday, driver_device,  0, ROT270, "Dooyong",                       "D-Day (Dooyong) (Korea)", GAME_SUPPORTS_SAVE )
20772040
20782041GAME( 1991, gulfstrm, 0,        gulfstrm, gulfstrm, driver_device, 0, ROT270, "Dooyong",                       "Gulf Storm (set 1)",        GAME_SUPPORTS_SAVE )
20792042GAME( 1991, gulfstrma,gulfstrm, gulfstrm, gulfstrm, driver_device, 0, ROT270, "Dooyong",                       "Gulf Storm (set 2)",        GAME_SUPPORTS_SAVE )
trunk/src/mame/drivers/gts1.c
r242301r242302
6767
6868
6969#include "machine/genpin.h"
70#include "machine/r10788.h"
7170#include "cpu/pps4/pps4.h"
7271#include "gts1.lh"
7372
r242301r242302
8887    { }
8988
9089    DECLARE_DRIVER_INIT(gts1);
91
92    DECLARE_WRITE8_MEMBER(gts1_display_w);
93    DECLARE_READ8_MEMBER (gts1_io_r);
94    DECLARE_WRITE8_MEMBER(gts1_io_w);
9590    DECLARE_READ8_MEMBER (gts1_pa_r);
9691    DECLARE_WRITE8_MEMBER(gts1_pa_w);
9792    DECLARE_WRITE8_MEMBER(gts1_pb_w);
9893private:
9994    virtual void machine_reset();
10095    required_device<cpu_device> m_maincpu;
101    UINT8 m_io[256];
102    UINT8 m_counter;
10396    UINT8 m_6351_addr;
10497};
10598
r242301r242302
108101ADDRESS_MAP_END
109102
110103static ADDRESS_MAP_START( gts1_data, AS_DATA, 8, gts1_state )
111    AM_RANGE(0x0000, 0x00ff) AM_RAM // not correct
104    AM_RANGE(0x0000, 0x0fff) AM_RAM // not correct
112105ADDRESS_MAP_END
113106
114107static ADDRESS_MAP_START( gts1_io, AS_IO, 8, gts1_state )
115    AM_RANGE(0x00d0, 0x00df) AM_DEVREADWRITE ( "r10788", r10788_device, io_r, io_w )
116    AM_RANGE(0x0000, 0x00ff) AM_READ ( gts1_io_r )   AM_WRITE( gts1_io_w ) // connects to all the other chips
117
118    AM_RANGE(0x0100, 0x0100) AM_READ ( gts1_pa_r ) AM_WRITE( gts1_pa_w )
108    AM_RANGE(0x0000, 0x00ff) AM_RAM // connects to all the other chips
109    AM_RANGE(0x0100, 0x0100) AM_READ (gts1_pa_r) AM_WRITE(gts1_pa_w)
119110    AM_RANGE(0x0101, 0x0101) AM_WRITE(gts1_pb_w)
120111ADDRESS_MAP_END
121112
r242301r242302
208199{
209200}
210201
211/**
212 * @brief write a 8seg display value
213 * @param offset digit number 0 .. 19
214 * @param data 4-bit value to display
215 */
216WRITE8_MEMBER(gts1_state::gts1_display_w)
217{
218    /*
219     * The 7448 is modified to be disabled through RI/RBO
220     * when the input is 0001, and in this case the extra
221     * output H is generated instead.
222     */
223#define _a (1 << 0)
224#define _b (1 << 1)
225#define _c (1 << 2)
226#define _d (1 << 3)
227#define _e (1 << 4)
228#define _f (1 << 5)
229#define _g (1 << 6)
230#define _h (1 << 7)
231    static const UINT8 ttl7448_mod[16] = {
232    /* 0 */  _a | _b | _c | _d | _e | _f,
233    /* 1 */  _h,
234    /* 2 */  _a | _b | _d | _e | _g,
235    /* 3 */  _a | _b | _c | _d | _g,
236    /* 4 */  _b | _c | _f | _g,
237    /* 5 */  _a | _c | _d | _f | _g,
238    /* 6 */  _a | _c | _d | _e | _f | _g,
239    /* 7 */  _a | _b | _c,
240    /* 8 */  _a | _b | _c | _d | _e | _f | _g,
241    /* 9 */  _a | _b | _c | _d | _f | _g,
242    /* a */  _d | _e | _g,
243    /* b */  _c | _d | _g,
244    /* c */  _b | _f | _g,
245    /* d */  _a | _d | _f | _g,
246    /* e */  _d | _e | _f | _g,
247    /* f */  0
248    };
249    UINT8 a = ttl7448_mod[(data >> 0) & 15];
250    UINT8 b = ttl7448_mod[(data >> 4) & 15];
251    LOG(("%s: offset:%d data:%02x a:%02x b:%02x\n", __FUNCTION__, offset, data, a, b));
252    if ((offset % 8) < 7) {
253        output_set_indexed_value("digit8_", offset, a);
254        output_set_indexed_value("digit8_", offset + 16, b);
255    } else {
256        /*
257         * For the 4 7-seg displays the segment h is turned back into
258         * segments b and c to display the 7-seg "1".
259         */
260        if (a & _h)
261            a = _b | _c;
262        if (b & _h)
263            b = _b | _c;
264        output_set_indexed_value("digit7_", offset, a);
265        // FIXME: there is nothing on outputs 22, 23, 30 and 31?
266        output_set_indexed_value("digit7_", offset + 16, b);
267    }
268#undef _a
269#undef _b
270#undef _c
271#undef _d
272#undef _e
273#undef _f
274#undef _g
275#undef _h
276}
277
278READ8_MEMBER (gts1_state::gts1_io_r)
279{
280    UINT8 data = m_io[offset] & 0x0f;
281    LOG(("%s: io[%02x] -> %x\n", __FUNCTION__, offset, data));
282    return data;
283}
284
285WRITE8_MEMBER(gts1_state::gts1_io_w)
286{
287    LOG(("%s: io[%02x] <- %x\n", __FUNCTION__, offset, data));
288    m_io[offset] = data;
289}
290
291202READ8_MEMBER (gts1_state::gts1_pa_r)
292203{
293204    // return ROM nibble
r242301r242302
321232
322233    //MCFG_NVRAM_ADD_0FILL("nvram")
323234
324    /* General Purpose Display and Keyboard */
325    MCFG_DEVICE_ADD( "r10788", R10788, XTAL_3_579545MHz / 18 )  // divided in the circuit
326    MCFG_R10788_UPDATE( WRITE8(gts1_state,gts1_display_w) )
327
328235    /* Video */
329    MCFG_DEFAULT_LAYOUT( layout_gts1 )
236    MCFG_DEFAULT_LAYOUT(layout_gts1)
330237
331238    /* Sound */
332239    MCFG_FRAGMENT_ADD( genpin_audio )
trunk/src/mame/drivers/gundealr.c
r242301r242302
533533
534534ROM_START( yamyam )
535535   ROM_REGION( 0x30000, "maincpu", 0 ) /* 64k for code + 128k for banks */
536   ROM_LOAD( "3.10f",       0x00000, 0x20000, CRC(96ae9088) SHA1(a605882dcdcf1e8cf8b0112f614e696d59acfd97) )
536   ROM_LOAD( "b3.f10",       0x00000, 0x20000, CRC(96ae9088) SHA1(a605882dcdcf1e8cf8b0112f614e696d59acfd97) )
537537   ROM_RELOAD(               0x10000, 0x20000 )    /* banked at 0x8000-0xbfff */
538538
539539   ROM_REGION( 0x10000, "mcu", 0 ) //unknown type, there must be one
540540   ROM_LOAD( "mcu", 0x0000, 0x10000, NO_DUMP)
541541
542542   ROM_REGION( 0x10000, "gfx1", 0 )
543   ROM_LOAD( "b2.16d",       0x00000, 0x10000, CRC(cb4f84ee) SHA1(54319ecbd74b763757eb6d17c8f7be0705ab0714) )
543   ROM_LOAD( "b2.d16",       0x00000, 0x10000, CRC(cb4f84ee) SHA1(54319ecbd74b763757eb6d17c8f7be0705ab0714) )
544544
545545   ROM_REGION( 0x20000, "gfx2", 0 )
546   ROM_LOAD( "1.16a",       0x00000, 0x20000, CRC(b122828d) SHA1(90994ba548893a2eacdd58351cfa3952f4af926a) )
546   ROM_LOAD( "b1.a16",       0x00000, 0x20000, CRC(b122828d) SHA1(90994ba548893a2eacdd58351cfa3952f4af926a) )
547547ROM_END
548548
549549/* only gfx are different, code is the same */
550ROM_START( yamyamk )
551   ROM_REGION( 0x30000, "maincpu", 0 ) /* 64k for code + 128k for banks */
552   ROM_LOAD( "3.10f",       0x00000, 0x20000, CRC(96ae9088) SHA1(a605882dcdcf1e8cf8b0112f614e696d59acfd97) )
553   ROM_RELOAD(               0x10000, 0x20000 )    /* banked at 0x8000-0xbfff */
554
555   ROM_REGION( 0x10000, "mcu", 0 ) //unknown type, there must be one
556   ROM_LOAD( "mcu", 0x0000, 0x10000, NO_DUMP)
557
558   ROM_REGION( 0x10000, "gfx1", 0 )
559   ROM_LOAD( "2.16d",       0x00000, 0x10000, CRC(dc9691d8) SHA1(118a05a1c94020d6739ed8c805c61b8ab003b6af) )
560
561   ROM_REGION( 0x20000, "gfx2", 0 )
562   ROM_LOAD( "1.16a",       0x00000, 0x20000, CRC(b122828d) SHA1(90994ba548893a2eacdd58351cfa3952f4af926a) )
563ROM_END
564
565/* only gfx are different, code is the same */
566550ROM_START( wiseguy )
567551   ROM_REGION( 0x30000, "maincpu", 0 ) /* 64k for code + 128k for banks */
568552   ROM_LOAD( "b3.f10",       0x00000, 0x20000, CRC(96ae9088) SHA1(a605882dcdcf1e8cf8b0112f614e696d59acfd97) )
r242301r242302
572556   ROM_LOAD( "mcu", 0x0000, 0x10000, NO_DUMP)
573557
574558   ROM_REGION( 0x10000, "gfx1", 0 )
575   ROM_LOAD( "wguyb2.16d",   0x00000, 0x10000, CRC(1c684c46) SHA1(041bc500e31b02a8bf3ce4683a67de998f938ccc) )
559   ROM_LOAD( "wguyb2.bin",   0x00000, 0x10000, CRC(1c684c46) SHA1(041bc500e31b02a8bf3ce4683a67de998f938ccc) )
576560
577561   ROM_REGION( 0x20000, "gfx2", 0 )
578   ROM_LOAD( "1.16a",       0x00000, 0x20000, CRC(b122828d) SHA1(90994ba548893a2eacdd58351cfa3952f4af926a) )
562   ROM_LOAD( "b1.a16",       0x00000, 0x20000, CRC(b122828d) SHA1(90994ba548893a2eacdd58351cfa3952f4af926a) )
579563ROM_END
580564
581565
r242301r242302
586570GAME( 1990, gundealr,  0,        gundealr, gundealr, driver_device, 0, ROT270, "Dooyong", "Gun Dealer",                GAME_SUPPORTS_SAVE )
587571GAME( 1990, gundealra, gundealr, gundealr, gundealr, driver_device, 0, ROT270, "Dooyong", "Gun Dealer (alt card set)", GAME_SUPPORTS_SAVE )
588572GAME( 1990, gundealrt, gundealr, gundealr, gundealt, driver_device, 0, ROT270, "Dooyong (Tecmo license)", "Gun Dealer (Japan)", GAME_SUPPORTS_SAVE )
589
590573GAME( 1990, yamyam,    0,        yamyam,   yamyam, driver_device,   0, ROT0,   "Dooyong", "Yam! Yam!?",                GAME_SUPPORTS_SAVE )
591GAME( 1990, yamyamk,   yamyam,   yamyam,   yamyam, driver_device,   0, ROT0,   "Dooyong", "Yam! Yam!? (Korea)",        GAME_SUPPORTS_SAVE )
592574GAME( 1990, wiseguy,   yamyam,   yamyam,   yamyam, driver_device,   0, ROT0,   "Dooyong", "Wise Guy",                  GAME_SUPPORTS_SAVE )
trunk/src/mame/drivers/lindbergh.c
r242301r242302
323323#include "machine/segabb.h"
324324#include "sound/pci-ac97.h"
325325#include "sound/sb0400.h"
326#include "video/gf7600gs.h"
326#include "video/gf6800gt.h"
327327
328328class lindbergh_state : public driver_device
329329{
r242301r242302
352352   MCFG_PCI_ROOT_ADD(                ":pci")
353353   MCFG_I82875P_HOST_ADD(            ":pci:00.0",                        0x103382c0, ":maincpu", 512*1024*1024)
354354   MCFG_I82875P_AGP_ADD(             ":pci:01.0")
355   MCFG_GEFORCE_7600GS_ADD(          ":pci:01.0:00.0",                   0x10de02e1)
355   MCFG_GEFORCE_6800GT_ADD(          ":pci:01.0:00.0",                   0x10de0204)
356356   MCFG_PCI_BRIDGE_ADD(              ":pci:1c.0",      0x808625ae, 0x02)
357357   MCFG_I82541PI_ADD(                ":pci:1c.0:00.0",                   0x103382c0)
358358   MCFG_USB_UHCI_ADD(                ":pci:1d.0",      0x808625a9, 0x02, 0x103382c0)
r242301r242302
384384   ROM_REGION(0x400000, ":pci:1e.0:03.0", 0) /* Baseboard MPC firmware */ \
385385   ROM_LOAD("fpr-24370b.ic6", 0x000000, 0x400000, CRC(c3b021a4) SHA1(1b6938a50fe0e4ae813864649eb103838c399ac0)) \
386386\
387   ROM_REGION32_LE(0x10000, ":pci:01.0:00.0", 0) /* Geforce bios extension (custom for the card) */ \
387   ROM_REGION32_LE(0x10000, ":pci:01.0:00.0", 0) /* Geforce bios extension (custom or standard?) */ \
388388   ROM_LOAD("vid_bios.u504", 0x00000, 0x10000, CRC(f78d14d7) SHA1(f129787e487984edd23bf344f2e9500c85052275)) \
389389
390390ROM_START(lindbios)
trunk/src/mame/drivers/prehisle.c
r242301r242302
139139   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW2:7")
140140   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
141141   PORT_DIPSETTING(    0x40, DEF_STR( Yes ) )
142   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("screen")
142   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen")
143143INPUT_PORTS_END
144144
145145/******************************************************************************/
trunk/src/mame/drivers/snowbros.c
r242301r242302
13881388   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
13891389INPUT_PORTS_END
13901390
1391// ignore service mode, it shows a regular joystick + 3 buttons config, these game simply uses 6 buttons
1392static INPUT_PORTS_START( suhosong )
1393   PORT_START("DSW1")
1394   PORT_DIPNAME( 0x0001, 0x0000, DEF_STR( Demo_Sounds ) )    PORT_DIPLOCATION("SW1:1")
1395   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
1396   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
1397   PORT_DIPUNUSED_DIPLOC( 0x0002, 0x0000, "SW1:2" )
1398   PORT_DIPUNUSED_DIPLOC( 0x0004, 0x0000, "SW1:3" )
1399   PORT_DIPUNUSED_DIPLOC( 0x0008, 0x0000, "SW1:4" )
1400   PORT_DIPUNUSED_DIPLOC( 0x0010, 0x0000, "SW1:5" )
1401   PORT_DIPUNUSED_DIPLOC( 0x0020, 0x0000, "SW1:6" )
1402   PORT_DIPUNUSED_DIPLOC( 0x0040, 0x0000, "SW1:7" )
1403   PORT_SERVICE_DIPLOC(   0x0080, IP_ACTIVE_LOW, "SW1:8" )
1404   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Button 4 / Stand / Stop / Drop / Full Bet / Take") PORT_CODE(KEYCODE_V)
1405   PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Button 1 / High") PORT_CODE(KEYCODE_Z)
1406   PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Button 2 / Low") PORT_CODE(KEYCODE_X)
1407   PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Button 3 / Hit / Go / Double Up") PORT_CODE(KEYCODE_C)
1408   PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_UNKNOWN )
1409   PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Button 6 / Bet / Raise") PORT_CODE(KEYCODE_N)
1410   PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_UNKNOWN )
1411   PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_UNKNOWN )
14121391
1413   PORT_START("DSW2")
1414   PORT_DIPUNUSED_DIPLOC( 0x0001, 0x0000, "SW2:1" )
1415   PORT_DIPUNUSED_DIPLOC( 0x0002, 0x0000, "SW2:2" )
1416   PORT_DIPUNUSED_DIPLOC( 0x0004, 0x0000, "SW2:3" )
1417   PORT_DIPUNUSED_DIPLOC( 0x0008, 0x0000, "SW2:4" )
1418   PORT_DIPUNUSED_DIPLOC( 0x0010, 0x0000, "SW2:5" )
1419   PORT_DIPUNUSED_DIPLOC( 0x0020, 0x0000, "SW2:6" )
1420   PORT_DIPUNUSED_DIPLOC( 0x0040, 0x0000, "SW2:7" )
1421   PORT_DIPUNUSED_DIPLOC( 0x0080, 0x0000, "SW2:8" )
1422   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_UNKNOWN )
1423   PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_UNKNOWN )
1424   PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_UNKNOWN )
1425   PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_UNKNOWN )
1426   PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_UNKNOWN )
1427   PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_UNKNOWN )
1428   PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_UNKNOWN )
1429   PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_UNKNOWN )
1430
1431   PORT_START("SYSTEM")
1432   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Button 5 / Start / Double / Call / Check") PORT_CODE(KEYCODE_B) // Double != Double Up
1433   PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_UNKNOWN )
1434   PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_COIN1 )
1435   PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_COIN2 )
1436   PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_UNKNOWN )
1437   PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_UNKNOWN )
1438   PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_UNKNOWN )
1439   PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_UNKNOWN )
1440INPUT_PORTS_END
1441
14421392/* SnowBros */
14431393
14441394static const gfx_layout tilelayout =
r242301r242302
24092359   ROM_LOAD16_BYTE( "su_ho_sung.uh12",  0x00001, 0x20000, CRC(6bd8bd08) SHA1(668398c9c77cc4cc52858daefd3cb13fbaf29a37) )
24102360   ROM_LOAD16_BYTE( "su_ho_sung.ui12",  0x00000, 0x20000, CRC(79a4806e) SHA1(a4080ea70fa588ada384ffa9877f5cf965fb68df) )
24112361
2362   ROM_LOAD( "fakecode",     0x3fe00, 0x200, CRC(2849b78a) SHA1(a1aec7510de9476c23b3f65ffc465a32dfa70718) ) // temphack: this is extracted from puzzle break ram at runtime
24122363
24132364   ROM_REGION( 0x10000, "soundcpu", 0 ) /* Z80 Code */
24142365   ROM_LOAD( "su_ho_sung.u1", 0x00000, 0x10000 ,  CRC(509ce74e) SHA1(a93add5ab674671078b55128281dcf9b0db46617) )
r242301r242302
24172368   ROM_LOAD( "87c52.mcu", 0x00000, 0x10000 , NO_DUMP ) /* can't be dumped */
24182369
24192370   ROM_REGION16_BE( 0x200, "user1", ROMREGION_ERASE00 ) /* Data from Shared RAM */
2420   ROM_LOAD16_WORD( "protdata.bin", 0x000, 0x200 , CRC(4478e251) SHA1(08489d6bfe5503c8eb62909e56a07193a922b4c1) )
2371//  ROM_LOAD16_WORD( "protdata.bin", 0x00000, 0x200 , CRC(1) SHA1(1) )
24212372
24222373   ROM_REGION( 0x040000, "oki", 0 ) /* Samples */
24232374   ROM_LOAD( "su_ho_sung.uj15", 0x00000, 0x40000, CRC(266fcae8) SHA1(0f15f880bde0c12b5c663ed387f9353c13b731b6) )
r242301r242302
28642815   m_pandora->set_bg_pen(0xc0);
28652816}
28662817
2818DRIVER_INIT_MEMBER(snowbros_state,suhosong)
2819{
2820   UINT16 *HCROM = (UINT16*)memregion("maincpu")->base();
28672821
2822   // replace jump to ram with jump to fake code we load in rom region
2823   HCROM[0x580/2] = 0x0003;
2824   HCROM[0x582/2] = 0xfe04;
28682825
2869GAME( 1990, snowbros,  0,        snowbros, snowbros, driver_device, 0, ROT0, "Toaplan",                        "Snow Bros. - Nick & Tom (set 1)", 0 )
2870GAME( 1990, snowbrosa, snowbros, snowbros, snowbros, driver_device, 0, ROT0, "Toaplan",                        "Snow Bros. - Nick & Tom (set 2)", 0 )
2871GAME( 1990, snowbrosb, snowbros, snowbros, snowbros, driver_device, 0, ROT0, "Toaplan",                        "Snow Bros. - Nick & Tom (set 3)", 0 )
2872GAME( 1990, snowbrosc, snowbros, snowbros, snowbros, driver_device, 0, ROT0, "Toaplan",                        "Snow Bros. - Nick & Tom (set 4)", 0 )
2873GAME( 1990, snowbrosj, snowbros, snowbros, snowbroj, driver_device, 0, ROT0, "Toaplan",                        "Snow Bros. - Nick & Tom (Japan)", 0 )
2874GAME( 1990, snowbrosd, snowbros, snowbros, snowbroj, driver_device, 0, ROT0, "Toaplan (Dooyong license)",      "Snow Bros. - Nick & Tom (Dooyong license)", 0 )
2826   // disable checksum check fail
2827   HCROM[0x41e/2] = 0x4e71;
2828   HCROM[0x420/2] = 0x4e71;
2829}
2830
2831GAME( 1990, snowbros,  0,        snowbros, snowbros, driver_device, 0, ROT0, "Toaplan", "Snow Bros. - Nick & Tom (set 1)", 0 )
2832GAME( 1990, snowbrosa, snowbros, snowbros, snowbros, driver_device, 0, ROT0, "Toaplan", "Snow Bros. - Nick & Tom (set 2)", 0 )
2833GAME( 1990, snowbrosb, snowbros, snowbros, snowbros, driver_device, 0, ROT0, "Toaplan", "Snow Bros. - Nick & Tom (set 3)", 0 )
2834GAME( 1990, snowbrosc, snowbros, snowbros, snowbros, driver_device, 0, ROT0, "Toaplan", "Snow Bros. - Nick & Tom (set 4)", 0 )
2835GAME( 1990, snowbrosj, snowbros, snowbros, snowbroj, driver_device, 0, ROT0, "Toaplan", "Snow Bros. - Nick & Tom (Japan)", 0 )
2836GAME( 1990, snowbrosd, snowbros, snowbros, snowbroj, driver_device, 0, ROT0, "Toaplan (Dooyong license)", "Snow Bros. - Nick & Tom (Dooyong license)", 0 )
28752837GAME( 1990, wintbob,   snowbros, wintbob,  snowbros, driver_device, 0, ROT0, "bootleg (Sakowa Project Korea)", "The Winter Bobble (bootleg of Snow Bros.)", 0 )
2876GAME( 1990, snowbroswb,snowbros, wintbob,  snowbros, driver_device, 0, ROT0, "bootleg",                        "Snow Bros. - Nick & Tom (The Winter Bobble hardware bootleg)", 0 ) // this was probably unhacked back from the more common Winter Bobble to make it look more original
2838GAME( 1990, snowbroswb,snowbros, wintbob,  snowbros, driver_device, 0, ROT0, "bootleg", "Snow Bros. - Nick & Tom (The Winter Bobble hardware bootleg)", 0 ) // this was probably unhacked back from the more common Winter Bobble to make it look more original
28772839
28782840// none of the games below are on genuine SnowBros hardware, but they clone the functionality of it.
2879
2880// SemiCom / Jeil titles are protected, a dumb MCU copies code into RAM at startup, some also check for a specific return value from an address on startup.
2881GAME( 1993, finalttr, 0,        finalttr,     finalttr, driver_device,  0,        ROT0, "Jeil Computer System", "Final Tetris", 0 )
2882GAME( 1995, hyperpac, 0,        semicom_mcu,  hyperpac, driver_device,  0,        ROT0, "SemiCom",              "Hyper Pacman", 0 )
2883GAME( 1995, hyperpacb,hyperpac, semicom,      hyperpac, driver_device,  0,        ROT0, "bootleg",              "Hyper Pacman (bootleg)", 0 )
2884GAME( 1996, cookbib2, 0,        semiprot,     cookbib2, snowbros_state, cookbib2, ROT0, "SemiCom",              "Cookie & Bibi 2", 0 )
2885GAME( 1996, toppyrap, 0,        semiprot,     toppyrap, driver_device,  0,        ROT0, "SemiCom",              "Toppy & Rappy", 0 )
2886GAME( 1997, cookbib3, 0,        semiprot,     cookbib3, snowbros_state, cookbib3, ROT0, "SemiCom",              "Cookie & Bibi 3", 0 )
2887GAME( 1997, 3in1semi, 0,        semiprot,     moremore, snowbros_state, 3in1semi, ROT0, "SemiCom",              "XESS - The New Revolution (SemiCom 3-in-1)", 0 )
2888GAME( 1997, twinkle,  0,        semiprot,     twinkle,  driver_device,  0,        ROT0, "SemiCom",              "Twinkle", 0 )
2889GAME( 1997, pzlbreak, 0,        semiprot,     pzlbreak, snowbros_state, pzlbreak, ROT0, "SemiCom",              "Puzzle Break", 0 )
2890GAME( 1999, moremore, 0,        semiprot,     moremore, snowbros_state, moremorp, ROT0, "SemiCom / Exit",       "More More", 0 )
2891GAME( 1999, moremorp, 0,        semiprot,     moremore, snowbros_state, moremorp, ROT0, "SemiCom / Exit",       "More More Plus", 0 )
2892GAME( 1997, suhosong, 0,        semiprot,     suhosong, driver_device,  0,        ROT0, "SemiCom",              "Su Ho Seong", 0 )
2893// This is very similar to the SemiCom titles, but unprotected.
2894GAME( 2002, 4in1boot, 0,        _4in1,    4in1boot, snowbros_state, 4in1boot, ROT0, "K1 Soft", "Puzzle King (PacMan 2, Tetris, HyperMan 2, Snow Bros.)" , 0)
2895
2841GAME( 1993, finalttr, 0,        finalttr, finalttr, driver_device, 0,        ROT0, "Jeil Computer System", "Final Tetris", 0 )
28962842GAME( 1995, honeydol, 0,        honeydol, honeydol, driver_device, 0, ROT0, "Barko Corp.", "Honey Dolls", 0 ) // based on snowbros code..
2897
28982843GAME( 1995, twinadv,  0,        twinadv,  twinadv, driver_device,  0, ROT0, "Barko Corp.", "Twin Adventure (World)", 0 )
28992844GAME( 1995, twinadvk, twinadv,  twinadv,  twinadv, driver_device,  0, ROT0, "Barko Corp.", "Twin Adventure (Korea)", 0 )
2845GAME( 1995, hyperpac, 0,        semicom_mcu,  hyperpac, driver_device, 0, ROT0, "SemiCom", "Hyper Pacman", 0 )
2846GAME( 1995, hyperpacb,hyperpac, semicom,  hyperpac, driver_device, 0,        ROT0, "bootleg", "Hyper Pacman (bootleg)", 0 )
2847GAME( 1996, cookbib2, 0,        semiprot, cookbib2, snowbros_state, cookbib2, ROT0, "SemiCom", "Cookie & Bibi 2", 0 )
2848GAME( 1996, toppyrap, 0,        semiprot, toppyrap, driver_device, 0,        ROT0, "SemiCom", "Toppy & Rappy", 0 )
2849GAME( 1997, cookbib3, 0,        semiprot, cookbib3, snowbros_state, cookbib3, ROT0, "SemiCom", "Cookie & Bibi 3", 0 )
2850GAME( 1997, 3in1semi, 0,        semiprot, moremore, snowbros_state, 3in1semi, ROT0, "SemiCom", "XESS - The New Revolution (SemiCom 3-in-1)", 0 )
2851GAME( 1997, twinkle,  0,        semiprot, twinkle, driver_device,  0,        ROT0, "SemiCom", "Twinkle", 0 )
2852GAME( 1997, pzlbreak, 0,        semiprot, pzlbreak, snowbros_state, pzlbreak, ROT0, "SemiCom", "Puzzle Break", 0 )
2853GAME( 1999, moremore, 0,        semiprot, moremore, snowbros_state, moremorp, ROT0, "SemiCom / Exit", "More More", 0 )
2854GAME( 1999, moremorp, 0,        semiprot, moremore, snowbros_state, moremorp, ROT0, "SemiCom / Exit", "More More Plus", 0 )
2855GAME( 2002, 4in1boot, 0,        _4in1,    4in1boot, snowbros_state, 4in1boot, ROT0, "K1 Soft", "Puzzle King (includes bootleg of Snow Bros.)" , 0)
2856GAME( 1997, suhosong, 0,        semiprot, cookbib3, snowbros_state, suhosong, ROT0, "SemiCom", "Su Ho Seong", GAME_NOT_WORKING )
29002857
29012858// The Korean games database shows an earlier version of this called Ball Boy with a different title screen to the version of Ball Boy we have
29022859// http://mamedev.emulab.it/undumped/images/Ballboy.jpg
29032860// it is possible this 'ball boy' is the original bootleg, with snwobro3 being a hack of that, and the ballboy set we have a further hack of that
29042861// there is also a later 2004 version with 3 player support
2905// these use an MCU to drive the sound
2906GAME( 2002, snowbro3, 0,        snowbro3, snowbroj, snowbros_state, snowbro3, ROT0, "Syrmex",  "Snow Brothers 3 - Magical Adventure", GAME_IMPERFECT_SOUND ) // hacked from SnowBros code but released as an original game
2862GAME( 2002, snowbro3, 0,        snowbro3, snowbroj, snowbros_state, snowbro3, ROT0, "Syrmex", "Snow Brothers 3 - Magical Adventure", GAME_IMPERFECT_SOUND ) // hacked from SnowBros code but released as an original game
29072863GAME( 2003, ballboy,  snowbro3, snowbro3, snowbroj, snowbros_state, snowbro3, ROT0, "bootleg", "Ball Boy", GAME_IMPERFECT_SOUND )
trunk/src/mame/includes/snowbros.h
r242301r242302
5555   DECLARE_DRIVER_INIT(4in1boot);
5656   DECLARE_DRIVER_INIT(3in1semi);
5757   DECLARE_DRIVER_INIT(cookbib2);
58   DECLARE_DRIVER_INIT(suhosong);
5859   DECLARE_MACHINE_RESET(semiprot);
5960   DECLARE_MACHINE_RESET(finalttr);
6061   UINT32 screen_update_snowbros(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
trunk/src/mame/layout/gts1.lay
r242301r242302
44
55<mamelayout version="2">
66
7   <element name="digit8_" defstate="0">
8      <led8seg_gts1>
7   <element name="digit" defstate="0">
8      <led8seg>
99         <color red="0.0" green="0.75" blue="1.0" />
10      </led8seg_gts1>
10      </led8seg>
1111   </element>
12   <element name="digit7_" defstate="0">
13      <led7seg>
14         <color red="0.0" green="0.75" blue="1.0" />
15      </led7seg>
16   </element>
1712   <element name="background">
1813      <rect>
1914         <bounds left="0" top="0" right="1" bottom="1" />
2015         <color red="0.0" green="0.0" blue="0.0" />
2116      </rect>
2217   </element>
18   <element name="P3"><text string="Player 1"><color red="1.0" green="1.0" blue="1.0" /></text></element>
19   <element name="P4"><text string="Player 2"><color red="1.0" green="1.0" blue="1.0" /></text></element>
20   <element name="P5"><text string="Player 3"><color red="1.0" green="1.0" blue="1.0" /></text></element>
21   <element name="P6"><text string="Player 4"><color red="1.0" green="1.0" blue="1.0" /></text></element>
2322
2423   <view name="Default Layout">
2524
2625      <!-- Background -->
2726      <backdrop element="background">
28         <bounds left="0" top="25" right="325" bottom="205" />
27         <bounds left="0" top="25" right="325" bottom="179" />
2928      </backdrop>
3029
3130      <!-- Top Row -->
32      <bezel name="digit8_0" element="digit8_">
31      <bezel name="digit0_0" element="digit">
3332         <bounds left="10" top="45" right="30" bottom="84" />
3433      </bezel>
35      <bezel name="digit8_1" element="digit8_">
34      <bezel name="digit0_1" element="digit">
3635         <bounds left="34" top="45" right="54" bottom="84" />
3736      </bezel>
38      <bezel name="digit8_2" element="digit8_">
37      <bezel name="digit0_2" element="digit">
3938         <bounds left="58" top="45" right="78" bottom="84" />
4039      </bezel>
41      <bezel name="digit8_3" element="digit8_">
40      <bezel name="digit0_3" element="digit">
4241         <bounds left="87" top="45" right="107" bottom="84" />
4342      </bezel>
44      <bezel name="digit8_4" element="digit8_">
43      <bezel name="digit0_4" element="digit">
4544         <bounds left="111" top="45" right="131" bottom="84" />
4645      </bezel>
47      <bezel name="digit8_5" element="digit8_">
46      <bezel name="digit0_5" element="digit">
4847         <bounds left="135" top="45" right="155" bottom="84" />
4948      </bezel>
50      <bezel name="digit8_8" element="digit8_">
49      <bezel name="digit1_0" element="digit">
5150         <bounds left="170" top="45" right="190" bottom="84" />
5251      </bezel>
53      <bezel name="digit8_9" element="digit8_">
52      <bezel name="digit1_1" element="digit">
5453         <bounds left="194" top="45" right="214" bottom="84" />
5554      </bezel>
56      <bezel name="digit8_10" element="digit8_">
55      <bezel name="digit1_2" element="digit">
5756         <bounds left="218" top="45" right="238" bottom="84" />
5857      </bezel>
59      <bezel name="digit8_11" element="digit8_">
58      <bezel name="digit1_3" element="digit">
6059         <bounds left="247" top="45" right="267" bottom="84" />
6160      </bezel>
62      <bezel name="digit8_12" element="digit8_">
61      <bezel name="digit1_4" element="digit">
6362         <bounds left="271" top="45" right="291" bottom="84" />
6463      </bezel>
65      <bezel name="digit8_13" element="digit8_">
64      <bezel name="digit1_5" element="digit">
6665         <bounds left="295" top="45" right="315" bottom="84" />
6766      </bezel>
6867
6968      <!-- Bottom Row -->
70      <bezel name="digit8_16" element="digit8_">
69      <bezel name="digit2_0" element="digit">
7170         <bounds left="10" top="100" right="30" bottom="139" />
7271      </bezel>
73      <bezel name="digit8_17" element="digit8_">
72      <bezel name="digit2_1" element="digit">
7473         <bounds left="34" top="100" right="54" bottom="139" />
7574      </bezel>
76      <bezel name="digit8_18" element="digit8_">
75      <bezel name="digit2_2" element="digit">
7776         <bounds left="58" top="100" right="78" bottom="139" />
7877      </bezel>
79      <bezel name="digit8_19" element="digit8_">
78      <bezel name="digit2_3" element="digit">
8079         <bounds left="87" top="100" right="107" bottom="139" />
8180      </bezel>
82      <bezel name="digit8_20" element="digit8_">
81      <bezel name="digit2_4" element="digit">
8382         <bounds left="111" top="100" right="131" bottom="139" />
8483      </bezel>
85      <bezel name="digit8_21" element="digit8_">
84      <bezel name="digit2_5" element="digit">
8685         <bounds left="135" top="100" right="155" bottom="139" />
8786      </bezel>
88      <!-- Digits 22 and 23 are not used -->
89      <bezel name="digit8_24" element="digit8_">
87      <bezel name="digit3_0" element="digit">
9088         <bounds left="170" top="100" right="190" bottom="139" />
9189      </bezel>
92      <bezel name="digit8_25" element="digit8_">
90      <bezel name="digit3_1" element="digit">
9391         <bounds left="194" top="100" right="214" bottom="139" />
9492      </bezel>
95      <bezel name="digit8_26" element="digit8_">
93      <bezel name="digit3_2" element="digit">
9694         <bounds left="218" top="100" right="238" bottom="139" />
9795      </bezel>
98      <bezel name="digit8_27" element="digit8_">
96      <bezel name="digit3_3" element="digit">
9997         <bounds left="247" top="100" right="267" bottom="139" />
10098      </bezel>
101      <bezel name="digit8_28" element="digit8_">
99      <bezel name="digit3_4" element="digit">
102100         <bounds left="271" top="100" right="291" bottom="139" />
103101      </bezel>
104      <bezel name="digit8_29" element="digit8_">
102      <bezel name="digit3_5" element="digit">
105103         <bounds left="295" top="100" right="315" bottom="139" />
106104      </bezel>
107      <!-- Digits 30 and 31 are not used -->
108
109      <!-- 4 digit display -->
110      <bezel name="digit7_6" element="digit7_">
111         <bounds left="121" top="155" right="136" bottom="189" />
112      </bezel>
113      <bezel name="digit7_7" element="digit7_">
114         <bounds left="140" top="155" right="155" bottom="189" />
115      </bezel>
116      <bezel name="digit7_14" element="digit7_">
117         <bounds left="170" top="155" right="185" bottom="189" />
118      </bezel>
119      <bezel name="digit7_15" element="digit7_">
120         <bounds left="189" top="155" right="204" bottom="189" />
121      </bezel>
122105   </view>
123106</mamelayout>
trunk/src/mame/mame.lst
r242301r242302
92269226gundealra       // (c) 1990 Dooyong
92279227gundealrt       // (c) 1990 Tecmo
92289228yamyam          // (c) 1990 Dooyong
9229yamyamk         // (c) 1990 Dooyong
92309229wiseguy         // (c) 1990 Dooyong
92319230lastday         // (c) 1990 Dooyong
92329231lastdaya        // (c) 1990 Dooyong
9233ddaydoo         // (c) 1990 Dooyong
92349232gulfstrm        // (c) 1991 Dooyong
92359233gulfstrma       // (c) 1991 Dooyong
92369234gulfstrmb       // (c) 1991 Dooyong
trunk/src/mame/mame.mak
r242301r242302
292292#VIDEOS += EF9340_1
293293#VIDEOS += EF9345
294294#VIDEOS += GF4500
295VIDEOS += GF7600GS
295VIDEOS += GF6800GT
296296VIDEOS += EPIC12
297297VIDEOS += FIXFREQ
298298VIDEOS += H63484
r242301r242302
499499MACHINES += PIC8259
500500MACHINES += PIT8253
501501MACHINES += PLA
502MACHINES += R10788
503502#MACHINES += PROFILE
504503#MACHINES += R64H156
505504MACHINES += RF5C296
trunk/src/mess/drivers/apf.c
r242301r242302
613613***************************************************************************/
614614
615615/*    YEAR  NAME     PARENT     COMPAT  MACHINE     INPUT      CLASS          INIT         COMPANY               FULLNAME */
616COMP( 1979, apfimag,  apfm1000,  0,      apfimag,    apfimag,   driver_device,  0,   "APF Electronics Inc.", "APF Imagination Machine", 0 )
617CONS( 1978, apfm1000, 0,         0,      apfm1000,   apfm1000,  driver_device,  0,   "APF Electronics Inc.", "APF M-1000", 0 )
616COMP(1979, apfimag,  apfm1000,  0,      apfimag,    apfimag,   driver_device,  0,   "APF Electronics Inc", "APF Imagination Machine" , 0 )
617CONS(1978, apfm1000, 0,         0,      apfm1000,   apfm1000,  driver_device,  0,   "APF Electronics Inc", "APF M-1000" , 0 )
trunk/src/mess/drivers/apple2e.c
r242301r242302
682682   save_item(NAME(m_exp_liveptr));
683683   save_item(NAME(m_exp_bankhior));
684684   save_item(NAME(m_exp_addrmask));
685   save_item(NAME(m_lcram));
686   save_item(NAME(m_lcram2));
687   save_item(NAME(m_lcwriteenable));
688685}
689686
690687void apple2e_state::machine_reset()
r242301r242302
829826      {
830827         if (m_video->m_mix)
831828         {
832            if ((m_video->m_dhires) && (m_video->m_80col))
829            if (m_video->m_dhires)
833830            {
834831               m_video->dhgr_update(screen, bitmap, cliprect, 0, 159);
835832            }
r242301r242302
841838         }
842839         else
843840         {
844            if ((m_video->m_dhires) && (m_video->m_80col))
841            if (m_video->m_dhires)
845842            {
846843               m_video->dhgr_update(screen, bitmap, cliprect, 0, 191);
847844            }
r242301r242302
855852      {
856853         if (m_video->m_mix)
857854         {
858            if ((m_video->m_dhires) && (m_video->m_80col))
855            if (m_video->m_dhires)
859856            {
860857               m_video->dlores_update(screen, bitmap, cliprect, 0, 159);
861858            }
r242301r242302
868865         }
869866         else
870867         {
871            if ((m_video->m_dhires) && (m_video->m_80col))
868            if (m_video->m_dhires)
872869            {
873870               m_video->dlores_update(screen, bitmap, cliprect, 0, 191);
874871            }
trunk/src/mess/drivers/cnsector.c
r242301r242302
195195
196196void cnsector_state::machine_start()
197197{
198   // zerofill
199198   memset(m_leds_state, 0, sizeof(m_leds_state));
200199   memset(m_leds_cache, 0, sizeof(m_leds_cache));
201200   memset(m_leds_decay, 0, sizeof(m_leds_decay));
202
203201   m_o = 0;
204202   
205   // register for savestates
206203   save_item(NAME(m_leds_state));
207204   save_item(NAME(m_leds_cache));
208205   save_item(NAME(m_leds_decay));
209
210206   save_item(NAME(m_o));
211207}
212208
trunk/src/mess/drivers/comp4.c
r242301r242302
168168
169169void comp4_state::machine_start()
170170{
171   // zerofill
172171   m_leds_state = 0;
173172   memset(m_leds_decay, 0, sizeof(m_leds_decay));
174
175173   m_o = 0;
176174   
177   // register for savestates
178175   save_item(NAME(m_leds_state));
179176   save_item(NAME(m_leds_decay));
180
181177   save_item(NAME(m_o));
182178}
183179
trunk/src/mess/drivers/excali64.c
r242301r242302
1// license:MAME
2// copyright-holders:Robbbert
3/***************************************************************************
4
5Excalibur 64 kit computer, designed and sold in Australia by BGR Computers.
6
7Skeleton driver created on 2014-12-09.
8
9Chips: Z80A, 8251, 8253, 8255, 6845
10
11ToDo:
12- Some keys can be connected to more than one position in the matrix. Need to
13  determine the correct positions.
14- The position of the "Line Insert" key is unknown.
15- The video section has attributes and colour, none of this is done.
16- Disk controller
17- Banking
18- The schematic shows the audio counter connected to 2MHz, but this produces
19  sounds that are too high. Connected to 1MHz for now.
20- Serial
21- Parallel / Centronics
22- Need software
23
24****************************************************************************/
25
26#include "emu.h"
27#include "cpu/z80/z80.h"
28#include "video/mc6845.h"
29#include "machine/i8251.h"
30#include "bus/rs232/rs232.h"
31//#include "machine/clock.h"
32#include "machine/pit8253.h"
33#include "machine/i8255.h"
34//#include "bus/centronics/ctronics.h"
35#include "imagedev/cassette.h"
36#include "sound/wave.h"
37#include "sound/speaker.h"
38
39
40class excali64_state : public driver_device
41{
42public:
43   excali64_state(const machine_config &mconfig, device_type type, const char *tag)
44      : driver_device(mconfig, type, tag)
45      , m_palette(*this, "palette")
46      , m_maincpu(*this, "maincpu")
47      , m_cass(*this, "cassette")
48      , m_io_keyboard(*this, "KEY")
49   { }
50
51   DECLARE_DRIVER_INIT(excali64);
52   DECLARE_WRITE8_MEMBER(ppib_w);
53   DECLARE_READ8_MEMBER(ppic_r);
54   DECLARE_WRITE8_MEMBER(ppic_w);
55   DECLARE_READ8_MEMBER(port00_r);
56   DECLARE_READ8_MEMBER(port50_r);
57   DECLARE_WRITE8_MEMBER(port70_w);
58   DECLARE_WRITE8_MEMBER(video_w);
59   MC6845_UPDATE_ROW(update_row);
60   DECLARE_WRITE_LINE_MEMBER(crtc_de);
61   DECLARE_WRITE_LINE_MEMBER(crtc_vs);
62
63   required_device<palette_device> m_palette;
64   
65private:
66   const UINT8 *m_p_chargen;
67   UINT8 *m_p_videoram;
68   UINT8 m_sys_status;
69   UINT8 m_kbdrow;
70   bool m_crtc_vs;
71   bool m_crtc_de;
72   required_device<cpu_device> m_maincpu;
73   required_device<cassette_image_device> m_cass;
74   required_ioport_array<8> m_io_keyboard;
75};
76
77static ADDRESS_MAP_START(excali64_mem, AS_PROGRAM, 8, excali64_state)
78   AM_RANGE(0x0000, 0x1FFF) AM_ROM
79   AM_RANGE(0x2000, 0x3FFF) AM_ROM AM_WRITE(video_w)
80   AM_RANGE(0x4000, 0xFFFF) AM_RAM
81ADDRESS_MAP_END
82
83static ADDRESS_MAP_START(excali64_io, AS_IO, 8, excali64_state)
84   ADDRESS_MAP_GLOBAL_MASK(0xff)
85   AM_RANGE(0x00, 0x0f) AM_READ(port00_r)
86   AM_RANGE(0x10, 0x10) AM_MIRROR(0x0e) AM_DEVREADWRITE("uart",i8251_device, data_r, data_w)
87   AM_RANGE(0x11, 0x11) AM_MIRROR(0x0e) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w)
88   AM_RANGE(0x20, 0x23) AM_MIRROR(0x0c) AM_DEVREADWRITE("pit", pit8253_device, read, write)
89   AM_RANGE(0x30, 0x30) AM_MIRROR(0x0e) AM_DEVREADWRITE("crtc", mc6845_device, status_r, address_w)
90   AM_RANGE(0x31, 0x31) AM_MIRROR(0x0e) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w)
91   AM_RANGE(0x50, 0x5f) AM_READ(port50_r)
92   AM_RANGE(0x60, 0x63) AM_MIRROR(0x0c) AM_DEVREADWRITE("ppi", i8255_device, read, write)
93   AM_RANGE(0x70, 0x7f) AM_WRITE(port70_w)
94ADDRESS_MAP_END
95
96
97/* Input ports */
98static INPUT_PORTS_START( excali64 )
99   //PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LINEFEED") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(0x0a)//H
100   //PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("REPT") PORT_CODE(KEYCODE_LALT)//0x11
101   //PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(Down)") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN))//B
102   //PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(Up)") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP))
103   //PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(Fire)") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT))
104   //PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\ |")PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') PORT_CHAR(0x1c)
105   //PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(Right)") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
106   //PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BRK") PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(0x03)
107   //PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(Left)") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
108
109   PORT_START("KEY.0")    /* line 0 */
110   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('R') PORT_CHAR(0x12)
111   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('W') PORT_CHAR(0x17)
112   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
113   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('E') PORT_CHAR(0x05)
114   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR(0x09)
115   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPSLOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE
116   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('A') PORT_CHAR(0x01)
117   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('Q') PORT_CHAR(0x11)
118
119   PORT_START("KEY.1")    /* line 1 */
120   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3)
121   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2)
122   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4)
123   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
124   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2)//=
125   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) // space
126   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1)
127   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) // F1
128
129   PORT_START("KEY.2")    /* line 2 */
130   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>')
131   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('M') PORT_CHAR(0x0d)
132   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?')
133   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<')
134   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('B') PORT_CHAR(0x02)
135   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) //B
136   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('N') PORT_CHAR(0x0e)
137   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) //N
138
139   PORT_START("KEY.3")    /* line 3 */
140   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("' \"") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x27) PORT_CHAR(0x22) PORT_CHAR(0x27)
141   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('L') PORT_CHAR(0x0c)
142   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(0x0d)
143   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("; :") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':')
144   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('J') PORT_CHAR(0x0a)
145   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('G') PORT_CHAR(0x07)
146   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('K') PORT_CHAR(0x0b)
147   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('H') PORT_CHAR(0x08)
148
149   PORT_START("KEY.4")    /* line 4 */
150   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$')
151   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 @") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@')
152   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%')
153   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#')
154   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0x7f) PORT_CHAR(0x7f) PORT_CHAR(0x1f)
155   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(0x1b)
156   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!')
157   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) //1
158
159   PORT_START("KEY.5")    /* line 5 */
160   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') PORT_CHAR(0x1b)
161   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('O') PORT_CHAR(0x0f)
162   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') PORT_CHAR(0x1d)
163   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('P') PORT_CHAR(0x10)
164   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('U') PORT_CHAR(0x15)
165   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('T') PORT_CHAR(0x14)
166   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('I') PORT_CHAR(0x09)//0x12
167   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('Y') PORT_CHAR(0x19)//0x14
168
169   PORT_START("KEY.6")    /* line 6 */
170   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('F') PORT_CHAR(0x06)
171   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('X') PORT_CHAR(0x18)
172   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('V') PORT_CHAR(0x16)
173   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('C') PORT_CHAR(0x03)
174   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('D') PORT_CHAR(0x04)
175   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('S') PORT_CHAR(0x13)
176   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('Z') PORT_CHAR(0x1a)
177   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) //Z
178
179   PORT_START("KEY.7")    /* line 7 */
180   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("= +") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') PORT_CHAR('=')
181   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 )") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')')
182   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(0x08)
183   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- _") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_')
184   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 *") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*')
185   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 ^") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^')
186   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 (") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(')
187   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 &") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&')
188INPUT_PORTS_END
189
190WRITE8_MEMBER( excali64_state::ppib_w )
191{
192   m_kbdrow = data;
193}
194
195READ8_MEMBER( excali64_state::ppic_r )
196{
197   UINT8 data = 0xf7;
198   data |= (m_cass->input() > 0.1) << 3;
199   return data;
200}
201
202READ8_MEMBER( excali64_state::port00_r )
203{
204   UINT8 data = 0xff;
205
206   for (int i = 0; i < 8; i++)
207   {
208      if (!BIT(m_kbdrow, i))
209         data &= m_io_keyboard[i]->read();
210   }
211
212   return data;
213}
214
215/*
216d0 : /rom ; screen
217d1 : ram on
218d2 : /low ; high res
219d3 : dispen
220d4 : vsync
221*/
222READ8_MEMBER( excali64_state::port50_r )
223{
224   UINT8 data = m_sys_status & 7;
225   data |= (UINT8)m_crtc_vs << 4;
226   data |= (UINT8)m_crtc_de << 5;
227   return data;
228}
229
230WRITE8_MEMBER( excali64_state::ppic_w )
231{
232   m_cass->output(BIT(data, 7) ? -1.0 : +1.0);
233}
234
235/*
236d0,1,2 : same as port50
237d7 : 2nd col
238*/
239WRITE8_MEMBER( excali64_state::port70_w )
240{
241   m_sys_status = data;
242}
243
244WRITE8_MEMBER( excali64_state::video_w )
245{
246   m_p_videoram[offset] = data;
247}
248
249WRITE_LINE_MEMBER( excali64_state::crtc_de )
250{
251   m_crtc_de = state;
252}
253
254WRITE_LINE_MEMBER( excali64_state::crtc_vs )
255{
256   m_crtc_vs = state;
257}
258
259DRIVER_INIT_MEMBER( excali64_state, excali64 )
260{
261   m_p_chargen = memregion("chargen")->base();
262   m_p_videoram = memregion("videoram")->base();
263}
264
265MC6845_UPDATE_ROW( excali64_state::update_row )
266{
267   const rgb_t *palette = m_palette->palette()->entry_list_raw();
268   UINT8 chr,gfx;
269   UINT16 mem,x;
270   UINT32 *p = &bitmap.pix32(y);
271
272   for (x = 0; x < x_count; x++)
273   {
274      UINT8 inv=0;
275      if (x == cursor_x) inv=0xff;
276      mem = (ma + x) & 0xfff;
277      chr = m_p_videoram[mem];
278      gfx = m_p_chargen[(chr<<4) | ra] ^ inv;
279
280      /* Display a scanline of a character */
281      *p++ = palette[BIT(gfx, 0)];
282      *p++ = palette[BIT(gfx, 1)];
283      *p++ = palette[BIT(gfx, 2)];
284      *p++ = palette[BIT(gfx, 3)];
285      *p++ = palette[BIT(gfx, 4)];
286      *p++ = palette[BIT(gfx, 5)];
287      *p++ = palette[BIT(gfx, 6)];
288      *p++ = palette[BIT(gfx, 7)];
289   }
290}
291
292static MACHINE_CONFIG_START( excali64, excali64_state )
293   /* basic machine hardware */
294   MCFG_CPU_ADD("maincpu", Z80, XTAL_16MHz / 4)
295   MCFG_CPU_PROGRAM_MAP(excali64_mem)
296   MCFG_CPU_IO_MAP(excali64_io)
297
298   MCFG_DEVICE_ADD("uart", I8251, 0)
299   //MCFG_I8251_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd))
300   //MCFG_I8251_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts))
301
302   MCFG_DEVICE_ADD("pit", PIT8253, 0)
303   MCFG_PIT8253_CLK0(XTAL_16MHz / 16) /* Timer 0: tone gen for speaker */
304   MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("speaker", speaker_sound_device, level_w))
305   MCFG_PIT8253_CLK1(XTAL_16MHz / 8) /* Timer 1: baud rate gen for 8251 */
306   //MCFG_PIT8253_OUT1_HANDLER(WRITELINE(excali64_state, write_uart_clock))
307   //MCFG_PIT8253_CLK2(XTAL_16MHz / 8) /* Timer 2: not used */
308
309   MCFG_DEVICE_ADD("ppi", I8255A, 0 )
310   //MCFG_I8255_IN_PORTA_CB(READ8(excali64_state, ppia_r))
311   //MCFG_I8255_OUT_PORTA_CB(WRITE8(excali64_state, ppia_w)) // parallel port
312   //MCFG_I8255_IN_PORTB_CB(READ8(excali64_state, ppib_r))
313   MCFG_I8255_OUT_PORTB_CB(WRITE8(excali64_state, ppib_w))
314   MCFG_I8255_IN_PORTC_CB(READ8(excali64_state, ppic_r))
315   MCFG_I8255_OUT_PORTC_CB(WRITE8(excali64_state, ppic_w))
316
317   //MCFG_DEVICE_ADD("acia_clock", CLOCK, 153600)
318   //MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(excali64_state, write_acia_clock))
319
320   /* sound hardware */
321   MCFG_SPEAKER_STANDARD_MONO("mono")
322   MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0)
323   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
324   MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette")
325   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
326
327   /* Video hardware */
328   MCFG_SCREEN_ADD("screen", RASTER)
329   MCFG_SCREEN_REFRESH_RATE(50)
330   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
331   MCFG_SCREEN_SIZE(80*8, 25*10)
332   MCFG_SCREEN_VISIBLE_AREA(0, 80*8-1, 0, 25*10-1)
333   MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update)
334   MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette")
335   MCFG_MC6845_ADD("crtc", MC6845, "screen", XTAL_16MHz / 16) // 1MHz for lowres; 2MHz for highres
336   MCFG_MC6845_SHOW_BORDER_AREA(false)
337   MCFG_MC6845_CHAR_WIDTH(8)
338   MCFG_MC6845_UPDATE_ROW_CB(excali64_state, update_row)
339   MCFG_MC6845_OUT_DE_CB(WRITELINE(excali64_state, crtc_de))
340   MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(excali64_state, crtc_vs))
341
342   /* Devices */
343   MCFG_CASSETTE_ADD( "cassette" )
344   MACHINE_CONFIG_END
345
346/* ROM definition */
347ROM_START( excali64 )
348   ROM_REGION(0x10000, "maincpu", 0)
349   ROM_LOAD( "rom_1.bin", 0x0000, 0x4000, CRC(e129a305) SHA1(e43ec7d040c2b2e548d22fd6bbc7df8b45a26e5a) )
350   ROM_LOAD( "rom_2.bin", 0x2000, 0x2000, CRC(916d9f5a) SHA1(91c527cce963481b7bebf077e955ca89578bb553) )
351
352   ROM_REGION(0x2000, "videoram", ROMREGION_ERASE00)
353
354   ROM_REGION(0x1000, "chargen", 0)
355   ROM_LOAD( "genex_3.bin", 0x0000, 0x1000, CRC(b91619a9) SHA1(2ced636cb7b94ba9d329868d7ecf79963cefe9d9) )
356ROM_END
357
358/* Driver */
359
360/*    YEAR  NAME      PARENT  COMPAT   MACHINE    INPUT     CLASS             INIT        COMPANY         FULLNAME        FLAGS */
361COMP( 1984, excali64, 0,      0,       excali64,  excali64, excali64_state, excali64,  "BGR Computers", "Excalibur 64", GAME_IS_SKELETON )
trunk/src/mess/drivers/leapster.c
r242301r242302
224224
225225   UINT32 screen_update_leapster(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
226226   DECLARE_DEVICE_IMAGE_LOAD_MEMBER(leapster_cart);
227   DECLARE_DRIVER_INIT(leapster);
228227
229228protected:
230229   required_device<generic_slot_device> m_cart;
r242301r242302
305304   ROM_LOAD( "am29pl160cb-90sf.bin", 0x00000, 0x200000, BAD_DUMP CRC(dc281f1f) SHA1(17588de54ab3bb82801bd5062f3e6aa687412178) )
306305ROM_END
307306
308DRIVER_INIT_MEMBER(leapster_state,leapster)
309{
310307
311}
312
313CONS(2003,  leapster,    0,         0,  leapster,    leapster, leapster_state, leapster,    "LeapFrog",   "Leapster (Germany)",    GAME_NOT_WORKING | GAME_NO_SOUND | GAME_IS_SKELETON )
314CONS(2005,  leapstertv,  leapster,  0,  leapster,    leapster, leapster_state, leapster,    "LeapFrog",   "Leapster TV (Germany)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_IS_SKELETON )
308CONS(2003,  leapster,    0,         0,  leapster,    leapster, driver_device, 0,    "LeapFrog",   "Leapster (Germany)",    GAME_NOT_WORKING | GAME_NO_SOUND | GAME_IS_SKELETON )
309CONS(2005,  leapstertv,  leapster,  0,  leapster,    leapster, driver_device, 0,    "LeapFrog",   "Leapster TV (Germany)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_IS_SKELETON )
trunk/src/mess/drivers/mathmagi.c
r242301r242302
1// license:BSD-3-Clause
2// copyright-holders:hap
3/***************************************************************************
4
5  APF Mathemagician
6  * TMS1100 MP1030
7 
8***************************************************************************/
9
10#include "emu.h"
11#include "cpu/tms0980/tms0980.h"
12
13#include "mathmagi.lh"
14
15// master clock is a single stage RC oscillator: R=68K, C=82pf,
16// according to the TMS 1000 series data manual this is around 200kHz
17#define MASTER_CLOCK (200000)
18
19
20class mathmagi_state : public driver_device
21{
22public:
23   mathmagi_state(const machine_config &mconfig, device_type type, const char *tag)
24      : driver_device(mconfig, type, tag),
25      m_maincpu(*this, "maincpu"),
26      m_button_matrix(*this, "IN")
27   { }
28
29   required_device<cpu_device> m_maincpu;
30   optional_ioport_array<11> m_button_matrix;
31
32   UINT16 m_o;
33   UINT16 m_r;
34
35   DECLARE_READ8_MEMBER(read_k);
36   DECLARE_WRITE16_MEMBER(write_o);
37   DECLARE_WRITE16_MEMBER(write_r);
38
39   virtual void machine_start();
40};
41
42
43/***************************************************************************
44
45  I/O
46
47***************************************************************************/
48
49READ8_MEMBER(mathmagi_state::read_k)
50{
51   printf("r");
52   
53   UINT8 k = 0;
54
55   // read selected button rows
56   for (int i = 0; i < 11; i++)
57      if (m_r >> i & 1)
58         k |= m_button_matrix[i]->read();
59
60   return k;
61}
62
63WRITE16_MEMBER(mathmagi_state::write_o)
64{
65   m_o = data;
66   
67   printf("\n%02X ",m_o);
68   for (int i=0;i<11;i++) printf("%d",m_r>>(10-i)&1);
69}
70
71WRITE16_MEMBER(mathmagi_state::write_r)
72{
73   m_r = data;
74
75   printf("\n%02X ",m_o);
76   for (int i=0;i<11;i++) printf("%d",m_r>>(10-i)&1);
77}
78
79
80
81/***************************************************************************
82
83  Inputs
84
85***************************************************************************/
86
87/* physical button layout and labels is like this:
88
89    ON     ONE       [SEL] [NXT] [?]   [/]
90     |      |        [7]   [8]   [9]   [x]
91    OFF    TWO       [4]   [5]   [6]   [-]
92         PLAYERS     [1]   [2]   [3]   [+]
93                     [0]   [_]   [r]   [=]
94*/
95
96static INPUT_PORTS_START( mathmagi )
97   PORT_START("IN.0") // R0
98   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1)
99   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2)
100   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3)
101   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4)
102
103   PORT_START("IN.1") // R1
104   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5)
105   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6)
106   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7)
107   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8)
108
109   PORT_START("IN.2") // R2
110   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9)
111   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0)
112   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q)
113   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W)
114
115   PORT_START("IN.3") // R3
116   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E)
117   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R)
118   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T)
119   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y)
120
121   PORT_START("IN.4") // R4
122   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U)
123   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I)
124   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O)
125   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A)
126
127   PORT_START("IN.5") // R5
128   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S)
129   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D)
130   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F)
131   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G)
132
133   PORT_START("IN.6") // R6
134   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H)
135   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J)
136   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K)
137   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L)
138
139   PORT_START("IN.7") // R7
140   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z)
141   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X)
142   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C)
143   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V)
144
145   PORT_START("IN.8") // R8
146   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B)
147   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N)
148   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M)
149   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA)
150
151   PORT_START("IN.9") // R9
152   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD)
153   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD)
154   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD)
155   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD)
156
157   PORT_START("IN.10") // R10
158   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) // 1P/2P switch?
159   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD)
160   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD)
161   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD)
162INPUT_PORTS_END
163
164
165
166/***************************************************************************
167
168  Machine Config
169
170***************************************************************************/
171
172void mathmagi_state::machine_start()
173{
174   m_o = 0;
175   m_r = 0;
176
177   save_item(NAME(m_o));
178   save_item(NAME(m_r));
179}
180
181
182static const UINT16 mathmagi_output_pla[0x20] =
183{
184   /* O output PLA configuration currently unknown */
185   0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
186   0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
187   0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
188   0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f
189};
190
191
192static MACHINE_CONFIG_START( mathmagi, mathmagi_state )
193
194   /* basic machine hardware */
195//   MCFG_CPU_ADD("maincpu", TMS1100, MASTER_CLOCK)
196   MCFG_CPU_ADD("maincpu", TMS1100, 10000) // temp
197   MCFG_TMS1XXX_OUTPUT_PLA(mathmagi_output_pla)
198   MCFG_TMS1XXX_READ_K_CB(READ8(mathmagi_state, read_k))
199   MCFG_TMS1XXX_WRITE_O_CB(WRITE16(mathmagi_state, write_o))
200   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(mathmagi_state, write_r))
201
202   MCFG_DEFAULT_LAYOUT(layout_mathmagi)
203
204   /* no video! */
205
206   /* no sound! */
207MACHINE_CONFIG_END
208
209
210
211/***************************************************************************
212
213  Game driver(s)
214
215***************************************************************************/
216
217ROM_START( mathmagi )
218   ROM_REGION( 0x800, "maincpu", 0 )
219   ROM_LOAD( "mp1030", 0x0000, 0x800, CRC(a81d7ccb) SHA1(4756ce42f1ea28ce5fe6498312f8306f10370969) )
220
221   ROM_REGION( 867, "maincpu:mpla", 0 )
222   ROM_LOAD( "tms1100_default_mpla.pla", 0, 867, BAD_DUMP CRC(62445fc9) SHA1(d6297f2a4bc7a870b76cc498d19dbb0ce7d69fec) ) // not verified
223   ROM_REGION( 365, "maincpu:opla", 0 )
224   ROM_LOAD( "tms1100_mathmagi_opla.pla", 0, 365, NO_DUMP )
225ROM_END
226
227
228COMP( 1980, mathmagi, 0, 0, mathmagi, mathmagi, driver_device, 0, "APF Electronics Inc.", "Mathemagician", GAME_SUPPORTS_SAVE | GAME_NO_SOUND_HW | GAME_NOT_WORKING )
trunk/src/mess/drivers/merlin.c
r242301r242302
3838
3939// master clock is a single stage RC oscillator: R=33K, C=100pf,
4040// according to the TMS 1000 series data manual this is around 350kHz
41#define MASTER_CLOCK (350000)
41#define MERLIN_RC_CLOCK (350000)
4242
4343
4444class merlin_state : public driver_device
r242301r242302
177177static MACHINE_CONFIG_START( merlin, merlin_state )
178178
179179   /* basic machine hardware */
180   MCFG_CPU_ADD("maincpu", TMS1100, MASTER_CLOCK)
180   MCFG_CPU_ADD("maincpu", TMS1100, MERLIN_RC_CLOCK)
181181   MCFG_TMS1XXX_OUTPUT_PLA(merlin_output_pla)
182   MCFG_TMS1XXX_READ_K_CB(READ8(merlin_state, read_k))
183   MCFG_TMS1XXX_WRITE_O_CB(WRITE16(merlin_state, write_o))
184   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(merlin_state, write_r))
182   MCFG_TMS1XXX_READ_K_CB(READ8( merlin_state, read_k))
183   MCFG_TMS1XXX_WRITE_O_CB(WRITE16( merlin_state, write_o))
184   MCFG_TMS1XXX_WRITE_R_CB(WRITE16( merlin_state, write_r))
185185
186186   MCFG_DEFAULT_LAYOUT(layout_merlin)
187187
trunk/src/mess/drivers/microvsn.c
r242301r242302
496496   /* O output PLA configuration currently unknown */
497497   0x00, 0x08, 0x04, 0x0C, 0x02, 0x0A, 0x06, 0x0E,
498498   0x01, 0x09, 0x05, 0x0D, 0x03, 0x0B, 0x07, 0x0F,
499   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
500   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
499   0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00,
500   0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00
501501};
502502
503503
r242301r242302
507507   /* Reversed bit order */
508508   0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
509509   0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
510   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
511   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
510   0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00,
511   0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00
512512};
513513
514514
trunk/src/mess/drivers/simon.c
r242301r242302
2525
2626// master clock is a single stage RC oscillator: R=33K, C=100pf,
2727// according to the TMS 1000 series data manual this is around 350kHz
28#define MASTER_CLOCK (350000)
28#define SIMON_RC_CLOCK (350000)
2929
3030
3131class simon_state : public driver_device
r242301r242302
151151static MACHINE_CONFIG_START( simon, simon_state )
152152
153153   /* basic machine hardware */
154   MCFG_CPU_ADD("maincpu", TMS1000, MASTER_CLOCK)
154   MCFG_CPU_ADD("maincpu", TMS1000, SIMON_RC_CLOCK)
155155   MCFG_TMS1XXX_READ_K_CB(READ8(simon_state, read_k))
156156   MCFG_TMS1XXX_WRITE_O_CB(WRITE16(simon_state, write_o))
157157   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(simon_state, write_r))
trunk/src/mess/drivers/starwbc.c
r242301r242302
99  press BASIC/INTER/ADV and enter P#(number of players), then
1010  START TURN. Refer to the official manual for more information.
1111
12
13  TODO:
14  - MCU clock is unknown
15
1216***************************************************************************/
1317
1418#include "emu.h"
r242301r242302
1721
1822#include "starwbc.lh"
1923
20// master clock is a single stage RC oscillator: R=51K, C=47pf,
21// according to the TMS 1000 series data manual this is around 350kHz
24// master clock is unknown, the value below is an approximation
25// (patent says R=51K, C=47pf, but then it sounds too low pitched)
2226#define MASTER_CLOCK (350000)
2327
2428
r242301r242302
226230
227231void starwbc_state::machine_start()
228232{
229   // zerofill
230233   memset(m_leds_state, 0, sizeof(m_leds_state));
231234   memset(m_leds_cache, 0, sizeof(m_leds_cache));
232235   memset(m_leds_decay, 0, sizeof(m_leds_decay));
233
234236   m_r = 0;
235237   m_o = 0;
236238   
237   // register for savestates
238239   save_item(NAME(m_leds_state));
239240   save_item(NAME(m_leds_cache));
240241   save_item(NAME(m_leds_decay));
241
242242   save_item(NAME(m_r));
243243   save_item(NAME(m_o));
244244}
trunk/src/mess/drivers/stopthie.c
r242301r242302
1111
1212
1313  TODO:
14  - ON/OFF button callbacks
1415  - MCU clock is unknown
1516  - stopthiep: unable to start a game (may be intentional?)
1617
r242301r242302
4142   required_device<speaker_sound_device> m_speaker;
4243
4344   UINT16 m_o;
44   bool m_power;
4545
4646   UINT16 m_leds_state[0x10];
4747   UINT16 m_leds_cache[0x10];
r242301r242302
5151   DECLARE_WRITE16_MEMBER(write_o);
5252   DECLARE_WRITE16_MEMBER(write_r);
5353
54   DECLARE_INPUT_CHANGED_MEMBER(power_button);
55   DECLARE_WRITE_LINE_MEMBER(auto_power_off);
56
5754   TIMER_DEVICE_CALLBACK_MEMBER(leds_decay_tick);
5855   void leds_update();
5956
60   virtual void machine_reset();
6157   virtual void machine_start();
6258};
6359
r242301r242302
9288            m_leds_decay[di] = LEDS_DECAY_TIME;
9389         
9490         // determine active state
95         int ds = (m_power && m_leds_decay[di] != 0) ? 1 : 0;
91         int ds = (m_leds_decay[di] != 0) ? 1 : 0;
9692         active_state[i] |= (ds << j);
9793      }
9894   }
r242301r242302
168164
169165***************************************************************************/
170166
171INPUT_CHANGED_MEMBER(stopthief_state::power_button)
172{
173   m_power = (bool)(FPTR)param;
174   m_maincpu->set_input_line(INPUT_LINE_RESET, m_power ? CLEAR_LINE : ASSERT_LINE);
175}
176
177167/* physical button layout and labels is like this:
178168
179169    [1] [2] [OFF]
r242301r242302
200190
201191   // note: even though power buttons are on the matrix, they are not CPU-controlled
202192   PORT_START("IN.2") // Vss!
203   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_NAME("On") PORT_CHANGED_MEMBER(DEVICE_SELF, stopthief_state, power_button, (void *)true)
193   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_NAME("On")
204194   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_NAME("Tip")
205195   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_NAME("Arrest")
206196   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_NAME("Clue")
207   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") PORT_CHANGED_MEMBER(DEVICE_SELF, stopthief_state, power_button, (void *)false)
197   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off")
208198INPUT_PORTS_END
209199
210200
r242301r242302
215205
216206***************************************************************************/
217207
218WRITE_LINE_MEMBER(stopthief_state::auto_power_off)
219{
220   // TMS0980 auto power-off opcode
221   if (state)
222   {
223      m_power = false;
224      m_maincpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
225   }
226}
227
228
229void stopthief_state::machine_reset()
230{
231   m_power = true;
232}
233
234208void stopthief_state::machine_start()
235209{
236   // zerofill
237210   memset(m_leds_state, 0, sizeof(m_leds_state));
238211   memset(m_leds_cache, 0, sizeof(m_leds_cache));
239212   memset(m_leds_decay, 0, sizeof(m_leds_decay));
240
241213   m_o = 0;
242   m_power = false;
243214
244   // register for savestates
245215   save_item(NAME(m_leds_state));
246216   save_item(NAME(m_leds_cache));
247217   save_item(NAME(m_leds_decay));
248
249218   save_item(NAME(m_o));
250   save_item(NAME(m_power));
251219}
252220
253221
r242301r242302
258226   MCFG_TMS1XXX_READ_K_CB(READ8(stopthief_state, read_k))
259227   MCFG_TMS1XXX_WRITE_O_CB(WRITE16(stopthief_state, write_o))
260228   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(stopthief_state, write_r))
261   MCFG_TMS1XXX_POWER_OFF_CB(WRITELINE(stopthief_state, auto_power_off))
262229
263230   MCFG_TIMER_DRIVER_ADD_PERIODIC("leds_decay", stopthief_state, leds_decay_tick, attotime::from_msec(10))
264231   
trunk/src/mess/drivers/ticalc1x.c
r242301r242302
88
99 
1010  TODO:
11  - ON/OFF button callbacks, and support OFF callback from the 0980
1112  - MCU clocks are unknown
1213
1314***************************************************************************/
r242301r242302
3536
3637   UINT16 m_r;
3738   UINT16 m_o;
38   bool m_power;
3939
4040   UINT16 m_leds_state[0x10];
4141   UINT16 m_leds_cache[0x10];
r242301r242302
5858   DECLARE_WRITE16_MEMBER(ti30_write_o);
5959   DECLARE_WRITE16_MEMBER(ti30_write_r);
6060
61   DECLARE_INPUT_CHANGED_MEMBER(power_button);
62   DECLARE_WRITE_LINE_MEMBER(auto_power_off);
63
6461   TIMER_DEVICE_CALLBACK_MEMBER(leds_decay_tick);
6562   void leds_update();
6663
67   virtual void machine_reset();
6864   virtual void machine_start();
6965};
7066
r242301r242302
9995            m_leds_decay[di] = LEDS_DECAY_TIME;
10096         
10197         // determine active state
102         int ds = (m_power && m_leds_decay[di] != 0) ? 1 : 0;
98         int ds = (m_leds_decay[di] != 0) ? 1 : 0;
10399         active_state[i] |= (ds << j);
104100      }
105101   }
r242301r242302
107103   // on difference, send to output
108104   for (int i = 0; i < 0x10; i++)
109105      if (m_leds_cache[i] != active_state[i])
110      {
111106         output_set_digit_value(i, active_state[i]);
112         
113         for (int j = 0; j < 8; j++)
114            output_set_lamp_value(i*10 + j, active_state[i] >> j & 1);
115      }
116
107   
117108   memcpy(m_leds_cache, active_state, sizeof(m_leds_cache));
118109}
119110
r242301r242302
230221WRITE16_MEMBER(ticalc1x_state::wizatron_write_r)
231222{
232223   // R0-R8: select digit (right-to-left)
233   // note: 3rd digit is custom(not 7seg), for math symbols
234224   for (int i = 0; i < 9; i++)
235225      m_leds_state[i] = (data >> i & 1) ? m_o : 0;
236226   
227   // 3rd digit has more segments, for math symbols
228   // let's assume it's a 14-seg led
229   m_leds_state[6] = BITSWAP16(m_leds_state[6],15,14,2,1,6,4,3,0,5,5,11,10,9,13,12,8);
230   
237231   // 6th digit only has A and G for =
238232   m_leds_state[3] &= 0x41;
239233
r242301r242302
294288
295289***************************************************************************/
296290
297INPUT_CHANGED_MEMBER(ticalc1x_state::power_button)
298{
299   m_power = (bool)(FPTR)param;
300   m_maincpu->set_input_line(INPUT_LINE_RESET, m_power ? CLEAR_LINE : ASSERT_LINE);
301}
302
303291static INPUT_PORTS_START( tisr16 )
304292   PORT_START("IN.0") // R0
305293   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
r242301r242302
493481
494482   // note: even though power buttons are on the matrix, they are not CPU-controlled
495483   PORT_START("IN.8") // Vss!
496   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_CODE(KEYCODE_DEL) PORT_NAME("ON/C") PORT_CHANGED_MEMBER(DEVICE_SELF, ticalc1x_state, power_button, (void *)true)
484   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_CODE(KEYCODE_DEL) PORT_NAME("ON/C")
497485   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_NAME("1/x")
498486   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_NAME(UTF8_SQUAREROOT"x")
499487   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_NAME("x"UTF8_POW_2)
500   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("OFF") PORT_CHANGED_MEMBER(DEVICE_SELF, ticalc1x_state, power_button, (void *)false)
488   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("OFF")
501489INPUT_PORTS_END
502490
503491
r242301r242302
556544
557545   // note: even though power buttons are on the matrix, they are not CPU-controlled
558546   PORT_START("IN.8") // Vss!
559   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL) PORT_CODE(KEYCODE_PGUP) PORT_NAME("C/ON") PORT_CHANGED_MEMBER(DEVICE_SELF, ticalc1x_state, power_button, (void *)true)
547   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL) PORT_CODE(KEYCODE_PGUP) PORT_NAME("C/ON")
560548   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_NAME("DEC")
561549   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_NAME("OCT")
562550   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_NAME("HEX")
563   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("OFF") PORT_CHANGED_MEMBER(DEVICE_SELF, ticalc1x_state, power_button, (void *)false)
551   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("OFF")
564552INPUT_PORTS_END
565553
566554
r242301r242302
620608
621609   // note: even though power buttons are on the matrix, they are not CPU-controlled
622610   PORT_START("IN.8") // Vss!
623   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_CODE(KEYCODE_DEL) PORT_NAME("ON/C") PORT_CHANGED_MEMBER(DEVICE_SELF, ticalc1x_state, power_button, (void *)true)
611   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_CODE(KEYCODE_DEL) PORT_NAME("ON/C")
624612   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_NAME("2nd")
625613   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_NAME("x"UTF8_POW_2"  "UTF8_SQUAREROOT"x")
626614   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_NAME("ln(x)  e"UTF8_POW_X)
627   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("OFF") PORT_CHANGED_MEMBER(DEVICE_SELF, ticalc1x_state, power_button, (void *)false)
615   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("OFF")
628616INPUT_PORTS_END
629617
630618
r242301r242302
635623
636624***************************************************************************/
637625
638WRITE_LINE_MEMBER(ticalc1x_state::auto_power_off)
639{
640   // TMS0980 auto power-off opcode
641   if (state)
642   {
643      m_power = false;
644      m_maincpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
645   }
646}
647
648
649void ticalc1x_state::machine_reset()
650{
651   m_power = true;
652}
653
654626void ticalc1x_state::machine_start()
655627{
656   // zerofill
657628   memset(m_leds_state, 0, sizeof(m_leds_state));
658629   memset(m_leds_cache, 0, sizeof(m_leds_cache));
659630   memset(m_leds_decay, 0, sizeof(m_leds_decay));
660
661631   m_r = 0;
662632   m_o = 0;
663   m_power = false;
664633
665   // register for savestates
666634   save_item(NAME(m_leds_state));
667635   save_item(NAME(m_leds_cache));
668636   save_item(NAME(m_leds_decay));
669
670637   save_item(NAME(m_r));
671638   save_item(NAME(m_o));
672   save_item(NAME(m_power));
673639}
674640
675641
r242301r242302
725691   MCFG_TMS1XXX_READ_K_CB(READ8(ticalc1x_state, ti30_read_k))
726692   MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ticalc1x_state, ti30_write_o))
727693   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ticalc1x_state, ti30_write_r))
728   MCFG_TMS1XXX_POWER_OFF_CB(WRITELINE(ticalc1x_state, auto_power_off))
729694
730695   MCFG_DEFAULT_LAYOUT(layout_ti30)
731696MACHINE_CONFIG_END
trunk/src/mess/drivers/victor9k.c
r242301r242302
2222    - floppy 8048
2323    - keyboard
2424    - hires graphics
25    - character attributes
2526    - brightness/contrast
2627    - MC6852
2728    - codec sound
r242301r242302
107108         UINT32 char_ram_addr = (BIT(ma, 12) << 16) | ((code & 0xff) << 5) | (ra << 1);
108109         UINT16 data = program.read_word(char_ram_addr);
109110
110         if (code & CODE_REVERSE_VIDEO) data ^= 0xffff;
111         if (code & CODE_NON_DISPLAY) data = 0;
112         if (sx == cursor_x) data = 0xffff;
113
114111         for (int x = 0; x <= 10; x++)
115112         {
116            int pixel = BIT(data, x);
117            int color = palette[pixel && de];
118            if (!(code & CODE_LOW_INTENSITY) && color) color = 2;
113            int color = BIT(data, x);
119114
120            bitmap.pix32(vbp + y, hbp + x + sx*10) = color;
115            if (sx == cursor_x) color = 1;
116
117            bitmap.pix32(vbp + y, hbp + x + sx*10) = palette[color && de];
121118         }
122119
123120         video_ram_addr += 2;
r242301r242302
398395   // memory banking
399396   address_space &program = m_maincpu->space(AS_PROGRAM);
400397   program.install_ram(0x00000, m_ram->size() - 1, m_ram->pointer());
401
402   // patch out SCP self test
403   m_rom->base()[0x11ab] = 0xc3;
404
405   // patch out ROM checksum error
406   m_rom->base()[0x1d51] = 0x90;
407   m_rom->base()[0x1d52] = 0x90;
408   m_rom->base()[0x1d53] = 0x90;
409   m_rom->base()[0x1d54] = 0x90;
410398}
411399
412400void victor9k_state::machine_reset()
r242301r242302
444432   MCFG_SCREEN_SIZE(640, 480)
445433   MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
446434
447   MCFG_PALETTE_ADD_MONOCHROME_GREEN_HIGHLIGHT("palette")
435   MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette")
448436
449437   MCFG_MC6845_ADD(HD46505S_TAG, HD6845, SCREEN_TAG, 1000000) // HD6845 == HD46505S
450438   MCFG_MC6845_SHOW_BORDER_AREA(true)
trunk/src/mess/drivers/vii.c
r242301r242302
12141214   ROM_LOAD16_WORD_SWAP( "bios german.bin", 0x000000, 0x200000, CRC(205c5296) SHA1(7fbcf761b5885c8b1524607aabaf364b4559c8cc) )
12151215ROM_END
12161216
1217ROM_START( vsmilef )
1218   ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASEFF )      /* dummy region for u'nSP */
1219   ROM_LOAD16_WORD_SWAP( "sysrom_france", 0x000000, 0x200000, CRC(0cd0bdf5) SHA1(5c8d1eada1b6b545555b8d2b09325d7127681af8) )
1220ROM_END
1221
12221217ROM_START( walle )
12231218   ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASEFF )      /* dummy region for u'nSP */
12241219   ROM_LOAD16_WORD_SWAP( "walle.bin", 0x000000, 0x400000, BAD_DUMP CRC(bd554cba) SHA1(6cd06a036ab12e7b0e1fd8003db873b0bb783868) )
r242301r242302
12291224/*    YEAR  NAME      PARENT    COMPAT    MACHINE   INPUT     INIT      COMPANY                                              FULLNAME      FLAGS */
12301225CONS( 2004, batmantv, vii,      0,        batman,   batman, vii_state,   batman,   "JAKKS Pacific Inc / HotGen Ltd",                    "The Batman", GAME_NO_SOUND )
12311226CONS( 2005, vsmile,   0,        0,        vsmile,   vsmile, vii_state,   vsmile,   "V-Tech",                                            "V-Smile (Germany)",    GAME_NO_SOUND | GAME_NOT_WORKING )
1232CONS( 2005, vsmilef,  vsmile,   0,        vsmile,   vsmile, vii_state,   vsmile,   "V-Tech",                                            "V-Smile (France)",    GAME_NO_SOUND | GAME_NOT_WORKING )
12331227CONS( 2007, vii,      0,        0,        vii,      vii, vii_state,      vii,      "Jungle Soft / KenSingTon / Chintendo / Siatronics", "Vii",        GAME_NO_SOUND )
12341228CONS( 2008, walle,    vii,      0,        batman,   walle, vii_state,    walle,    "JAKKS Pacific Inc",                                 "Wall-E",     GAME_NO_SOUND )
trunk/src/mess/includes/victor9k.h
r242301r242302
7171      m_rs232a(*this, RS232_A_TAG),
7272      m_rs232b(*this, RS232_B_TAG),
7373      m_palette(*this, "palette"),
74      m_rom(*this, I8088_TAG),
7574      m_video_ram(*this, "video_ram"),
7675      m_brt(0),
7776      m_cont(0),
r242301r242302
9897   required_device<rs232_port_device> m_rs232a;
9998   required_device<rs232_port_device> m_rs232b;
10099   required_device<palette_device> m_palette;
101   required_memory_region m_rom;
102100   required_shared_ptr<UINT8> m_video_ram;
103101
104102   virtual void machine_start();
trunk/src/mess/layout/mathmagi.lay
r242301r242302
1<?xml version="1.0"?>
2<mamelayout version="2">
3
4<!-- note: the PLUS sign is supposed to be lop sided like that -->
5
6<!-- define elements -->
7
8   <element name="digit" defstate="0">
9      <led7seg><color red="1.0" green="0.3" blue="0.2" /></led7seg>
10   </element>
11
12   <element name="lamp_dot" defstate="0">
13      <disk state="1"><color red="1.0" green="0.3" blue="0.2" /></disk>
14      <disk state="0"><color red="0.125490" green="0.035294" blue="0.0235294" /></disk>
15   </element>
16   <element name="lamp_dash" defstate="0">
17      <rect state="1"><color red="1.0" green="0.3" blue="0.2" /></rect>
18      <rect state="0"><color red="0.125490" green="0.035294" blue="0.0235294" /></rect>
19   </element>
20   <element name="lamp_slash" defstate="0">
21      <text string="/" state="1"><color red="1.0" green="0.3" blue="0.2" /></text>
22      <text string="/" state="0"><color red="0.125490" green="0.035294" blue="0.0235294" /></text>
23   </element>
24   <element name="lamp_backslash" defstate="0">
25      <text string="\" state="1"><color red="1.0" green="0.3" blue="0.2" /></text>
26      <text string="\" state="0"><color red="0.125490" green="0.035294" blue="0.0235294" /></text>
27   </element>
28
29
30
31<!-- build screen -->
32
33   <view name="Internal Layout">
34      <bounds left="0" right="100" top="0" bottom="15" />
35
36      <bezel name="digit0" element="digit">
37         <bounds x="0" y="0" width="10" height="15" />
38      </bezel>
39      <bezel name="digit1" element="digit">
40         <bounds x="10" y="0" width="10" height="15" />
41      </bezel>
42
43      <bezel name="digit2" element="digit">
44         <bounds x="30" y="0" width="10" height="15" />
45      </bezel>
46      <bezel name="digit3" element="digit">
47         <bounds x="40" y="0" width="10" height="15" />
48      </bezel>
49
50      <bezel name="digit4" element="digit">
51         <bounds x="60" y="0" width="10" height="15" />
52      </bezel>
53      <bezel name="digit5" element="digit">
54         <bounds x="70" y="0" width="10" height="15" />
55      </bezel>
56      <bezel name="digit6" element="digit">
57         <bounds x="80" y="0" width="10" height="15" />
58      </bezel>
59      <bezel name="digit7" element="digit">
60         <bounds x="90" y="0" width="10" height="15" />
61      </bezel>
62
63<!-- math symbols custom digit -->
64
65      <bezel name="lamp65" element="lamp_dash"><bounds x="21.5" y="7.25" width="7" height="0.5" /></bezel>
66
67      <bezel name="lamp61" element="lamp_slash"><bounds x="24" y="-0.5" width="5" height="7.5" /></bezel>
68      <bezel name="lamp64" element="lamp_slash"><bounds x="21" y="7" width="5" height="7.5" /></bezel>
69
70      <bezel name="lamp66" element="lamp_backslash"><bounds x="21" y="-0.5" width="5" height="7.5" /></bezel>
71      <bezel name="lamp62" element="lamp_backslash"><bounds x="24" y="7" width="5" height="7.5" /></bezel>
72
73      <bezel name="lamp60" element="lamp_dot"><bounds x="24.25" y="2.25" width="1.5" height="1.5" /></bezel>
74      <bezel name="lamp63" element="lamp_dot"><bounds x="24.25" y="11.75" width="1.5" height="1.5" /></bezel>
75
76<!-- equals sign custom digit -->
77
78
79   </view>
80</mamelayout>
trunk/src/mess/layout/wizatron.lay
r242301r242302
22<mamelayout version="2">
33
44<!-- note: the digits were very small, wide space between them, and not the same style as (MAME's-)default -->
5<!-- note 2: the PLUS sign is supposed to be lop sided like that (theoretically, this could have been avoided) -->
6<!-- note 3: the EQUALS sign digit is lower than the others, 1st version had it on the same height level -->
5<!-- note 2: yes, the PLUS sign is supposed to be lopsided like that -->
6<!-- note 3: yes, the EQUALS sign is supposed to be that high up, but newer releases improved this -->
77
8<!-- define elements -->
8   <element name="static_black">
9      <rect><color red="0.0" green="0.0" blue="0.0" /></rect>
10   </element>
911
1012   <element name="digit" defstate="0">
1113      <led7seg><color red="1.0" green="0.3" blue="0.2" /></led7seg>
1214   </element>
13
14   <element name="lamp_dot" defstate="0">
15      <disk state="1"><color red="1.0" green="0.3" blue="0.2" /></disk>
16      <disk state="0"><color red="0.125490" green="0.035294" blue="0.0235294" /></disk>
15   <element name="digit14" defstate="0">
16      <led14seg><color red="1.0" green="0.3" blue="0.2" /></led14seg>
1717   </element>
18   <element name="lamp_dash" defstate="0">
19      <rect state="1"><color red="1.0" green="0.3" blue="0.2" /></rect>
20      <rect state="0"><color red="0.125490" green="0.035294" blue="0.0235294" /></rect>
21   </element>
22   <element name="lamp_slash" defstate="0">
23      <text string="/" state="1"><color red="1.0" green="0.3" blue="0.2" /></text>
24      <text string="/" state="0"><color red="0.125490" green="0.035294" blue="0.0235294" /></text>
25   </element>
26   <element name="lamp_backslash" defstate="0">
27      <text string="\" state="1"><color red="1.0" green="0.3" blue="0.2" /></text>
28      <text string="\" state="0"><color red="0.125490" green="0.035294" blue="0.0235294" /></text>
29   </element>
3018
3119
32
33<!-- build screen -->
34
3520   <view name="Internal Layout">
3621      <bounds left="0" right="90" top="0" bottom="15" />
3722
r242301r242302
4126      <bezel name="digit7" element="digit">
4227         <bounds x="10" y="0" width="10" height="15" />
4328      </bezel>
44
29      <bezel name="digit6" element="digit14">
30         <bounds x="20" y="0" width="10" height="15" />
31      </bezel>
4532      <bezel name="digit5" element="digit">
4633         <bounds x="30" y="0" width="10" height="15" />
4734      </bezel>
r242301r242302
4936         <bounds x="40" y="0" width="10" height="15" />
5037      </bezel>
5138      <bezel name="digit3" element="digit">
52         <bounds x="50" y="3.5" width="10" height="15" />
39         <bounds x="50" y="0" width="10" height="15" />
5340      </bezel>
5441      <bezel name="digit2" element="digit">
5542         <bounds x="60" y="0" width="10" height="15" />
r242301r242302
6148         <bounds x="80" y="0" width="10" height="15" />
6249      </bezel>
6350
64<!-- math symbols custom digit -->
51<!-- mask out DIVIDE sign -->
6552
66      <bezel name="lamp65" element="lamp_dash"><bounds x="21.5" y="7.25" width="7" height="0.5" /></bezel>
53      <bezel element="static_black">
54         <bounds x="24.5" y="1.80" width="1.8" height="2.00" />
55      </bezel>
56      <bezel element="static_black">
57         <bounds x="24.3" y="5.1" width="1.75" height="1.3" />
58      </bezel>
6759
68      <bezel name="lamp61" element="lamp_slash"><bounds x="24" y="-0.5" width="5" height="7.5" /></bezel>
69      <bezel name="lamp64" element="lamp_slash"><bounds x="21" y="7" width="5" height="7.5" /></bezel>
60      <bezel element="static_black">
61         <bounds x="23.75" y="11.25" width="1.8" height="2.00" />
62      </bezel>
63      <bezel element="static_black">
64         <bounds x="23.95" y="8.65" width="1.75" height="1.3" />
65      </bezel>
7066
71      <bezel name="lamp66" element="lamp_backslash"><bounds x="21" y="-0.5" width="5" height="7.5" /></bezel>
72      <bezel name="lamp62" element="lamp_backslash"><bounds x="24" y="7" width="5" height="7.5" /></bezel>
73
74      <bezel name="lamp60" element="lamp_dot"><bounds x="24.25" y="2.25" width="1.5" height="1.5" /></bezel>
75      <bezel name="lamp63" element="lamp_dot"><bounds x="24.25" y="11.75" width="1.5" height="1.5" /></bezel>
76
7767   </view>
7868</mamelayout>
trunk/src/mess/machine/super80.c
r242301r242302
2525   m_key_pressed = 3;
2626
2727   return data;
28}
28};
2929
3030/**************************** CASSETTE ROUTINES *****************************************************************/
3131
trunk/src/mess/machine/victor9k_fdc.c
r242301r242302
3535   - communication error with SCP after loading boot sector
3636      - bp ff1a8
3737      - patch ff1ab=c3
38    - single/double sided jumper
39    - header sync length unknown (6 is too short)
38   - sync counter errors
39      - FF if sync byte counter loaded to 10
40      - 11 if sync byte counter loaded to 9
4041    - 8048 spindle speed control
42    - write logic
4143
4244*/
4345
r242301r242302
5860#define M6522_5_TAG     "1k"
5961#define M6522_6_TAG     "1h"
6062
61// this is exactly the same decode/encode as used in the Commodore 4040/8050 series drives
63// this is exactly the same decode as used in the Commodore 4040/8050 series drives
6264#define GCR_DECODE(_e, _i) \
6365    ((BIT(_e, 6) << 7) | (BIT(_i, 7) << 6) | (_e & 0x33) | (BIT(_e, 2) << 3) | (_i & 0x04))
6466
65// E7 E6 I7 E5 E4 E3 E2 I2 E1 E0
66#define GCR_ENCODE(_e, _i) \
67    ((_e & 0xc0) << 2 | (_i & 0x80) | (_e & 0x3c) << 1 | (_i & 0x04) | (_e & 0x03))
68
6967// Tandon TM-100 spindle @ 300RPM, measured TACH 12VAC 256Hz
7068// TACH = RPM / 60 * SPINDLE RATIO * MOTOR POLES
7169// 256 = 300 / 60 * 6.4 * 8
r242301r242302
796794
797795   */
798796
799   if (LOG_VIA) logerror("%s %s WD %02x\n", machine().time().as_string(), machine().describe_context(), data);
800
801797   if (m_wd != data)
802798   {
803799      live_sync();
804800      m_wd = cur_live.wd = data;
801      if (LOG_VIA) logerror("%s %s WD %02x\n", machine().time().as_string(), machine().describe_context(), data);
805802      checkpoint();
806803      live_run();
807804   }
r242301r242302
934931   // door A sense
935932   data |= (m_floppy0->exists() ? 0 : 1) << 4;
936933
937   // single/double sided jumper
938   //data |= 0x20;
934   // single/double sided
935   data |= (m_drive ? m_floppy1->twosid_r() : m_floppy0->twosid_r()) << 5;
939936
940937   return data;
941938}
r242301r242302
1000997      checkpoint();
1001998      if (LOG_VIA) logerror("%s %s DRW %u\n", machine().time().as_string(), machine().describe_context(), state);
1002999      if (state) {
1003         pll_stop_writing(get_floppy(), machine().time());
1000         stop_writing(machine().time());
10041001      } else {
1005         pll_start_writing(machine().time());
1002         start_writing(machine().time());
10061003      }
10071004      live_run();
10081005   }
r242301r242302
10821079   cur_pll.set_clock(clock);
10831080}
10841081
1085void victor_9000_fdc_t::pll_start_writing(const attotime &tm)
1082void victor_9000_fdc_t::pll_save_checkpoint()
10861083{
1087   cur_pll.start_writing(tm);
1084   checkpoint_pll = cur_pll;
10881085}
10891086
1090void victor_9000_fdc_t::pll_commit(floppy_image_device *floppy, const attotime &tm)
1087void victor_9000_fdc_t::pll_retrieve_checkpoint()
10911088{
1092   cur_pll.commit(floppy, tm);
1089   cur_pll = checkpoint_pll;
10931090}
10941091
1095void victor_9000_fdc_t::pll_stop_writing(floppy_image_device *floppy, const attotime &tm)
1092void victor_9000_fdc_t::checkpoint()
10961093{
1097   cur_pll.stop_writing(floppy, tm);
1094   checkpoint_live = cur_live;
1095   pll_save_checkpoint();
10981096}
10991097
1100void victor_9000_fdc_t::pll_save_checkpoint()
1098void victor_9000_fdc_t::rollback()
11011099{
1102   checkpoint_pll = cur_pll;
1100   cur_live = checkpoint_live;
1101   pll_retrieve_checkpoint();
11031102}
11041103
1105void victor_9000_fdc_t::pll_retrieve_checkpoint()
1104void victor_9000_fdc_t::start_writing(const attotime &tm)
11061105{
1107   cur_pll = checkpoint_pll;
1106   cur_live.write_start_time = tm;
1107   cur_live.write_position = 0;
11081108}
11091109
1110int victor_9000_fdc_t::pll_get_next_bit(attotime &tm, floppy_image_device *floppy, const attotime &limit)
1110void victor_9000_fdc_t::stop_writing(const attotime &tm)
11111111{
1112   return cur_pll.get_next_bit(tm, floppy, limit);
1112   commit(tm);
1113   cur_live.write_start_time = attotime::never;
11131114}
11141115
1115bool victor_9000_fdc_t::pll_write_next_bit(bool bit, attotime &tm, floppy_image_device *floppy, const attotime &limit)
1116bool victor_9000_fdc_t::write_next_bit(bool bit, const attotime &limit)
11161117{
1117   return cur_pll.write_next_bit_prev_cell(bit, tm, floppy, limit);
1118   if(cur_live.write_start_time.is_never()) {
1119      cur_live.write_start_time = cur_live.tm;
1120      cur_live.write_position = 0;
1121   }
1122
1123   attotime etime = cur_live.tm + m_period;
1124   if(etime > limit)
1125      return true;
1126
1127   if(bit && cur_live.write_position < ARRAY_LENGTH(cur_live.write_buffer))
1128      cur_live.write_buffer[cur_live.write_position++] = cur_live.tm;
1129
1130   if (LOG) logerror("%s write bit %u (%u)\n", cur_live.tm.as_string(), cur_live.bit_counter, bit);
1131
1132   return false;
11181133}
11191134
1120void victor_9000_fdc_t::checkpoint()
1135void victor_9000_fdc_t::commit(const attotime &tm)
11211136{
1122   pll_commit(get_floppy(), cur_live.tm);
1123   checkpoint_live = cur_live;
1124   pll_save_checkpoint();
1125}
1137   if(cur_live.write_start_time.is_never() || tm == cur_live.write_start_time || !cur_live.write_position)
1138      return;
11261139
1127void victor_9000_fdc_t::rollback()
1128{
1129   cur_live = checkpoint_live;
1130   pll_retrieve_checkpoint();
1140   if (LOG) logerror("%s committing %u transitions since %s\n", tm.as_string(), cur_live.write_position, cur_live.write_start_time.as_string());
1141
1142   if(get_floppy())
1143      get_floppy()->write_flux(cur_live.write_start_time, tm, cur_live.write_position, cur_live.write_buffer);
1144
1145   cur_live.write_start_time = tm;
1146   cur_live.write_position = 0;
11311147}
11321148
11331149void victor_9000_fdc_t::live_delay(int state)
r242301r242302
11451161      if(cur_live.tm > machine().time()) {
11461162         rollback();
11471163         live_run(machine().time());
1148         pll_commit(get_floppy(), cur_live.tm);
1164         commit(cur_live.tm);
11491165      } else {
1150         pll_commit(get_floppy(), cur_live.tm);
1166         commit(cur_live.tm);
11511167         if(cur_live.next_state != -1) {
11521168            cur_live.state = cur_live.next_state;
11531169            cur_live.next_state = -1;
11541170         }
11551171         if(cur_live.state == IDLE) {
1156            pll_stop_writing(get_floppy(), cur_live.tm);
1172            stop_writing(cur_live.tm);
11571173            cur_live.tm = attotime::never;
11581174         }
11591175      }
r242301r242302
11691185      live_run(machine().time());
11701186   }
11711187
1172   pll_stop_writing(get_floppy(), cur_live.tm);
1188   stop_writing(cur_live.tm);
11731189
11741190   cur_live.tm = attotime::never;
11751191   cur_live.state = IDLE;
r242301r242302
11991215            return;
12001216
12011217         // read bit
1202         int bit = pll_get_next_bit(cur_live.tm, get_floppy(), limit);
1218         int bit = get_next_bit(cur_live.tm, limit);
12031219         if(bit < 0)
12041220            return;
12051221
r242301r242302
12111227         int sync = !(cur_live.shift_reg == 0x3ff);
12121228
12131229         // bit counter
1214         if (cur_live.drw) {
1215            if (!sync) {
1216               cur_live.bit_counter = 0;
1217            } else if (cur_live.sync) {
1218               cur_live.bit_counter++;
1219               if (cur_live.bit_counter == 10) {
1220                  cur_live.bit_counter = 0;
1221               }
1222            }
1223         } else {
1230         if (!sync) {
1231            cur_live.bit_counter = 0;
1232         } else if (cur_live.sync) {
12241233            cur_live.bit_counter++;
12251234            if (cur_live.bit_counter == 10) {
12261235               cur_live.bit_counter = 0;
r242301r242302
12301239         // sync counter
12311240         if (sync) {
12321241            cur_live.sync_bit_counter = 0;
1233            cur_live.sync_byte_counter = 10; // TODO 9 in schematics
1242            cur_live.sync_byte_counter = 9;
12341243         } else if (!cur_live.sync) {
12351244            cur_live.sync_bit_counter++;
12361245            if (cur_live.sync_bit_counter == 10) {
r242301r242302
12471256
12481257         // GCR decoder
12491258         if (cur_live.drw) {
1250            cur_live.i = cur_live.shift_reg;
1259            cur_live.i = cur_live.drw << 10 | cur_live.shift_reg;
12511260         } else {
1252            cur_live.i = 0x200 | ((cur_live.wd & 0xf0) << 1) | cur_live.wrsync << 4 | (cur_live.wd & 0x0f);
1261            cur_live.i = cur_live.drw << 10 | ((cur_live.wd & 0xf0) << 1) | cur_live.wrsync << 4 | (cur_live.wd & 0x0f);
12531262         }
12541263
1255         cur_live.e = m_gcr_rom->base()[cur_live.drw << 10 | cur_live.i];
1264         cur_live.e = m_gcr_rom->base()[cur_live.i];
12561265
12571266         attotime next = cur_live.tm + m_period;
1258         if (LOG) logerror("%s:%s cyl %u bit %u sync %u bc %u sr %03x sbc %u sBC %u syn %u i %03x e %02x\n",cur_live.tm.as_string(),next.as_string(),get_floppy()->get_cyl(),bit,sync,cur_live.bit_counter,cur_live.shift_reg,cur_live.sync_bit_counter,cur_live.sync_byte_counter,syn,cur_live.i,cur_live.e);
1267         if (LOG) logerror("%s:%s:%s bit %u sync %u bc %u sbc %u sBC %u syn %u i %03x e %02x\n",cur_live.tm.as_string(),next.as_string(),cur_live.edge.as_string(),bit,sync,cur_live.bit_counter,cur_live.sync_bit_counter,cur_live.sync_byte_counter,syn,cur_live.i,cur_live.e);
12591268
12601269         // byte ready
12611270         int brdy = !(cur_live.bit_counter == 9);
r242301r242302
12631272         // GCR error
12641273         int gcr_err = !(brdy || BIT(cur_live.e, 3));
12651274
1266         // write bit
1267         if (!cur_live.drw) { // TODO WPS
1268            int write_bit = BIT(cur_live.shift_reg_write, 9);
1269            if (LOG) logerror("%s writing bit %u sr %03x\n",cur_live.tm.as_string(),write_bit,cur_live.shift_reg_write);
1270            pll_write_next_bit(write_bit, cur_live.tm, get_floppy(), limit);
1271         }
1272
1273         if (!brdy) {
1274            // load write shift register
1275            cur_live.shift_reg_write = GCR_ENCODE(cur_live.e, cur_live.i);
1276
1277            if (LOG) logerror("%s load write shift register %03x\n",cur_live.tm.as_string(),cur_live.shift_reg_write);
1278         } else {
1279            // clock write shift register
1280            cur_live.shift_reg_write <<= 1;
1281            cur_live.shift_reg_write &= 0x3ff;
1282         }
1283
12841275         if (brdy != cur_live.brdy) {
12851276            if (LOG) logerror("%s BRDY %u\n", cur_live.tm.as_string(),brdy);
12861277            if (!brdy)
r242301r242302
13121303         }
13131304
13141305         if (syncpoint) {
1306            commit(cur_live.tm);
1307
1308            cur_live.tm += m_period;
13151309            live_delay(RUNNING_SYNCPOINT);
13161310            return;
13171311         }
1312
1313         cur_live.tm += m_period;
13181314         break;
13191315      }
13201316
r242301r242302
13381334      }
13391335   }
13401336}
1337
1338int victor_9000_fdc_t::get_next_bit(attotime &tm, const attotime &limit)
1339{
1340   return cur_pll.get_next_bit(tm, get_floppy(), limit);
1341}
trunk/src/mess/machine/victor9k_fdc.h
r242301r242302
135135      UINT8 e;
136136
137137      // read
138      attotime edge;
138139      UINT16 shift_reg;
139140      int bit_counter;
140141      int sync_bit_counter;
r242301r242302
222223   floppy_image_device* get_floppy();
223224   void live_start();
224225   void pll_reset(const attotime &when, const attotime clock);
225   void pll_start_writing(const attotime &tm);
226   void pll_commit(floppy_image_device *floppy, const attotime &tm);
227   void pll_stop_writing(floppy_image_device *floppy, const attotime &tm);
228   int pll_get_next_bit(attotime &tm, floppy_image_device *floppy, const attotime &limit);
229   bool pll_write_next_bit(bool bit, attotime &tm, floppy_image_device *floppy, const attotime &limit);
230226   void pll_save_checkpoint();
231227   void pll_retrieve_checkpoint();
232228   void checkpoint();
233229   void rollback();
230   bool write_next_bit(bool bit, const attotime &limit);
231   void start_writing(const attotime &tm);
232   void commit(const attotime &tm);
233   void stop_writing(const attotime &tm);
234234   void live_delay(int state);
235235   void live_sync();
236236   void live_abort();
237237   void live_run(const attotime &limit = attotime::never);
238   void get_next_edge(const attotime &when);
239   int get_next_bit(attotime &tm, const attotime &limit);
238240};
239241
240242
trunk/src/mess/machine/victor9kb.c
r242301r242302
99
1010*********************************************************************/
1111
12/*
13
14PCB Layout
15----------
16
17A65-02307-201D
18
19|-----------------------------------------------------------------------|
20|    22-008-03  22-050-3B     8021    74LS14                         CN1|
21|                            ?MHz                                       |
22|                                                                       |
23|                                                                       |
24|                                                                       |
25|                                                                       |
26|                                                                       |
27|                                                                       |
28|                                                                       |
29|                                                                       |
30|                                                                       |
31|-----------------------------------------------------------------------|
32
33Notes:
34    All IC's shown.
35
36    8021        - Intel 8021 "70-8021-130?"
37    22-008-03   - Exar Semiconductor XR22-008-03 keyboard matrix capacitive readout latch
38    22-050-3B   - Exar Semiconductor XR22-050-3B keyboard matrix row driver with 4 to 12 decoder/demultiplexer
39    CN1         - keyboard data connector
40
41*/
42
4312#include "victor9kb.h"
4413
4514
trunk/src/mess/mess.lst
r242301r242302
11531153// APF Electronics Inc.
11541154apfm1000
11551155apfimag
1156mathmagi
11571156
11581157// Tatung
11591158einstein
r242301r242302
23332332scv_pal
23342333vii // Chintendo / KenSingTon / Jungle Soft / Siatronics Vii
23352334vsmile
2336vsmilef
23372335walle
23382336zsbc3
23392337dms5000
r242301r242302
25692567gameking
25702568leapster
25712569leapstertv
2572excali64
2573
trunk/src/mess/mess.mak
r242301r242302
993993
994994$(MESSOBJ)/apf.a:               \
995995   $(MESS_DRIVERS)/apf.o       \
996   $(MESS_DRIVERS)/mathmagi.o  \
997996
998997$(MESSOBJ)/apollo.a:            \
999998   $(MESS_DRIVERS)/apollo.o $(MESS_MACHINE)/apollo.o $(MESS_MACHINE)/apollo_dbg.o $(MESS_MACHINE)/apollo_kbd.o $(MESS_VIDEO)/apollo.o \
r242301r242302
10011000$(MESSOBJ)/apple.a:             \
10021001   $(MESS_DRIVERS)/apple1.o $(MESS_MACHINE)/apple1.o $(MESS_VIDEO)/apple1.o \
10031002   $(MESS_DRIVERS)/apple2.o $(MESS_DRIVERS)/apple2e.o $(MESS_MACHINE)/apple2.o $(MESS_VIDEO)/apple2.o \
1004   $(MESS_DRIVERS)/tk2000.o    \
1003   $(MESS_DRIVERS)/tk2000.o \
10051004   $(MESS_DRIVERS)/apple2gs.o $(MESS_MACHINE)/apple2gs.o $(MESS_VIDEO)/apple2gs.o \
10061005   $(MESS_DRIVERS)/apple3.o $(MESS_MACHINE)/apple3.o $(MESS_VIDEO)/apple3.o \
10071006   $(MESS_DRIVERS)/lisa.o $(MESS_MACHINE)/lisa.o \
r242301r242302
19121911   $(MESS_DRIVERS)/eacc.o      \
19131912   $(MESS_DRIVERS)/elwro800.o  \
19141913   $(MESS_DRIVERS)/eti660.o    \
1915   $(MESS_DRIVERS)/excali64.o  \
19161914   $(MESS_DRIVERS)/fanucs15.o  \
19171915   $(MESS_DRIVERS)/fanucspmg.o \
19181916   $(MESS_DRIVERS)/fc100.o     \
r242301r242302
21152113$(MESS_DRIVERS)/llc.o:      $(MESS_LAYOUT)/llc1.lh
21162114$(MESS_DRIVERS)/lynx.o:     $(MESS_LAYOUT)/lynx.lh
21172115$(MESS_DRIVERS)/mac.o:      $(MESS_LAYOUT)/mac.lh
2118$(MESS_DRIVERS)/mathmagi.o: $(MESS_LAYOUT)/mathmagi.lh
21192116$(MESS_MACHINE)/megacd.o:   $(MESS_LAYOUT)/megacd.lh
21202117$(MESS_DRIVERS)/mekd2.o:    $(MESS_LAYOUT)/mekd2.lh
21212118$(MESS_DRIVERS)/mephisto.o: $(MESS_LAYOUT)/mephisto.lh
trunk/src/mess/video/apple2.c
r242301r242302
12011201         switch (mon_type)
12021202         {
12031203            case 0:
1204               // verified on h/w: setting dhires w/o 80col emulates a rev. 0 Apple ][ with no orange/blue
1205               if (m_dhires)
1206               {
1207                  artifact_map_ptr = m_hires_artifact_map;
1208               }
1209               else
1210               {
1211                  artifact_map_ptr = &m_hires_artifact_map[((vram_row[col + 1] & 0x80) >> 7) * 16];
1212               }
1204               artifact_map_ptr = &m_hires_artifact_map[((vram_row[col+1] & 0x80) >> 7) * 16];
12131205               for (b = 0; b < 7; b++)
12141206               {
12151207                  v = artifact_map_ptr[((w >> (b + 7-1)) & 0x07) | (((b ^ col) & 0x01) << 3)];
trunk/src/osd/sdl/input.c
r242301r242302
167167static sdl_window_info *    focus_window = NULL;
168168
169169// input buffer - only for SDLMAME_EVENTS_IN_WORKER_THREAD
170#define MAX_BUF_EVENTS      (1000)       /* 100 not enough for SDL 1.3 */
170#define MAX_BUF_EVENTS      (500)       /* 100 not enough for SDL 1.3 */
171171static SDL_Event            event_buf[MAX_BUF_EVENTS];
172172static int                  event_buf_count;
173173
trunk/src/version.c
r242301r242302
88
99***************************************************************************/
1010
11#define BARE_BUILD_VERSION "0.156"
12
13extern const char bare_build_version[];
1114extern const char build_version[];
12const char build_version[] = "0.156 (" __DATE__")";
15const char bare_build_version[] = BARE_BUILD_VERSION;
16const char build_version[] = BARE_BUILD_VERSION " (" __DATE__")";


Previous 199869 Revisions Next


© 1997-2024 The MAME Team