trunk/src/emu/cpu/arcompact/arcompactdasm.c
| r242303 | r242304 | |
| 24 | 24 | |
| 25 | 25 | /*****************************************************************************/ |
| 26 | 26 | |
| 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 |
| 27 | 30 | |
| 28 | | static 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 | | }; |
| 31 | #define LIMM_REG 62 |
| 65 | 32 | |
| 33 | #define GET_LIMM_32 \ |
| 34 | limm = oprom[6] | (oprom[7] << 8); \ |
| 35 | limm |= (oprom[4] << 16) | (oprom[5] << 24); \ |
| 36 | |
| 37 | int arcompact_handle04_00_dasm(DASM_OPS_32); |
| 38 | int arcompact_handle04_01_dasm(DASM_OPS_32); |
| 39 | int arcompact_handle04_02_dasm(DASM_OPS_32); |
| 40 | int arcompact_handle04_03_dasm(DASM_OPS_32); |
| 41 | int arcompact_handle04_04_dasm(DASM_OPS_32); |
| 42 | int arcompact_handle04_05_dasm(DASM_OPS_32); |
| 43 | int arcompact_handle04_06_dasm(DASM_OPS_32); |
| 44 | int arcompact_handle04_07_dasm(DASM_OPS_32); |
| 45 | int arcompact_handle04_08_dasm(DASM_OPS_32); |
| 46 | int arcompact_handle04_09_dasm(DASM_OPS_32); |
| 47 | int arcompact_handle04_0a_dasm(DASM_OPS_32); |
| 48 | int arcompact_handle04_0b_dasm(DASM_OPS_32); |
| 49 | int arcompact_handle04_0c_dasm(DASM_OPS_32); |
| 50 | int arcompact_handle04_0d_dasm(DASM_OPS_32); |
| 51 | int arcompact_handle04_0e_dasm(DASM_OPS_32); |
| 52 | int arcompact_handle04_0f_dasm(DASM_OPS_32); |
| 53 | int arcompact_handle04_10_dasm(DASM_OPS_32); |
| 54 | int arcompact_handle04_11_dasm(DASM_OPS_32); |
| 55 | int arcompact_handle04_12_dasm(DASM_OPS_32); |
| 56 | int arcompact_handle04_13_dasm(DASM_OPS_32); |
| 57 | int arcompact_handle04_14_dasm(DASM_OPS_32); |
| 58 | int arcompact_handle04_15_dasm(DASM_OPS_32); |
| 59 | int arcompact_handle04_16_dasm(DASM_OPS_32); |
| 60 | int arcompact_handle04_17_dasm(DASM_OPS_32); |
| 61 | int arcompact_handle04_18_dasm(DASM_OPS_32); |
| 62 | int arcompact_handle04_19_dasm(DASM_OPS_32); |
| 63 | int arcompact_handle04_1a_dasm(DASM_OPS_32); |
| 64 | int arcompact_handle04_1b_dasm(DASM_OPS_32); |
| 65 | int arcompact_handle04_1c_dasm(DASM_OPS_32); |
| 66 | int arcompact_handle04_1d_dasm(DASM_OPS_32); |
| 67 | int arcompact_handle04_1e_dasm(DASM_OPS_32); |
| 68 | int arcompact_handle04_1f_dasm(DASM_OPS_32); |
| 69 | int arcompact_handle04_20_dasm(DASM_OPS_32); |
| 70 | int arcompact_handle04_21_dasm(DASM_OPS_32); |
| 71 | int arcompact_handle04_22_dasm(DASM_OPS_32); |
| 72 | int arcompact_handle04_23_dasm(DASM_OPS_32); |
| 73 | int arcompact_handle04_24_dasm(DASM_OPS_32); |
| 74 | int arcompact_handle04_25_dasm(DASM_OPS_32); |
| 75 | int arcompact_handle04_26_dasm(DASM_OPS_32); |
| 76 | int arcompact_handle04_27_dasm(DASM_OPS_32); |
| 77 | int arcompact_handle04_28_dasm(DASM_OPS_32); |
| 78 | int arcompact_handle04_29_dasm(DASM_OPS_32); |
| 79 | int arcompact_handle04_2a_dasm(DASM_OPS_32); |
| 80 | int arcompact_handle04_2b_dasm(DASM_OPS_32); |
| 81 | int arcompact_handle04_2c_dasm(DASM_OPS_32); |
| 82 | int arcompact_handle04_2d_dasm(DASM_OPS_32); |
| 83 | int arcompact_handle04_2e_dasm(DASM_OPS_32); |
| 84 | int arcompact_handle04_2f_dasm(DASM_OPS_32); |
| 85 | int arcompact_handle04_30_dasm(DASM_OPS_32); |
| 86 | int arcompact_handle04_31_dasm(DASM_OPS_32); |
| 87 | int arcompact_handle04_32_dasm(DASM_OPS_32); |
| 88 | int arcompact_handle04_33_dasm(DASM_OPS_32); |
| 89 | int arcompact_handle04_34_dasm(DASM_OPS_32); |
| 90 | int arcompact_handle04_35_dasm(DASM_OPS_32); |
| 91 | int arcompact_handle04_36_dasm(DASM_OPS_32); |
| 92 | int arcompact_handle04_37_dasm(DASM_OPS_32); |
| 93 | int arcompact_handle04_38_dasm(DASM_OPS_32); |
| 94 | int arcompact_handle04_39_dasm(DASM_OPS_32); |
| 95 | int arcompact_handle04_3a_dasm(DASM_OPS_32); |
| 96 | int arcompact_handle04_3b_dasm(DASM_OPS_32); |
| 97 | int arcompact_handle04_3c_dasm(DASM_OPS_32); |
| 98 | int arcompact_handle04_3d_dasm(DASM_OPS_32); |
| 99 | int arcompact_handle04_3e_dasm(DASM_OPS_32); |
| 100 | int arcompact_handle04_3f_dasm(DASM_OPS_32); |
| 101 | |
| 102 | int arcompact_handle04_2f_00_dasm(DASM_OPS_32); |
| 103 | int arcompact_handle04_2f_01_dasm(DASM_OPS_32); |
| 104 | int arcompact_handle04_2f_02_dasm(DASM_OPS_32); |
| 105 | int arcompact_handle04_2f_03_dasm(DASM_OPS_32); |
| 106 | int arcompact_handle04_2f_04_dasm(DASM_OPS_32); |
| 107 | int arcompact_handle04_2f_05_dasm(DASM_OPS_32); |
| 108 | int arcompact_handle04_2f_06_dasm(DASM_OPS_32); |
| 109 | int arcompact_handle04_2f_07_dasm(DASM_OPS_32); |
| 110 | int arcompact_handle04_2f_08_dasm(DASM_OPS_32); |
| 111 | int arcompact_handle04_2f_09_dasm(DASM_OPS_32); |
| 112 | int arcompact_handle04_2f_0a_dasm(DASM_OPS_32); |
| 113 | int arcompact_handle04_2f_0b_dasm(DASM_OPS_32); |
| 114 | int arcompact_handle04_2f_0c_dasm(DASM_OPS_32); |
| 115 | int arcompact_handle04_2f_0d_dasm(DASM_OPS_32); |
| 116 | int arcompact_handle04_2f_0e_dasm(DASM_OPS_32); |
| 117 | int arcompact_handle04_2f_0f_dasm(DASM_OPS_32); |
| 118 | int arcompact_handle04_2f_10_dasm(DASM_OPS_32); |
| 119 | int arcompact_handle04_2f_11_dasm(DASM_OPS_32); |
| 120 | int arcompact_handle04_2f_12_dasm(DASM_OPS_32); |
| 121 | int arcompact_handle04_2f_13_dasm(DASM_OPS_32); |
| 122 | int arcompact_handle04_2f_14_dasm(DASM_OPS_32); |
| 123 | int arcompact_handle04_2f_15_dasm(DASM_OPS_32); |
| 124 | int arcompact_handle04_2f_16_dasm(DASM_OPS_32); |
| 125 | int arcompact_handle04_2f_17_dasm(DASM_OPS_32); |
| 126 | int arcompact_handle04_2f_18_dasm(DASM_OPS_32); |
| 127 | int arcompact_handle04_2f_19_dasm(DASM_OPS_32); |
| 128 | int arcompact_handle04_2f_1a_dasm(DASM_OPS_32); |
| 129 | int arcompact_handle04_2f_1b_dasm(DASM_OPS_32); |
| 130 | int arcompact_handle04_2f_1c_dasm(DASM_OPS_32); |
| 131 | int arcompact_handle04_2f_1d_dasm(DASM_OPS_32); |
| 132 | int arcompact_handle04_2f_1e_dasm(DASM_OPS_32); |
| 133 | int arcompact_handle04_2f_1f_dasm(DASM_OPS_32); |
| 134 | int arcompact_handle04_2f_20_dasm(DASM_OPS_32); |
| 135 | int arcompact_handle04_2f_21_dasm(DASM_OPS_32); |
| 136 | int arcompact_handle04_2f_22_dasm(DASM_OPS_32); |
| 137 | int arcompact_handle04_2f_23_dasm(DASM_OPS_32); |
| 138 | int arcompact_handle04_2f_24_dasm(DASM_OPS_32); |
| 139 | int arcompact_handle04_2f_25_dasm(DASM_OPS_32); |
| 140 | int arcompact_handle04_2f_26_dasm(DASM_OPS_32); |
| 141 | int arcompact_handle04_2f_27_dasm(DASM_OPS_32); |
| 142 | int arcompact_handle04_2f_28_dasm(DASM_OPS_32); |
| 143 | int arcompact_handle04_2f_29_dasm(DASM_OPS_32); |
| 144 | int arcompact_handle04_2f_2a_dasm(DASM_OPS_32); |
| 145 | int arcompact_handle04_2f_2b_dasm(DASM_OPS_32); |
| 146 | int arcompact_handle04_2f_2c_dasm(DASM_OPS_32); |
| 147 | int arcompact_handle04_2f_2d_dasm(DASM_OPS_32); |
| 148 | int arcompact_handle04_2f_2e_dasm(DASM_OPS_32); |
| 149 | int arcompact_handle04_2f_2f_dasm(DASM_OPS_32); |
| 150 | int arcompact_handle04_2f_30_dasm(DASM_OPS_32); |
| 151 | int arcompact_handle04_2f_31_dasm(DASM_OPS_32); |
| 152 | int arcompact_handle04_2f_32_dasm(DASM_OPS_32); |
| 153 | int arcompact_handle04_2f_33_dasm(DASM_OPS_32); |
| 154 | int arcompact_handle04_2f_34_dasm(DASM_OPS_32); |
| 155 | int arcompact_handle04_2f_35_dasm(DASM_OPS_32); |
| 156 | int arcompact_handle04_2f_36_dasm(DASM_OPS_32); |
| 157 | int arcompact_handle04_2f_37_dasm(DASM_OPS_32); |
| 158 | int arcompact_handle04_2f_38_dasm(DASM_OPS_32); |
| 159 | int arcompact_handle04_2f_39_dasm(DASM_OPS_32); |
| 160 | int arcompact_handle04_2f_3a_dasm(DASM_OPS_32); |
| 161 | int arcompact_handle04_2f_3b_dasm(DASM_OPS_32); |
| 162 | int arcompact_handle04_2f_3c_dasm(DASM_OPS_32); |
| 163 | int arcompact_handle04_2f_3d_dasm(DASM_OPS_32); |
| 164 | int arcompact_handle04_2f_3e_dasm(DASM_OPS_32); |
| 165 | int arcompact_handle04_2f_3f_dasm(DASM_OPS_32); |
| 166 | |
| 167 | int arcompact_handle04_2f_3f_00_dasm(DASM_OPS_32); |
| 168 | int arcompact_handle04_2f_3f_01_dasm(DASM_OPS_32); |
| 169 | int arcompact_handle04_2f_3f_02_dasm(DASM_OPS_32); |
| 170 | int arcompact_handle04_2f_3f_03_dasm(DASM_OPS_32); |
| 171 | int arcompact_handle04_2f_3f_04_dasm(DASM_OPS_32); |
| 172 | int arcompact_handle04_2f_3f_05_dasm(DASM_OPS_32); |
| 173 | int arcompact_handle04_2f_3f_06_dasm(DASM_OPS_32); |
| 174 | int arcompact_handle04_2f_3f_07_dasm(DASM_OPS_32); |
| 175 | int arcompact_handle04_2f_3f_08_dasm(DASM_OPS_32); |
| 176 | int arcompact_handle04_2f_3f_09_dasm(DASM_OPS_32); |
| 177 | int arcompact_handle04_2f_3f_0a_dasm(DASM_OPS_32); |
| 178 | int arcompact_handle04_2f_3f_0b_dasm(DASM_OPS_32); |
| 179 | int arcompact_handle04_2f_3f_0c_dasm(DASM_OPS_32); |
| 180 | int arcompact_handle04_2f_3f_0d_dasm(DASM_OPS_32); |
| 181 | int arcompact_handle04_2f_3f_0e_dasm(DASM_OPS_32); |
| 182 | int arcompact_handle04_2f_3f_0f_dasm(DASM_OPS_32); |
| 183 | int arcompact_handle04_2f_3f_10_dasm(DASM_OPS_32); |
| 184 | int arcompact_handle04_2f_3f_11_dasm(DASM_OPS_32); |
| 185 | int arcompact_handle04_2f_3f_12_dasm(DASM_OPS_32); |
| 186 | int arcompact_handle04_2f_3f_13_dasm(DASM_OPS_32); |
| 187 | int arcompact_handle04_2f_3f_14_dasm(DASM_OPS_32); |
| 188 | int arcompact_handle04_2f_3f_15_dasm(DASM_OPS_32); |
| 189 | int arcompact_handle04_2f_3f_16_dasm(DASM_OPS_32); |
| 190 | int arcompact_handle04_2f_3f_17_dasm(DASM_OPS_32); |
| 191 | int arcompact_handle04_2f_3f_18_dasm(DASM_OPS_32); |
| 192 | int arcompact_handle04_2f_3f_19_dasm(DASM_OPS_32); |
| 193 | int arcompact_handle04_2f_3f_1a_dasm(DASM_OPS_32); |
| 194 | int arcompact_handle04_2f_3f_1b_dasm(DASM_OPS_32); |
| 195 | int arcompact_handle04_2f_3f_1c_dasm(DASM_OPS_32); |
| 196 | int arcompact_handle04_2f_3f_1d_dasm(DASM_OPS_32); |
| 197 | int arcompact_handle04_2f_3f_1e_dasm(DASM_OPS_32); |
| 198 | int arcompact_handle04_2f_3f_1f_dasm(DASM_OPS_32); |
| 199 | int arcompact_handle04_2f_3f_20_dasm(DASM_OPS_32); |
| 200 | int arcompact_handle04_2f_3f_21_dasm(DASM_OPS_32); |
| 201 | int arcompact_handle04_2f_3f_22_dasm(DASM_OPS_32); |
| 202 | int arcompact_handle04_2f_3f_23_dasm(DASM_OPS_32); |
| 203 | int arcompact_handle04_2f_3f_24_dasm(DASM_OPS_32); |
| 204 | int arcompact_handle04_2f_3f_25_dasm(DASM_OPS_32); |
| 205 | int arcompact_handle04_2f_3f_26_dasm(DASM_OPS_32); |
| 206 | int arcompact_handle04_2f_3f_27_dasm(DASM_OPS_32); |
| 207 | int arcompact_handle04_2f_3f_28_dasm(DASM_OPS_32); |
| 208 | int arcompact_handle04_2f_3f_29_dasm(DASM_OPS_32); |
| 209 | int arcompact_handle04_2f_3f_2a_dasm(DASM_OPS_32); |
| 210 | int arcompact_handle04_2f_3f_2b_dasm(DASM_OPS_32); |
| 211 | int arcompact_handle04_2f_3f_2c_dasm(DASM_OPS_32); |
| 212 | int arcompact_handle04_2f_3f_2d_dasm(DASM_OPS_32); |
| 213 | int arcompact_handle04_2f_3f_2e_dasm(DASM_OPS_32); |
| 214 | int arcompact_handle04_2f_3f_2f_dasm(DASM_OPS_32); |
| 215 | int arcompact_handle04_2f_3f_30_dasm(DASM_OPS_32); |
| 216 | int arcompact_handle04_2f_3f_31_dasm(DASM_OPS_32); |
| 217 | int arcompact_handle04_2f_3f_32_dasm(DASM_OPS_32); |
| 218 | int arcompact_handle04_2f_3f_33_dasm(DASM_OPS_32); |
| 219 | int arcompact_handle04_2f_3f_34_dasm(DASM_OPS_32); |
| 220 | int arcompact_handle04_2f_3f_35_dasm(DASM_OPS_32); |
| 221 | int arcompact_handle04_2f_3f_36_dasm(DASM_OPS_32); |
| 222 | int arcompact_handle04_2f_3f_37_dasm(DASM_OPS_32); |
| 223 | int arcompact_handle04_2f_3f_38_dasm(DASM_OPS_32); |
| 224 | int arcompact_handle04_2f_3f_39_dasm(DASM_OPS_32); |
| 225 | int arcompact_handle04_2f_3f_3a_dasm(DASM_OPS_32); |
| 226 | int arcompact_handle04_2f_3f_3b_dasm(DASM_OPS_32); |
| 227 | int arcompact_handle04_2f_3f_3c_dasm(DASM_OPS_32); |
| 228 | int arcompact_handle04_2f_3f_3d_dasm(DASM_OPS_32); |
| 229 | int arcompact_handle04_2f_3f_3e_dasm(DASM_OPS_32); |
| 230 | int arcompact_handle04_2f_3f_3f_dasm(DASM_OPS_32); |
| 231 | |
| 232 | int arcompact_handle05_00_dasm(DASM_OPS_32); |
| 233 | int arcompact_handle05_01_dasm(DASM_OPS_32); |
| 234 | int arcompact_handle05_02_dasm(DASM_OPS_32); |
| 235 | int arcompact_handle05_03_dasm(DASM_OPS_32); |
| 236 | int arcompact_handle05_04_dasm(DASM_OPS_32); |
| 237 | int arcompact_handle05_05_dasm(DASM_OPS_32); |
| 238 | int arcompact_handle05_06_dasm(DASM_OPS_32); |
| 239 | int arcompact_handle05_07_dasm(DASM_OPS_32); |
| 240 | int arcompact_handle05_08_dasm(DASM_OPS_32); |
| 241 | int arcompact_handle05_09_dasm(DASM_OPS_32); |
| 242 | int arcompact_handle05_0a_dasm(DASM_OPS_32); |
| 243 | int arcompact_handle05_0b_dasm(DASM_OPS_32); |
| 244 | int arcompact_handle05_0c_dasm(DASM_OPS_32); |
| 245 | int arcompact_handle05_0d_dasm(DASM_OPS_32); |
| 246 | int arcompact_handle05_0e_dasm(DASM_OPS_32); |
| 247 | int arcompact_handle05_0f_dasm(DASM_OPS_32); |
| 248 | int arcompact_handle05_10_dasm(DASM_OPS_32); |
| 249 | int arcompact_handle05_11_dasm(DASM_OPS_32); |
| 250 | int arcompact_handle05_12_dasm(DASM_OPS_32); |
| 251 | int arcompact_handle05_13_dasm(DASM_OPS_32); |
| 252 | int arcompact_handle05_14_dasm(DASM_OPS_32); |
| 253 | int arcompact_handle05_15_dasm(DASM_OPS_32); |
| 254 | int arcompact_handle05_16_dasm(DASM_OPS_32); |
| 255 | int arcompact_handle05_17_dasm(DASM_OPS_32); |
| 256 | int arcompact_handle05_18_dasm(DASM_OPS_32); |
| 257 | int arcompact_handle05_19_dasm(DASM_OPS_32); |
| 258 | int arcompact_handle05_1a_dasm(DASM_OPS_32); |
| 259 | int arcompact_handle05_1b_dasm(DASM_OPS_32); |
| 260 | int arcompact_handle05_1c_dasm(DASM_OPS_32); |
| 261 | int arcompact_handle05_1d_dasm(DASM_OPS_32); |
| 262 | int arcompact_handle05_1e_dasm(DASM_OPS_32); |
| 263 | int arcompact_handle05_1f_dasm(DASM_OPS_32); |
| 264 | int arcompact_handle05_20_dasm(DASM_OPS_32); |
| 265 | int arcompact_handle05_21_dasm(DASM_OPS_32); |
| 266 | int arcompact_handle05_22_dasm(DASM_OPS_32); |
| 267 | int arcompact_handle05_23_dasm(DASM_OPS_32); |
| 268 | int arcompact_handle05_24_dasm(DASM_OPS_32); |
| 269 | int arcompact_handle05_25_dasm(DASM_OPS_32); |
| 270 | int arcompact_handle05_26_dasm(DASM_OPS_32); |
| 271 | int arcompact_handle05_27_dasm(DASM_OPS_32); |
| 272 | int arcompact_handle05_28_dasm(DASM_OPS_32); |
| 273 | int arcompact_handle05_29_dasm(DASM_OPS_32); |
| 274 | int arcompact_handle05_2a_dasm(DASM_OPS_32); |
| 275 | int arcompact_handle05_2b_dasm(DASM_OPS_32); |
| 276 | int arcompact_handle05_2c_dasm(DASM_OPS_32); |
| 277 | int arcompact_handle05_2d_dasm(DASM_OPS_32); |
| 278 | int arcompact_handle05_2e_dasm(DASM_OPS_32); |
| 279 | int arcompact_handle05_2f_dasm(DASM_OPS_32); |
| 280 | int arcompact_handle05_30_dasm(DASM_OPS_32); |
| 281 | int arcompact_handle05_31_dasm(DASM_OPS_32); |
| 282 | int arcompact_handle05_32_dasm(DASM_OPS_32); |
| 283 | int arcompact_handle05_33_dasm(DASM_OPS_32); |
| 284 | int arcompact_handle05_34_dasm(DASM_OPS_32); |
| 285 | int arcompact_handle05_35_dasm(DASM_OPS_32); |
| 286 | int arcompact_handle05_36_dasm(DASM_OPS_32); |
| 287 | int arcompact_handle05_37_dasm(DASM_OPS_32); |
| 288 | int arcompact_handle05_38_dasm(DASM_OPS_32); |
| 289 | int arcompact_handle05_39_dasm(DASM_OPS_32); |
| 290 | int arcompact_handle05_3a_dasm(DASM_OPS_32); |
| 291 | int arcompact_handle05_3b_dasm(DASM_OPS_32); |
| 292 | int arcompact_handle05_3c_dasm(DASM_OPS_32); |
| 293 | int arcompact_handle05_3d_dasm(DASM_OPS_32); |
| 294 | int arcompact_handle05_3e_dasm(DASM_OPS_32); |
| 295 | int arcompact_handle05_3f_dasm(DASM_OPS_32); |
| 296 | |
| 297 | |
| 298 | int arcompact_handle0c_00_dasm(DASM_OPS_16); |
| 299 | int arcompact_handle0c_01_dasm(DASM_OPS_16); |
| 300 | int arcompact_handle0c_02_dasm(DASM_OPS_16); |
| 301 | int arcompact_handle0c_03_dasm(DASM_OPS_16); |
| 302 | |
| 303 | int arcompact_handle0d_00_dasm(DASM_OPS_16); |
| 304 | int arcompact_handle0d_01_dasm(DASM_OPS_16); |
| 305 | int arcompact_handle0d_02_dasm(DASM_OPS_16); |
| 306 | int arcompact_handle0d_03_dasm(DASM_OPS_16); |
| 307 | |
| 308 | int arcompact_handle0e_00_dasm(DASM_OPS_16); |
| 309 | int arcompact_handle0e_01_dasm(DASM_OPS_16); |
| 310 | int arcompact_handle0e_02_dasm(DASM_OPS_16); |
| 311 | int arcompact_handle0e_03_dasm(DASM_OPS_16); |
| 312 | |
| 313 | int arcompact_handle17_00_dasm(DASM_OPS_16); |
| 314 | int arcompact_handle17_01_dasm(DASM_OPS_16); |
| 315 | int arcompact_handle17_02_dasm(DASM_OPS_16); |
| 316 | int arcompact_handle17_03_dasm(DASM_OPS_16); |
| 317 | int arcompact_handle17_04_dasm(DASM_OPS_16); |
| 318 | int arcompact_handle17_05_dasm(DASM_OPS_16); |
| 319 | int arcompact_handle17_06_dasm(DASM_OPS_16); |
| 320 | int arcompact_handle17_07_dasm(DASM_OPS_16); |
| 321 | |
| 322 | int arcompact_handle18_00_dasm(DASM_OPS_16); |
| 323 | int arcompact_handle18_01_dasm(DASM_OPS_16); |
| 324 | int arcompact_handle18_02_dasm(DASM_OPS_16); |
| 325 | int arcompact_handle18_03_dasm(DASM_OPS_16); |
| 326 | int arcompact_handle18_04_dasm(DASM_OPS_16); |
| 327 | |
| 328 | int arcompact_handle18_05_dasm(DASM_OPS_16); |
| 329 | int arcompact_handle18_05_00_dasm(DASM_OPS_16); |
| 330 | int arcompact_handle18_05_01_dasm(DASM_OPS_16); |
| 331 | int arcompact_handle18_05_02_dasm(DASM_OPS_16); |
| 332 | int arcompact_handle18_05_03_dasm(DASM_OPS_16); |
| 333 | int arcompact_handle18_05_04_dasm(DASM_OPS_16); |
| 334 | int arcompact_handle18_05_05_dasm(DASM_OPS_16); |
| 335 | int arcompact_handle18_05_06_dasm(DASM_OPS_16); |
| 336 | int arcompact_handle18_05_07_dasm(DASM_OPS_16); |
| 337 | |
| 338 | int arcompact_handle18_06_dasm(DASM_OPS_16); |
| 339 | int arcompact_handle18_06_00_dasm(DASM_OPS_16); |
| 340 | int arcompact_handle18_06_01_dasm(DASM_OPS_16); |
| 341 | int arcompact_handle18_06_02_dasm(DASM_OPS_16); |
| 342 | int arcompact_handle18_06_03_dasm(DASM_OPS_16); |
| 343 | int arcompact_handle18_06_04_dasm(DASM_OPS_16); |
| 344 | int arcompact_handle18_06_05_dasm(DASM_OPS_16); |
| 345 | int arcompact_handle18_06_06_dasm(DASM_OPS_16); |
| 346 | int arcompact_handle18_06_07_dasm(DASM_OPS_16); |
| 347 | int arcompact_handle18_06_08_dasm(DASM_OPS_16); |
| 348 | int arcompact_handle18_06_09_dasm(DASM_OPS_16); |
| 349 | int arcompact_handle18_06_0a_dasm(DASM_OPS_16); |
| 350 | int arcompact_handle18_06_0b_dasm(DASM_OPS_16); |
| 351 | int arcompact_handle18_06_0c_dasm(DASM_OPS_16); |
| 352 | int arcompact_handle18_06_0d_dasm(DASM_OPS_16); |
| 353 | int arcompact_handle18_06_0e_dasm(DASM_OPS_16); |
| 354 | int arcompact_handle18_06_0f_dasm(DASM_OPS_16); |
| 355 | int arcompact_handle18_06_10_dasm(DASM_OPS_16); |
| 356 | int arcompact_handle18_06_11_dasm(DASM_OPS_16); |
| 357 | int arcompact_handle18_06_12_dasm(DASM_OPS_16); |
| 358 | int arcompact_handle18_06_13_dasm(DASM_OPS_16); |
| 359 | int arcompact_handle18_06_14_dasm(DASM_OPS_16); |
| 360 | int arcompact_handle18_06_15_dasm(DASM_OPS_16); |
| 361 | int arcompact_handle18_06_16_dasm(DASM_OPS_16); |
| 362 | int arcompact_handle18_06_17_dasm(DASM_OPS_16); |
| 363 | int arcompact_handle18_06_18_dasm(DASM_OPS_16); |
| 364 | int arcompact_handle18_06_19_dasm(DASM_OPS_16); |
| 365 | int arcompact_handle18_06_1a_dasm(DASM_OPS_16); |
| 366 | int arcompact_handle18_06_1b_dasm(DASM_OPS_16); |
| 367 | int arcompact_handle18_06_1c_dasm(DASM_OPS_16); |
| 368 | int arcompact_handle18_06_1d_dasm(DASM_OPS_16); |
| 369 | int arcompact_handle18_06_1e_dasm(DASM_OPS_16); |
| 370 | int arcompact_handle18_06_1f_dasm(DASM_OPS_16); |
| 371 | |
| 372 | int arcompact_handle18_07_dasm(DASM_OPS_16); |
| 373 | int arcompact_handle18_07_00_dasm(DASM_OPS_16); |
| 374 | int arcompact_handle18_07_01_dasm(DASM_OPS_16); |
| 375 | int arcompact_handle18_07_02_dasm(DASM_OPS_16); |
| 376 | int arcompact_handle18_07_03_dasm(DASM_OPS_16); |
| 377 | int arcompact_handle18_07_04_dasm(DASM_OPS_16); |
| 378 | int arcompact_handle18_07_05_dasm(DASM_OPS_16); |
| 379 | int arcompact_handle18_07_06_dasm(DASM_OPS_16); |
| 380 | int arcompact_handle18_07_07_dasm(DASM_OPS_16); |
| 381 | int arcompact_handle18_07_08_dasm(DASM_OPS_16); |
| 382 | int arcompact_handle18_07_09_dasm(DASM_OPS_16); |
| 383 | int arcompact_handle18_07_0a_dasm(DASM_OPS_16); |
| 384 | int arcompact_handle18_07_0b_dasm(DASM_OPS_16); |
| 385 | int arcompact_handle18_07_0c_dasm(DASM_OPS_16); |
| 386 | int arcompact_handle18_07_0d_dasm(DASM_OPS_16); |
| 387 | int arcompact_handle18_07_0e_dasm(DASM_OPS_16); |
| 388 | int arcompact_handle18_07_0f_dasm(DASM_OPS_16); |
| 389 | int arcompact_handle18_07_10_dasm(DASM_OPS_16); |
| 390 | int arcompact_handle18_07_11_dasm(DASM_OPS_16); |
| 391 | int arcompact_handle18_07_12_dasm(DASM_OPS_16); |
| 392 | int arcompact_handle18_07_13_dasm(DASM_OPS_16); |
| 393 | int arcompact_handle18_07_14_dasm(DASM_OPS_16); |
| 394 | int arcompact_handle18_07_15_dasm(DASM_OPS_16); |
| 395 | int arcompact_handle18_07_16_dasm(DASM_OPS_16); |
| 396 | int arcompact_handle18_07_17_dasm(DASM_OPS_16); |
| 397 | int arcompact_handle18_07_18_dasm(DASM_OPS_16); |
| 398 | int arcompact_handle18_07_19_dasm(DASM_OPS_16); |
| 399 | int arcompact_handle18_07_1a_dasm(DASM_OPS_16); |
| 400 | int arcompact_handle18_07_1b_dasm(DASM_OPS_16); |
| 401 | int arcompact_handle18_07_1c_dasm(DASM_OPS_16); |
| 402 | int arcompact_handle18_07_1d_dasm(DASM_OPS_16); |
| 403 | int arcompact_handle18_07_1e_dasm(DASM_OPS_16); |
| 404 | int arcompact_handle18_07_1f_dasm(DASM_OPS_16); |
| 405 | |
| 406 | int arcompact_handle19_00_dasm(DASM_OPS_16); |
| 407 | int arcompact_handle19_01_dasm(DASM_OPS_16); |
| 408 | int arcompact_handle19_02_dasm(DASM_OPS_16); |
| 409 | int arcompact_handle19_03_dasm(DASM_OPS_16); |
| 410 | |
| 411 | int arcompact_handle1c_00_dasm(DASM_OPS_16); |
| 412 | int arcompact_handle1c_01_dasm(DASM_OPS_16); |
| 413 | |
| 414 | int arcompact_handle1d_00_dasm(DASM_OPS_16); |
| 415 | int arcompact_handle1d_01_dasm(DASM_OPS_16); |
| 416 | |
| 417 | int arcompact_handle1e_00_dasm(DASM_OPS_16); |
| 418 | int arcompact_handle1e_01_dasm(DASM_OPS_16); |
| 419 | int arcompact_handle1e_02_dasm(DASM_OPS_16); |
| 420 | int arcompact_handle1e_03_dasm(DASM_OPS_16); |
| 421 | |
| 422 | int arcompact_handle1e_03_00_dasm(DASM_OPS_16); |
| 423 | int arcompact_handle1e_03_01_dasm(DASM_OPS_16); |
| 424 | int arcompact_handle1e_03_02_dasm(DASM_OPS_16); |
| 425 | int arcompact_handle1e_03_03_dasm(DASM_OPS_16); |
| 426 | int arcompact_handle1e_03_04_dasm(DASM_OPS_16); |
| 427 | int arcompact_handle1e_03_05_dasm(DASM_OPS_16); |
| 428 | int arcompact_handle1e_03_06_dasm(DASM_OPS_16); |
| 429 | int arcompact_handle1e_03_07_dasm(DASM_OPS_16); |
| 430 | |
| 431 | |
| 432 | |
| 66 | 433 | // condition codes (basic ones are the same as arc |
| 67 | 434 | static const char *conditions[0x20] = |
| 68 | 435 | { |
| r242303 | r242304 | |
| 120 | 487 | /* 0f */ "<BBIT1>" |
| 121 | 488 | }; |
| 122 | 489 | |
| 123 | | static 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)", |
| 133 | 490 | |
| 134 | | }; |
| 135 | 491 | |
| 492 | |
| 493 | |
| 136 | 494 | static const char *table0f[0x20] = |
| 137 | 495 | { |
| 138 | 496 | /* 00 */ "SOPs", // Sub Operation (another table..) ( table0f_00 ) |
| r242303 | r242304 | |
| 161 | 519 | /* 17 */ "0x17 <illegal>", |
| 162 | 520 | /* 18 */ "ASL_S (multiple)", |
| 163 | 521 | /* 19 */ "LSR_S (multiple)", |
| 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? |
| 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? |
| 170 | 528 | }; |
| 171 | 529 | |
| 172 | 530 | static const char *table0f_00[0x8] = |
| r242303 | r242304 | |
| 195 | 553 | |
| 196 | 554 | #define ARCOMPACT_OPERATION ((op & 0xf800) >> 11) |
| 197 | 555 | |
| 198 | | CPU_DISASSEMBLE(arcompact) |
| 556 | |
| 557 | int arcompact_handle00_dasm(DASM_OPS_32) |
| 199 | 558 | { |
| 200 | | int size = 2; |
| 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); |
| 201 | 566 | |
| 202 | | UINT32 op = oprom[2] | (oprom[3] << 8); |
| 203 | | output = buffer; |
| 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); |
| 204 | 575 | |
| 205 | | UINT8 instruction = ARCOMPACT_OPERATION; |
| 576 | UINT8 condition = op & 0x0000001f; |
| 206 | 577 | |
| 207 | | if (instruction < 0x0c) |
| 578 | print("B(%s) %08x (%08x)", conditions[condition], pc + (address * 2) + 2, op & ~0xffffffdf); |
| 579 | } |
| 580 | return 4; |
| 581 | } |
| 582 | |
| 583 | int arcompact_handle01_dasm(DASM_OPS_32) |
| 584 | { |
| 585 | int size = 4; |
| 586 | |
| 587 | if (op & 0x00010000) |
| 208 | 588 | { |
| 209 | | size = 4; |
| 210 | | op <<= 16; |
| 211 | | op |= oprom[0] | (oprom[1] << 8); |
| 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); |
| 212 | 596 | |
| 213 | | switch (instruction) |
| 597 | |
| 598 | print("%s (reg-imm) %08x (%08x)", table01_01_0x[subinstr], pc + (address * 2) + 4, op & ~0xf8fe800f); |
| 599 | |
| 600 | |
| 601 | } |
| 602 | else |
| 214 | 603 | { |
| 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); |
| 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); |
| 223 | 610 | |
| 224 | | print("B %08x (%08x)", pc + (address *2) + 2, op & ~0xffffffcf ); |
| 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); |
| 225 | 630 | } |
| 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 | } |
| 226 | 635 | else |
| 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); |
| 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); |
| 232 | 639 | |
| 233 | | UINT8 condition = op & 0x0000001f; |
| 640 | } |
| 641 | } |
| 234 | 642 | |
| 235 | | print("B(%s) %08x (%08x)", conditions[condition], pc + (address *2) + 2, op & ~0xffffffdf ); |
| 643 | } |
| 236 | 644 | |
| 237 | | } |
| 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); |
| 238 | 655 | |
| 239 | | break; |
| 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); |
| 240 | 664 | |
| 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); |
| 665 | UINT8 condition = op & 0x0000001f; |
| 251 | 666 | |
| 252 | | |
| 253 | | print("%s (reg-imm) %08x (%08x)", table01_01_0x[subinstr], pc + (address *2) + 4, op & ~0xf8fe800f); |
| 667 | print("BL(%s) %08x (%08x)", conditions[condition], pc + (address *2) + 2, op & ~0xffffffdf ); |
| 254 | 668 | |
| 669 | } |
| 255 | 670 | |
| 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); |
| 671 | } |
| 672 | return size; |
| 673 | } |
| 265 | 674 | |
| 266 | | print("%s (reg-reg) %08x (%08x)", table01_01_0x[subinstr], pc + (address *2) + 4, op & ~0xf8fe800f); |
| 675 | int 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 |
| 267 | 693 | |
| 268 | | } |
| 694 | print("LD r+o (%08x)", op ); |
| 695 | return 4; |
| 696 | } |
| 269 | 697 | |
| 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); |
| 698 | int 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 |
| 280 | 705 | |
| 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); |
| 706 | print("ST r+o (%08x)", op ); |
| 707 | return 4; |
| 708 | } |
| 289 | 709 | |
| 290 | | UINT8 condition = op & 0x0000001f; |
| 710 | int arcompact_handle04_dasm(DASM_OPS_32) |
| 711 | { |
| 712 | int size = 4; |
| 713 | // General Operations |
| 291 | 714 | |
| 292 | | print("BL(%s) %08x (%08x)", conditions[condition], pc + (address *2) + 2, op & ~0xffffffdf ); |
| 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; |
| 293 | 727 | |
| 294 | | } |
| 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 | } |
| 295 | 795 | |
| 296 | | } |
| 297 | | break; |
| 796 | return size; |
| 797 | } |
| 298 | 798 | |
| 299 | | default: |
| 300 | | print("%s (%08x)", basic[instruction], op & ~0xf8000000 ); |
| 301 | | break; |
| 799 | int arcompact_handle04_00_dasm(DASM_OPS_32) { print("ADD (%08x)", op); return 4;} |
| 800 | int arcompact_handle04_01_dasm(DASM_OPS_32) { print("ADC (%08x)", op); return 4;} |
| 801 | int arcompact_handle04_02_dasm(DASM_OPS_32) { print("SUB (%08x)", op); return 4;} |
| 802 | int arcompact_handle04_03_dasm(DASM_OPS_32) { print("SBC (%08x)", op); return 4;} |
| 803 | int arcompact_handle04_04_dasm(DASM_OPS_32) { print("AND (%08x)", op); return 4;} |
| 804 | int arcompact_handle04_05_dasm(DASM_OPS_32) { print("OR (%08x)", op); return 4;} |
| 805 | int arcompact_handle04_06_dasm(DASM_OPS_32) { print("BIC (%08x)", op); return 4;} |
| 806 | int arcompact_handle04_07_dasm(DASM_OPS_32) { print("XOR (%08x)", op); return 4;} |
| 807 | int arcompact_handle04_08_dasm(DASM_OPS_32) { print("MAX (%08x)", op); return 4;} |
| 808 | int arcompact_handle04_09_dasm(DASM_OPS_32) { print("MIN (%08x)", op); return 4;} |
| 809 | int arcompact_handle04_0a_dasm(DASM_OPS_32) { print("MOV (%08x)", op); return 4;} |
| 810 | int arcompact_handle04_0b_dasm(DASM_OPS_32) { print("TST (%08x)", op); return 4;} |
| 811 | int arcompact_handle04_0c_dasm(DASM_OPS_32) { print("CMP (%08x)", op); return 4;} |
| 812 | int arcompact_handle04_0d_dasm(DASM_OPS_32) { print("RCMP (%08x)", op); return 4;} |
| 813 | int arcompact_handle04_0e_dasm(DASM_OPS_32) { print("RSUB (%08x)", op); return 4;} |
| 814 | int arcompact_handle04_0f_dasm(DASM_OPS_32) { print("BSET (%08x)", op); return 4;} |
| 815 | int arcompact_handle04_10_dasm(DASM_OPS_32) { print("BCLR (%08x)", op); return 4;} |
| 816 | int arcompact_handle04_11_dasm(DASM_OPS_32) { print("BTST (%08x)", op); return 4;} |
| 817 | int arcompact_handle04_12_dasm(DASM_OPS_32) { print("BXOR (%08x)", op); return 4;} |
| 818 | int arcompact_handle04_13_dasm(DASM_OPS_32) { print("BMSK (%08x)", op); return 4;} |
| 819 | int arcompact_handle04_14_dasm(DASM_OPS_32) { print("ADD1 (%08x)", op); return 4;} |
| 820 | int arcompact_handle04_15_dasm(DASM_OPS_32) { print("ADD2 (%08x)", op); return 4;} |
| 821 | int arcompact_handle04_16_dasm(DASM_OPS_32) { print("ADD3 (%08x)", op); return 4;} |
| 822 | int arcompact_handle04_17_dasm(DASM_OPS_32) { print("SUB1 (%08x)", op); return 4;} |
| 823 | int arcompact_handle04_18_dasm(DASM_OPS_32) { print("SUB2 (%08x)", op); return 4;} |
| 824 | int arcompact_handle04_19_dasm(DASM_OPS_32) { print("SUB3 (%08x)", op); return 4;} |
| 825 | int arcompact_handle04_1a_dasm(DASM_OPS_32) { print("MPY (%08x)", op); return 4;} // * |
| 826 | int arcompact_handle04_1b_dasm(DASM_OPS_32) { print("MPYH (%08x)", op); return 4;} // * |
| 827 | int arcompact_handle04_1c_dasm(DASM_OPS_32) { print("MPYHU (%08x)", op); return 4;} // * |
| 828 | int arcompact_handle04_1d_dasm(DASM_OPS_32) { print("MPYU (%08x)", op); return 4;} // * |
| 829 | int arcompact_handle04_1e_dasm(DASM_OPS_32) { print("<illegal 0x04_1e> (%08x)", op); return 4;} |
| 830 | int arcompact_handle04_1f_dasm(DASM_OPS_32) { print("<illegal 0x04_1f> (%08x)", op); return 4;} |
| 302 | 831 | |
| 303 | | } |
| 304 | 832 | |
| 833 | |
| 834 | int 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; |
| 305 | 849 | |
| 850 | print("J(%s) %08x (%08x)", conditions[condition], limm, op); |
| 306 | 851 | } |
| 307 | 852 | else |
| 308 | | { |
| 309 | | size = 2; |
| 853 | { |
| 854 | print("J(%s) (r%d) (%08x)", conditions[condition], C, op); |
| 855 | } |
| 310 | 856 | |
| 311 | | switch (instruction) |
| 857 | return size; |
| 858 | } |
| 859 | |
| 860 | |
| 861 | |
| 862 | int arcompact_handle04_21_dasm(DASM_OPS_32) { print("Jcc.D (%08x)", op); return 4;} |
| 863 | int arcompact_handle04_22_dasm(DASM_OPS_32) { print("JLcc (%08x)", op); return 4;} |
| 864 | int arcompact_handle04_23_dasm(DASM_OPS_32) { print("JLcc.D (%08x)", op); return 4;} |
| 865 | int arcompact_handle04_24_dasm(DASM_OPS_32) { print("<illegal 0x04_24> (%08x)", op); return 4;} |
| 866 | int arcompact_handle04_25_dasm(DASM_OPS_32) { print("<illegal 0x04_25> (%08x)", op); return 4;} |
| 867 | int arcompact_handle04_26_dasm(DASM_OPS_32) { print("<illegal 0x04_26> (%08x)", op); return 4;} |
| 868 | int arcompact_handle04_27_dasm(DASM_OPS_32) { print("<illegal 0x04_27> (%08x)", op); return 4;} |
| 869 | int arcompact_handle04_28_dasm(DASM_OPS_32) { print("LPcc (%08x)", op); return 4;} |
| 870 | int arcompact_handle04_29_dasm(DASM_OPS_32) { print("FLAG (%08x)", op); return 4;} |
| 871 | int arcompact_handle04_2a_dasm(DASM_OPS_32) { print("LR (%08x)", op); return 4;} |
| 872 | int arcompact_handle04_2b_dasm(DASM_OPS_32) { print("SR (%08x)", op); return 4;} |
| 873 | int arcompact_handle04_2c_dasm(DASM_OPS_32) { print("<illegal 0x04_2c> (%08x)", op); return 4;} |
| 874 | int arcompact_handle04_2d_dasm(DASM_OPS_32) { print("<illegal 0x04_2d> (%08x)", op); return 4;} |
| 875 | int arcompact_handle04_2e_dasm(DASM_OPS_32) { print("<illegal 0x04_2e> (%08x)", op); return 4;} |
| 876 | |
| 877 | int 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 | |
| 955 | int arcompact_handle04_2f_00_dasm(DASM_OPS_32) { print("ASL (%08x)", op); return 4;} // ASL |
| 956 | int arcompact_handle04_2f_01_dasm(DASM_OPS_32) { print("ASR (%08x)", op); return 4;} // ASR |
| 957 | int arcompact_handle04_2f_02_dasm(DASM_OPS_32) { print("LSR (%08x)", op); return 4;} // LSR |
| 958 | int arcompact_handle04_2f_03_dasm(DASM_OPS_32) { print("ROR (%08x)", op); return 4;} // ROR |
| 959 | int arcompact_handle04_2f_04_dasm(DASM_OPS_32) { print("RCC (%08x)", op); return 4;} // RCC |
| 960 | int arcompact_handle04_2f_05_dasm(DASM_OPS_32) { print("SEXB (%08x)", op); return 4;} // SEXB |
| 961 | int arcompact_handle04_2f_06_dasm(DASM_OPS_32) { print("SEXW (%08x)", op); return 4;} // SEXW |
| 962 | int arcompact_handle04_2f_07_dasm(DASM_OPS_32) { print("EXTB (%08x)", op); return 4;} // EXTB |
| 963 | int arcompact_handle04_2f_08_dasm(DASM_OPS_32) { print("EXTW (%08x)", op); return 4;} // EXTW |
| 964 | int arcompact_handle04_2f_09_dasm(DASM_OPS_32) { print("ABS (%08x)", op); return 4;} // ABS |
| 965 | int arcompact_handle04_2f_0a_dasm(DASM_OPS_32) { print("NOT (%08x)", op); return 4;} // NOT |
| 966 | int arcompact_handle04_2f_0b_dasm(DASM_OPS_32) { print("RLC (%08x)", op); return 4;} // RLC |
| 967 | int arcompact_handle04_2f_0c_dasm(DASM_OPS_32) { print("EX (%08x)", op); return 4;} // EX |
| 968 | int arcompact_handle04_2f_0d_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_0d> (%08x)", op); return 4;} |
| 969 | int arcompact_handle04_2f_0e_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_0e> (%08x)", op); return 4;} |
| 970 | int arcompact_handle04_2f_0f_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_0f> (%08x)", op); return 4;} |
| 971 | int arcompact_handle04_2f_10_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_10> (%08x)", op); return 4;} |
| 972 | int arcompact_handle04_2f_11_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_11> (%08x)", op); return 4;} |
| 973 | int arcompact_handle04_2f_12_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_12> (%08x)", op); return 4;} |
| 974 | int arcompact_handle04_2f_13_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_13> (%08x)", op); return 4;} |
| 975 | int arcompact_handle04_2f_14_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_14> (%08x)", op); return 4;} |
| 976 | int arcompact_handle04_2f_15_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_15> (%08x)", op); return 4;} |
| 977 | int arcompact_handle04_2f_16_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_16> (%08x)", op); return 4;} |
| 978 | int arcompact_handle04_2f_17_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_17> (%08x)", op); return 4;} |
| 979 | int arcompact_handle04_2f_18_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_18> (%08x)", op); return 4;} |
| 980 | int arcompact_handle04_2f_19_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_19> (%08x)", op); return 4;} |
| 981 | int arcompact_handle04_2f_1a_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_1a> (%08x)", op); return 4;} |
| 982 | int arcompact_handle04_2f_1b_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_1b> (%08x)", op); return 4;} |
| 983 | int arcompact_handle04_2f_1c_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_1c> (%08x)", op); return 4;} |
| 984 | int arcompact_handle04_2f_1d_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_1d> (%08x)", op); return 4;} |
| 985 | int arcompact_handle04_2f_1e_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_1e> (%08x)", op); return 4;} |
| 986 | int arcompact_handle04_2f_1f_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_1f> (%08x)", op); return 4;} |
| 987 | int arcompact_handle04_2f_20_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_20> (%08x)", op); return 4;} |
| 988 | int arcompact_handle04_2f_21_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_21> (%08x)", op); return 4;} |
| 989 | int arcompact_handle04_2f_22_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_22> (%08x)", op); return 4;} |
| 990 | int arcompact_handle04_2f_23_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_23> (%08x)", op); return 4;} |
| 991 | int arcompact_handle04_2f_24_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_24> (%08x)", op); return 4;} |
| 992 | int arcompact_handle04_2f_25_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_25> (%08x)", op); return 4;} |
| 993 | int arcompact_handle04_2f_26_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_26> (%08x)", op); return 4;} |
| 994 | int arcompact_handle04_2f_27_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_27> (%08x)", op); return 4;} |
| 995 | int arcompact_handle04_2f_28_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_28> (%08x)", op); return 4;} |
| 996 | int arcompact_handle04_2f_29_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_29> (%08x)", op); return 4;} |
| 997 | int arcompact_handle04_2f_2a_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_2a> (%08x)", op); return 4;} |
| 998 | int arcompact_handle04_2f_2b_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_2b> (%08x)", op); return 4;} |
| 999 | int arcompact_handle04_2f_2c_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_2c> (%08x)", op); return 4;} |
| 1000 | int arcompact_handle04_2f_2d_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_2d> (%08x)", op); return 4;} |
| 1001 | int arcompact_handle04_2f_2e_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_2e> (%08x)", op); return 4;} |
| 1002 | int arcompact_handle04_2f_2f_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_2f> (%08x)", op); return 4;} |
| 1003 | int arcompact_handle04_2f_30_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_30> (%08x)", op); return 4;} |
| 1004 | int arcompact_handle04_2f_31_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_31> (%08x)", op); return 4;} |
| 1005 | int arcompact_handle04_2f_32_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_32> (%08x)", op); return 4;} |
| 1006 | int arcompact_handle04_2f_33_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_33> (%08x)", op); return 4;} |
| 1007 | int arcompact_handle04_2f_34_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_34> (%08x)", op); return 4;} |
| 1008 | int arcompact_handle04_2f_35_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_35> (%08x)", op); return 4;} |
| 1009 | int arcompact_handle04_2f_36_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_36> (%08x)", op); return 4;} |
| 1010 | int arcompact_handle04_2f_37_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_37> (%08x)", op); return 4;} |
| 1011 | int arcompact_handle04_2f_38_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_38> (%08x)", op); return 4;} |
| 1012 | int arcompact_handle04_2f_39_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_39> (%08x)", op); return 4;} |
| 1013 | int arcompact_handle04_2f_3a_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3a> (%08x)", op); return 4;} |
| 1014 | int arcompact_handle04_2f_3b_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3b> (%08x)", op); return 4;} |
| 1015 | int arcompact_handle04_2f_3c_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3c> (%08x)", op); return 4;} |
| 1016 | int arcompact_handle04_2f_3d_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3d> (%08x)", op); return 4;} |
| 1017 | int arcompact_handle04_2f_3e_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3e> (%08x)", op); return 4;} |
| 1018 | |
| 1019 | int 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 | |
| 1098 | int arcompact_handle04_2f_3f_00_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_00> (%08x)", op); return 4;} |
| 1099 | int arcompact_handle04_2f_3f_01_dasm(DASM_OPS_32) { print("SLEEP (%08x)", op); return 4;} |
| 1100 | int arcompact_handle04_2f_3f_02_dasm(DASM_OPS_32) { print("SWI / TRAP0 (%08x)", op); return 4;} |
| 1101 | int arcompact_handle04_2f_3f_03_dasm(DASM_OPS_32) { print("SYNC (%08x)", op); return 4;} |
| 1102 | int arcompact_handle04_2f_3f_04_dasm(DASM_OPS_32) { print("RTIE (%08x)", op); return 4;} |
| 1103 | int arcompact_handle04_2f_3f_05_dasm(DASM_OPS_32) { print("BRK (%08x)", op); return 4;} |
| 1104 | int arcompact_handle04_2f_3f_06_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_06> (%08x)", op); return 4;} |
| 1105 | int arcompact_handle04_2f_3f_07_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_07> (%08x)", op); return 4;} |
| 1106 | int arcompact_handle04_2f_3f_08_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_08> (%08x)", op); return 4;} |
| 1107 | int arcompact_handle04_2f_3f_09_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_09> (%08x)", op); return 4;} |
| 1108 | int arcompact_handle04_2f_3f_0a_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_0a> (%08x)", op); return 4;} |
| 1109 | int arcompact_handle04_2f_3f_0b_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_0b> (%08x)", op); return 4;} |
| 1110 | int arcompact_handle04_2f_3f_0c_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_0c> (%08x)", op); return 4;} |
| 1111 | int arcompact_handle04_2f_3f_0d_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_0d> (%08x)", op); return 4;} |
| 1112 | int arcompact_handle04_2f_3f_0e_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_0e> (%08x)", op); return 4;} |
| 1113 | int arcompact_handle04_2f_3f_0f_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_0f> (%08x)", op); return 4;} |
| 1114 | int arcompact_handle04_2f_3f_10_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_10> (%08x)", op); return 4;} |
| 1115 | int arcompact_handle04_2f_3f_11_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_11> (%08x)", op); return 4;} |
| 1116 | int arcompact_handle04_2f_3f_12_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_12> (%08x)", op); return 4;} |
| 1117 | int arcompact_handle04_2f_3f_13_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_13> (%08x)", op); return 4;} |
| 1118 | int arcompact_handle04_2f_3f_14_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_14> (%08x)", op); return 4;} |
| 1119 | int arcompact_handle04_2f_3f_15_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_15> (%08x)", op); return 4;} |
| 1120 | int arcompact_handle04_2f_3f_16_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_16> (%08x)", op); return 4;} |
| 1121 | int arcompact_handle04_2f_3f_17_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_17> (%08x)", op); return 4;} |
| 1122 | int arcompact_handle04_2f_3f_18_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_18> (%08x)", op); return 4;} |
| 1123 | int arcompact_handle04_2f_3f_19_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_19> (%08x)", op); return 4;} |
| 1124 | int arcompact_handle04_2f_3f_1a_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_1a> (%08x)", op); return 4;} |
| 1125 | int arcompact_handle04_2f_3f_1b_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_1b> (%08x)", op); return 4;} |
| 1126 | int arcompact_handle04_2f_3f_1c_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_1c> (%08x)", op); return 4;} |
| 1127 | int arcompact_handle04_2f_3f_1d_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_1d> (%08x)", op); return 4;} |
| 1128 | int arcompact_handle04_2f_3f_1e_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_1e> (%08x)", op); return 4;} |
| 1129 | int arcompact_handle04_2f_3f_1f_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_1f> (%08x)", op); return 4;} |
| 1130 | int arcompact_handle04_2f_3f_20_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_20> (%08x)", op); return 4;} |
| 1131 | int arcompact_handle04_2f_3f_21_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_21> (%08x)", op); return 4;} |
| 1132 | int arcompact_handle04_2f_3f_22_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_22> (%08x)", op); return 4;} |
| 1133 | int arcompact_handle04_2f_3f_23_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_23> (%08x)", op); return 4;} |
| 1134 | int arcompact_handle04_2f_3f_24_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_24> (%08x)", op); return 4;} |
| 1135 | int arcompact_handle04_2f_3f_25_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_25> (%08x)", op); return 4;} |
| 1136 | int arcompact_handle04_2f_3f_26_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_26> (%08x)", op); return 4;} |
| 1137 | int arcompact_handle04_2f_3f_27_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_27> (%08x)", op); return 4;} |
| 1138 | int arcompact_handle04_2f_3f_28_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_28> (%08x)", op); return 4;} |
| 1139 | int arcompact_handle04_2f_3f_29_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_29> (%08x)", op); return 4;} |
| 1140 | int arcompact_handle04_2f_3f_2a_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_2a> (%08x)", op); return 4;} |
| 1141 | int arcompact_handle04_2f_3f_2b_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_2b> (%08x)", op); return 4;} |
| 1142 | int arcompact_handle04_2f_3f_2c_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_2c> (%08x)", op); return 4;} |
| 1143 | int arcompact_handle04_2f_3f_2d_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_2d> (%08x)", op); return 4;} |
| 1144 | int arcompact_handle04_2f_3f_2e_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_2e> (%08x)", op); return 4;} |
| 1145 | int arcompact_handle04_2f_3f_2f_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_2f> (%08x)", op); return 4;} |
| 1146 | int arcompact_handle04_2f_3f_30_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_30> (%08x)", op); return 4;} |
| 1147 | int arcompact_handle04_2f_3f_31_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_31> (%08x)", op); return 4;} |
| 1148 | int arcompact_handle04_2f_3f_32_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_32> (%08x)", op); return 4;} |
| 1149 | int arcompact_handle04_2f_3f_33_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_33> (%08x)", op); return 4;} |
| 1150 | int arcompact_handle04_2f_3f_34_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_34> (%08x)", op); return 4;} |
| 1151 | int arcompact_handle04_2f_3f_35_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_35> (%08x)", op); return 4;} |
| 1152 | int arcompact_handle04_2f_3f_36_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_36> (%08x)", op); return 4;} |
| 1153 | int arcompact_handle04_2f_3f_37_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_37> (%08x)", op); return 4;} |
| 1154 | int arcompact_handle04_2f_3f_38_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_38> (%08x)", op); return 4;} |
| 1155 | int arcompact_handle04_2f_3f_39_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_39> (%08x)", op); return 4;} |
| 1156 | int arcompact_handle04_2f_3f_3a_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_3a> (%08x)", op); return 4;} |
| 1157 | int arcompact_handle04_2f_3f_3b_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_3b> (%08x)", op); return 4;} |
| 1158 | int arcompact_handle04_2f_3f_3c_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_3c> (%08x)", op); return 4;} |
| 1159 | int arcompact_handle04_2f_3f_3d_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_3d> (%08x)", op); return 4;} |
| 1160 | int arcompact_handle04_2f_3f_3e_dasm(DASM_OPS_32) { print("<illegal 0x04_2f_3f_3e> (%08x)", op); return 4;} |
| 1161 | int 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 | |
| 1170 | int arcompact_handle04_30_dasm(DASM_OPS_32) { print("LD r-r (basecase 0x30) (%08x)", op); return 4;} |
| 1171 | int arcompact_handle04_31_dasm(DASM_OPS_32) { print("LD r-r (basecase 0x31) (%08x)", op); return 4;} |
| 1172 | int arcompact_handle04_32_dasm(DASM_OPS_32) { print("LD r-r (basecase 0x32) (%08x)", op); return 4;} |
| 1173 | int arcompact_handle04_33_dasm(DASM_OPS_32) { print("LD r-r (basecase 0x33) (%08x)", op); return 4;} |
| 1174 | int arcompact_handle04_34_dasm(DASM_OPS_32) { print("LD r-r (basecase 0x34) (%08x)", op); return 4;} |
| 1175 | int arcompact_handle04_35_dasm(DASM_OPS_32) { print("LD r-r (basecase 0x35) (%08x)", op); return 4;} |
| 1176 | int arcompact_handle04_36_dasm(DASM_OPS_32) { print("LD r-r (basecase 0x36) (%08x)", op); return 4;} |
| 1177 | int arcompact_handle04_37_dasm(DASM_OPS_32) { print("LD r-r (basecase 0x37) (%08x)", op); return 4;} |
| 1178 | int arcompact_handle04_38_dasm(DASM_OPS_32) { print("<illegal 0x04_38> (%08x)", op); return 4;} |
| 1179 | int arcompact_handle04_39_dasm(DASM_OPS_32) { print("<illegal 0x04_39> (%08x)", op); return 4;} |
| 1180 | int arcompact_handle04_3a_dasm(DASM_OPS_32) { print("<illegal 0x04_3a> (%08x)", op); return 4;} |
| 1181 | int arcompact_handle04_3b_dasm(DASM_OPS_32) { print("<illegal 0x04_3b> (%08x)", op); return 4;} |
| 1182 | int arcompact_handle04_3c_dasm(DASM_OPS_32) { print("<illegal 0x04_3c> (%08x)", op); return 4;} |
| 1183 | int arcompact_handle04_3d_dasm(DASM_OPS_32) { print("<illegal 0x04_3d> (%08x)", op); return 4;} |
| 1184 | int arcompact_handle04_3e_dasm(DASM_OPS_32) { print("<illegal 0x04_3e> (%08x)", op); return 4;} |
| 1185 | int 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? |
| 1192 | int 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 | |
| 1269 | int arcompact_handle05_00_dasm(DASM_OPS_32) { print("ASL a <- b asl c (%08x)", op); return 4;} |
| 1270 | int arcompact_handle05_01_dasm(DASM_OPS_32) { print("LSR a <- b lsr c (%08x)", op); return 4;} |
| 1271 | int arcompact_handle05_02_dasm(DASM_OPS_32) { print("ASR a <- b asr c (%08x)", op); return 4;} |
| 1272 | int arcompact_handle05_03_dasm(DASM_OPS_32) { print("ROR a <- b ror c (%08x)", op); return 4;} |
| 1273 | int arcompact_handle05_04_dasm(DASM_OPS_32) { print("MUL64 mulres <- b * c (%08x)", op); return 4;} |
| 1274 | int arcompact_handle05_05_dasm(DASM_OPS_32) { print("MULU64 mulres <- b * c (%08x)", op); return 4;} |
| 1275 | int arcompact_handle05_06_dasm(DASM_OPS_32) { print("ADDS a <- sat32 (b + c) (%08x)", op); return 4;} |
| 1276 | int arcompact_handle05_07_dasm(DASM_OPS_32) { print("SUBS a <- sat32 (b + c) (%08x)", op); return 4;} |
| 1277 | int arcompact_handle05_08_dasm(DASM_OPS_32) { print("DIVAW (%08x)", op); return 4;} |
| 1278 | int arcompact_handle05_09_dasm(DASM_OPS_32) { print("<illegal 0x05_09> (%08x)", op); return 4;} |
| 1279 | int arcompact_handle05_0a_dasm(DASM_OPS_32) { print("ASLS a <- sat32 (b << c) (%08x)", op); return 4;} |
| 1280 | int arcompact_handle05_0b_dasm(DASM_OPS_32) { print("ASRS a ,- sat32 (b >> c) (%08x)", op); return 4;} |
| 1281 | int arcompact_handle05_0c_dasm(DASM_OPS_32) { print("<illegal 0x05_0c> (%08x)", op); return 4;} |
| 1282 | int arcompact_handle05_0d_dasm(DASM_OPS_32) { print("<illegal 0x05_0d> (%08x)", op); return 4;} |
| 1283 | int arcompact_handle05_0e_dasm(DASM_OPS_32) { print("<illegal 0x05_0e> (%08x)", op); return 4;} |
| 1284 | int arcompact_handle05_0f_dasm(DASM_OPS_32) { print("<illegal 0x05_0f> (%08x)", op); return 4;} |
| 1285 | int arcompact_handle05_10_dasm(DASM_OPS_32) { print("<illegal 0x05_10> (%08x)", op); return 4;} |
| 1286 | int arcompact_handle05_11_dasm(DASM_OPS_32) { print("<illegal 0x05_11> (%08x)", op); return 4;} |
| 1287 | int arcompact_handle05_12_dasm(DASM_OPS_32) { print("<illegal 0x05_12> (%08x)", op); return 4;} |
| 1288 | int arcompact_handle05_13_dasm(DASM_OPS_32) { print("<illegal 0x05_13> (%08x)", op); return 4;} |
| 1289 | int arcompact_handle05_14_dasm(DASM_OPS_32) { print("<illegal 0x05_14> (%08x)", op); return 4;} |
| 1290 | int arcompact_handle05_15_dasm(DASM_OPS_32) { print("<illegal 0x05_15> (%08x)", op); return 4;} |
| 1291 | int arcompact_handle05_16_dasm(DASM_OPS_32) { print("<illegal 0x05_16> (%08x)", op); return 4;} |
| 1292 | int arcompact_handle05_17_dasm(DASM_OPS_32) { print("<illegal 0x05_17> (%08x)", op); return 4;} |
| 1293 | int arcompact_handle05_18_dasm(DASM_OPS_32) { print("<illegal 0x05_18> (%08x)", op); return 4;} |
| 1294 | int arcompact_handle05_19_dasm(DASM_OPS_32) { print("<illegal 0x05_19> (%08x)", op); return 4;} |
| 1295 | int arcompact_handle05_1a_dasm(DASM_OPS_32) { print("<illegal 0x05_1a> (%08x)", op); return 4;} |
| 1296 | int arcompact_handle05_1b_dasm(DASM_OPS_32) { print("<illegal 0x05_1b> (%08x)", op); return 4;} |
| 1297 | int arcompact_handle05_1c_dasm(DASM_OPS_32) { print("<illegal 0x05_1c> (%08x)", op); return 4;} |
| 1298 | int arcompact_handle05_1d_dasm(DASM_OPS_32) { print("<illegal 0x05_1d> (%08x)", op); return 4;} |
| 1299 | int arcompact_handle05_1e_dasm(DASM_OPS_32) { print("<illegal 0x05_1e> (%08x)", op); return 4;} |
| 1300 | int arcompact_handle05_1f_dasm(DASM_OPS_32) { print("<illegal 0x05_1f> (%08x)", op); return 4;} |
| 1301 | int arcompact_handle05_20_dasm(DASM_OPS_32) { print("<illegal 0x05_20> (%08x)", op); return 4;} |
| 1302 | int arcompact_handle05_21_dasm(DASM_OPS_32) { print("<illegal 0x05_21> (%08x)", op); return 4;} |
| 1303 | int arcompact_handle05_22_dasm(DASM_OPS_32) { print("<illegal 0x05_22> (%08x)", op); return 4;} |
| 1304 | int arcompact_handle05_23_dasm(DASM_OPS_32) { print("<illegal 0x05_23> (%08x)", op); return 4;} |
| 1305 | int arcompact_handle05_24_dasm(DASM_OPS_32) { print("<illegal 0x05_24> (%08x)", op); return 4;} |
| 1306 | int arcompact_handle05_25_dasm(DASM_OPS_32) { print("<illegal 0x05_25> (%08x)", op); return 4;} |
| 1307 | int arcompact_handle05_26_dasm(DASM_OPS_32) { print("<illegal 0x05_26> (%08x)", op); return 4;} |
| 1308 | int arcompact_handle05_27_dasm(DASM_OPS_32) { print("<illegal 0x05_27> (%08x)", op); return 4;} |
| 1309 | int arcompact_handle05_28_dasm(DASM_OPS_32) { print("ADDSDW (%08x)", op); return 4;} |
| 1310 | int arcompact_handle05_29_dasm(DASM_OPS_32) { print("SUBSDW (%08x)", op); return 4;} |
| 1311 | int arcompact_handle05_2a_dasm(DASM_OPS_32) { print("<illegal 0x05_2a> (%08x)", op); return 4;} |
| 1312 | int arcompact_handle05_2b_dasm(DASM_OPS_32) { print("<illegal 0x05_2b> (%08x)", op); return 4;} |
| 1313 | int arcompact_handle05_2c_dasm(DASM_OPS_32) { print("<illegal 0x05_2c> (%08x)", op); return 4;} |
| 1314 | int arcompact_handle05_2d_dasm(DASM_OPS_32) { print("<illegal 0x05_2d> (%08x)", op); return 4;} |
| 1315 | int arcompact_handle05_2e_dasm(DASM_OPS_32) { print("<illegal 0x05_2e> (%08x)", op); return 4;} |
| 1316 | int arcompact_handle05_2f_dasm(DASM_OPS_32) { print("SOP (another table) (%08x)", op); return 4;} |
| 1317 | int arcompact_handle05_30_dasm(DASM_OPS_32) { print("<illegal 0x05_30> (%08x)", op); return 4;} |
| 1318 | int arcompact_handle05_31_dasm(DASM_OPS_32) { print("<illegal 0x05_31> (%08x)", op); return 4;} |
| 1319 | int arcompact_handle05_32_dasm(DASM_OPS_32) { print("<illegal 0x05_32> (%08x)", op); return 4;} |
| 1320 | int arcompact_handle05_33_dasm(DASM_OPS_32) { print("<illegal 0x05_33> (%08x)", op); return 4;} |
| 1321 | int arcompact_handle05_34_dasm(DASM_OPS_32) { print("<illegal 0x05_34> (%08x)", op); return 4;} |
| 1322 | int arcompact_handle05_35_dasm(DASM_OPS_32) { print("<illegal 0x05_35> (%08x)", op); return 4;} |
| 1323 | int arcompact_handle05_36_dasm(DASM_OPS_32) { print("<illegal 0x05_36> (%08x)", op); return 4;} |
| 1324 | int arcompact_handle05_37_dasm(DASM_OPS_32) { print("<illegal 0x05_37> (%08x)", op); return 4;} |
| 1325 | int arcompact_handle05_38_dasm(DASM_OPS_32) { print("<illegal 0x05_38> (%08x)", op); return 4;} |
| 1326 | int arcompact_handle05_39_dasm(DASM_OPS_32) { print("<illegal 0x05_39> (%08x)", op); return 4;} |
| 1327 | int arcompact_handle05_3a_dasm(DASM_OPS_32) { print("<illegal 0x05_3a> (%08x)", op); return 4;} |
| 1328 | int arcompact_handle05_3b_dasm(DASM_OPS_32) { print("<illegal 0x05_3b> (%08x)", op); return 4;} |
| 1329 | int arcompact_handle05_3c_dasm(DASM_OPS_32) { print("<illegal 0x05_3c> (%08x)", op); return 4;} |
| 1330 | int arcompact_handle05_3d_dasm(DASM_OPS_32) { print("<illegal 0x05_3d> (%08x)", op); return 4;} |
| 1331 | int arcompact_handle05_3e_dasm(DASM_OPS_32) { print("<illegal 0x05_3e> (%08x)", op); return 4;} |
| 1332 | int arcompact_handle05_3f_dasm(DASM_OPS_32) { print("<illegal 0x05_3f> (%08x)", op); return 4;} |
| 1333 | |
| 1334 | |
| 1335 | |
| 1336 | int arcompact_handle06_dasm(DASM_OPS_32) |
| 1337 | { |
| 1338 | print("op a,b,c (06 ARC ext) (%08x)", op ); |
| 1339 | return 4; |
| 1340 | } |
| 1341 | |
| 1342 | int arcompact_handle07_dasm(DASM_OPS_32) |
| 1343 | { |
| 1344 | print("op a,b,c (07 User ext) (%08x)", op ); |
| 1345 | return 4; |
| 1346 | } |
| 1347 | |
| 1348 | int arcompact_handle08_dasm(DASM_OPS_32) |
| 1349 | { |
| 1350 | print("op a,b,c (08 User ext) (%08x)", op ); |
| 1351 | return 4; |
| 1352 | } |
| 1353 | |
| 1354 | int arcompact_handle09_dasm(DASM_OPS_32) |
| 1355 | { |
| 1356 | print("op a,b,c (09 Market ext) (%08x)", op ); |
| 1357 | return 4; |
| 1358 | } |
| 1359 | |
| 1360 | int arcompact_handle0a_dasm(DASM_OPS_32) |
| 1361 | { |
| 1362 | print("op a,b,c (0a Market ext) (%08x)", op ); |
| 1363 | return 4; |
| 1364 | } |
| 1365 | |
| 1366 | int 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 | |
| 1375 | int 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 | |
| 1392 | int 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 | |
| 1399 | int 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 | |
| 1406 | int 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 | |
| 1413 | int 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 | |
| 1421 | int 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 | |
| 1437 | int 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 | |
| 1444 | int 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 | |
| 1451 | int 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 | |
| 1458 | int 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 | |
| 1466 | int 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 | |
| 1496 | int 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 | |
| 1519 | int 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 | |
| 1539 | int 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 | |
| 1559 | int 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 | |
| 1582 | int 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: |
| 312 | 1597 | { |
| 313 | | case 0x0f: |
| 1598 | // General Operations w/ Register |
| 1599 | // 01111 bbb iii 00000 |
| 1600 | UINT8 subinstr2 = (op & 0x00e0) >> 5; |
| 1601 | |
| 1602 | switch (subinstr2) |
| 314 | 1603 | { |
| 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); |
| 1604 | default: |
| 1605 | print("%s (%04x)", table0f_00[subinstr2], op & ~0xf8ff); |
| 1606 | return 2; |
| 319 | 1607 | |
| 320 | | #if 1 |
| 321 | | switch (subinstr) |
| 1608 | case 0x7: |
| 322 | 1609 | { |
| 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 | } |
| 323 | 1621 | |
| 324 | | default: |
| 325 | | print("%s (%04x)", table0f[subinstr], op & ~0xf81f); |
| 326 | | break; |
| 1622 | return 2; |
| 1623 | } |
| 327 | 1624 | |
| 328 | | case 0x00: |
| 329 | | { |
| 330 | | // General Operations w/ Register |
| 331 | | // 01111 bbb iii 00000 |
| 332 | | UINT8 subinstr2 = (op & 0x00e0) >> 5; |
| 1625 | int arcompact_handle10_dasm(DASM_OPS_16) |
| 1626 | { |
| 1627 | print("LD_S (%04x)", op); |
| 1628 | return 2; |
| 1629 | } |
| 333 | 1630 | |
| 334 | | switch (subinstr2) |
| 335 | | { |
| 336 | | default: |
| 337 | | print("%s (%04x)", table0f_00[subinstr2], op & ~0xf8ff); |
| 338 | | break; |
| 1631 | int arcompact_handle11_dasm(DASM_OPS_16) |
| 1632 | { |
| 1633 | print("LDB_S (%04x)", op); |
| 1634 | return 2; |
| 1635 | } |
| 339 | 1636 | |
| 340 | | case 0x7: |
| 341 | | { |
| 342 | | // General Operations w/o Register |
| 343 | | // 01111 iii 111 00000 |
| 344 | | UINT8 subinstr3 = (op & 0x0700) >> 8; |
| 1637 | int arcompact_handle12_dasm(DASM_OPS_16) |
| 1638 | { |
| 1639 | print("LDW_S (%04x)", op); |
| 1640 | return 2; |
| 1641 | } |
| 345 | 1642 | |
| 346 | | print("%s (%04x)", table0f_00_07[subinstr3], op & ~0xffff); |
| 1643 | int arcompact_handle13_dasm(DASM_OPS_16) |
| 1644 | { |
| 1645 | print("LSW_S.X (%04x)", op); |
| 1646 | return 2; |
| 1647 | } |
| 347 | 1648 | |
| 348 | | break; |
| 349 | | } |
| 350 | | } |
| 351 | | } |
| 352 | | } |
| 353 | | #endif |
| 354 | | |
| 355 | | break; |
| 1649 | int arcompact_handle14_dasm(DASM_OPS_16) |
| 1650 | { |
| 1651 | print("ST_S (%04x)", op); |
| 1652 | return 2; |
| 1653 | } |
| 356 | 1654 | |
| 357 | | } |
| 1655 | int arcompact_handle15_dasm(DASM_OPS_16) |
| 1656 | { |
| 1657 | print("STB_S (%04x)", op); |
| 1658 | return 2; |
| 1659 | } |
| 358 | 1660 | |
| 1661 | int arcompact_handle16_dasm(DASM_OPS_16) |
| 1662 | { |
| 1663 | print("STW_S (%04x)", op); |
| 1664 | return 2; |
| 1665 | } |
| 359 | 1666 | |
| 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; |
| 1667 | int arcompact_handle17_dasm(DASM_OPS_16) |
| 1668 | { |
| 1669 | int size = 2; |
| 1670 | UINT8 subinstr = (op & 0x00e0) >> 5; |
| 1671 | op &= ~0x00e0; |
| 367 | 1672 | |
| 368 | | } |
| 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 | } |
| 369 | 1684 | |
| 370 | | default: |
| 371 | | print("%s (%04x)", basic[instruction], op & ~0xf800); |
| 372 | | break; |
| 1685 | return size; |
| 1686 | } |
| 1687 | |
| 1688 | int 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 | |
| 1695 | int 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 | |
| 1702 | int 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 | |
| 1709 | int 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 | |
| 1716 | int 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 | |
| 1723 | int 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 | |
| 1730 | int arcompact_handle17_06_dasm(DASM_OPS_16) |
| 1731 | { |
| 1732 | int size = 2; |
| 1733 | print("BMSK_S (%04x)", op); |
| 1734 | return size; |
| 1735 | } |
| 1736 | |
| 1737 | int arcompact_handle17_07_dasm(DASM_OPS_16) |
| 1738 | { |
| 1739 | int size = 2; |
| 1740 | print("BTST_S (%04x)", op); |
| 1741 | return size; |
| 1742 | } |
| 1743 | |
| 1744 | int 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 | |
| 1769 | int arcompact_handle18_00_dasm(DASM_OPS_16) |
| 1770 | { |
| 1771 | print("LD_S (SP) (%04x)", op); |
| 1772 | return 2; |
| 1773 | } |
| 1774 | |
| 1775 | int arcompact_handle18_01_dasm(DASM_OPS_16) |
| 1776 | { |
| 1777 | print("LDB_S (SP) (%04x)", op); |
| 1778 | return 2; |
| 1779 | } |
| 1780 | |
| 1781 | int arcompact_handle18_02_dasm(DASM_OPS_16) |
| 1782 | { |
| 1783 | print("ST_S (SP) (%04x)", op); |
| 1784 | return 2; |
| 1785 | } |
| 1786 | |
| 1787 | int arcompact_handle18_03_dasm(DASM_OPS_16) |
| 1788 | { |
| 1789 | print("STB_S (SP) (%04x)", op); |
| 1790 | return 2; |
| 1791 | } |
| 1792 | |
| 1793 | int arcompact_handle18_04_dasm(DASM_OPS_16) |
| 1794 | { |
| 1795 | print("ADD_S (SP) (%04x)", op); |
| 1796 | return 2; |
| 1797 | } |
| 1798 | |
| 1799 | |
| 1800 | |
| 1801 | |
| 1802 | |
| 1803 | int 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 |
| 1824 | int 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 | |
| 1834 | int 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 | |
| 1844 | int arcompact_handle18_05_02_dasm(DASM_OPS_16) { print("<illegal 0x18_05_02> (%04x)", op); return 2;} |
| 1845 | int arcompact_handle18_05_03_dasm(DASM_OPS_16) { print("<illegal 0x18_05_03> (%04x)", op); return 2;} |
| 1846 | int arcompact_handle18_05_04_dasm(DASM_OPS_16) { print("<illegal 0x18_05_04> (%04x)", op); return 2;} |
| 1847 | int arcompact_handle18_05_05_dasm(DASM_OPS_16) { print("<illegal 0x18_05_05> (%04x)", op); return 2;} |
| 1848 | int arcompact_handle18_05_06_dasm(DASM_OPS_16) { print("<illegal 0x18_05_06> (%04x)", op); return 2;} |
| 1849 | int arcompact_handle18_05_07_dasm(DASM_OPS_16) { print("<illegal 0x18_05_07> (%04x)", op); return 2;} |
| 1850 | |
| 1851 | |
| 1852 | int 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 |
| 1899 | int arcompact_handle18_06_00_dasm(DASM_OPS_16) { print("<illegal 0x18_06_00> (%04x)", op); return 2;} |
| 1900 | |
| 1901 | int 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 | |
| 1911 | int arcompact_handle18_06_02_dasm(DASM_OPS_16) { print("<illegal 0x18_06_02> (%04x)", op); return 2;} |
| 1912 | int arcompact_handle18_06_03_dasm(DASM_OPS_16) { print("<illegal 0x18_06_03> (%04x)", op); return 2;} |
| 1913 | int arcompact_handle18_06_04_dasm(DASM_OPS_16) { print("<illegal 0x18_06_04> (%04x)", op); return 2;} |
| 1914 | int arcompact_handle18_06_05_dasm(DASM_OPS_16) { print("<illegal 0x18_06_05> (%04x)", op); return 2;} |
| 1915 | int arcompact_handle18_06_06_dasm(DASM_OPS_16) { print("<illegal 0x18_06_06> (%04x)", op); return 2;} |
| 1916 | int arcompact_handle18_06_07_dasm(DASM_OPS_16) { print("<illegal 0x18_06_07> (%04x)", op); return 2;} |
| 1917 | int arcompact_handle18_06_08_dasm(DASM_OPS_16) { print("<illegal 0x18_06_08> (%04x)", op); return 2;} |
| 1918 | int arcompact_handle18_06_09_dasm(DASM_OPS_16) { print("<illegal 0x18_06_09> (%04x)", op); return 2;} |
| 1919 | int arcompact_handle18_06_0a_dasm(DASM_OPS_16) { print("<illegal 0x18_06_0a> (%04x)", op); return 2;} |
| 1920 | int arcompact_handle18_06_0b_dasm(DASM_OPS_16) { print("<illegal 0x18_06_0b> (%04x)", op); return 2;} |
| 1921 | int arcompact_handle18_06_0c_dasm(DASM_OPS_16) { print("<illegal 0x18_06_0c> (%04x)", op); return 2;} |
| 1922 | int arcompact_handle18_06_0d_dasm(DASM_OPS_16) { print("<illegal 0x18_06_0d> (%04x)", op); return 2;} |
| 1923 | int arcompact_handle18_06_0e_dasm(DASM_OPS_16) { print("<illegal 0x18_06_0e> (%04x)", op); return 2;} |
| 1924 | int arcompact_handle18_06_0f_dasm(DASM_OPS_16) { print("<illegal 0x18_06_0f> (%04x)", op); return 2;} |
| 1925 | int arcompact_handle18_06_10_dasm(DASM_OPS_16) { print("<illegal 0x18_06_10> (%04x)", op); return 2;} |
| 1926 | |
| 1927 | int 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 | |
| 1940 | int arcompact_handle18_06_12_dasm(DASM_OPS_16) { print("<illegal 0x18_06_12> (%04x)", op); return 2;} |
| 1941 | int arcompact_handle18_06_13_dasm(DASM_OPS_16) { print("<illegal 0x18_06_13> (%04x)", op); return 2;} |
| 1942 | int arcompact_handle18_06_14_dasm(DASM_OPS_16) { print("<illegal 0x18_06_14> (%04x)", op); return 2;} |
| 1943 | int arcompact_handle18_06_15_dasm(DASM_OPS_16) { print("<illegal 0x18_06_15> (%04x)", op); return 2;} |
| 1944 | int arcompact_handle18_06_16_dasm(DASM_OPS_16) { print("<illegal 0x18_06_16> (%04x)", op); return 2;} |
| 1945 | int arcompact_handle18_06_17_dasm(DASM_OPS_16) { print("<illegal 0x18_06_17> (%04x)", op); return 2;} |
| 1946 | int arcompact_handle18_06_18_dasm(DASM_OPS_16) { print("<illegal 0x18_06_18> (%04x)", op); return 2;} |
| 1947 | int arcompact_handle18_06_19_dasm(DASM_OPS_16) { print("<illegal 0x18_06_19> (%04x)", op); return 2;} |
| 1948 | int arcompact_handle18_06_1a_dasm(DASM_OPS_16) { print("<illegal 0x18_06_1a> (%04x)", op); return 2;} |
| 1949 | int arcompact_handle18_06_1b_dasm(DASM_OPS_16) { print("<illegal 0x18_06_1b> (%04x)", op); return 2;} |
| 1950 | int arcompact_handle18_06_1c_dasm(DASM_OPS_16) { print("<illegal 0x18_06_1c> (%04x)", op); return 2;} |
| 1951 | int arcompact_handle18_06_1d_dasm(DASM_OPS_16) { print("<illegal 0x18_06_1d> (%04x)", op); return 2;} |
| 1952 | int arcompact_handle18_06_1e_dasm(DASM_OPS_16) { print("<illegal 0x18_06_1e> (%04x)", op); return 2;} |
| 1953 | int arcompact_handle18_06_1f_dasm(DASM_OPS_16) { print("<illegal 0x18_06_1f> (%04x)", op); return 2;} |
| 1954 | |
| 1955 | |
| 1956 | |
| 1957 | |
| 1958 | int 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 |
| 2005 | int arcompact_handle18_07_00_dasm(DASM_OPS_16) { print("<illegal 0x18_07_00> (%04x)", op); return 2;} |
| 2006 | |
| 2007 | int 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 | |
| 2017 | int arcompact_handle18_07_02_dasm(DASM_OPS_16) { print("<illegal 0x18_07_02> (%04x)", op); return 2;} |
| 2018 | int arcompact_handle18_07_03_dasm(DASM_OPS_16) { print("<illegal 0x18_07_03> (%04x)", op); return 2;} |
| 2019 | int arcompact_handle18_07_04_dasm(DASM_OPS_16) { print("<illegal 0x18_07_04> (%04x)", op); return 2;} |
| 2020 | int arcompact_handle18_07_05_dasm(DASM_OPS_16) { print("<illegal 0x18_07_05> (%04x)", op); return 2;} |
| 2021 | int arcompact_handle18_07_06_dasm(DASM_OPS_16) { print("<illegal 0x18_07_06> (%04x)", op); return 2;} |
| 2022 | int arcompact_handle18_07_07_dasm(DASM_OPS_16) { print("<illegal 0x18_07_07> (%04x)", op); return 2;} |
| 2023 | int arcompact_handle18_07_08_dasm(DASM_OPS_16) { print("<illegal 0x18_07_08> (%04x)", op); return 2;} |
| 2024 | int arcompact_handle18_07_09_dasm(DASM_OPS_16) { print("<illegal 0x18_07_09> (%04x)", op); return 2;} |
| 2025 | int arcompact_handle18_07_0a_dasm(DASM_OPS_16) { print("<illegal 0x18_07_0a> (%04x)", op); return 2;} |
| 2026 | int arcompact_handle18_07_0b_dasm(DASM_OPS_16) { print("<illegal 0x18_07_0b> (%04x)", op); return 2;} |
| 2027 | int arcompact_handle18_07_0c_dasm(DASM_OPS_16) { print("<illegal 0x18_07_0c> (%04x)", op); return 2;} |
| 2028 | int arcompact_handle18_07_0d_dasm(DASM_OPS_16) { print("<illegal 0x18_07_0d> (%04x)", op); return 2;} |
| 2029 | int arcompact_handle18_07_0e_dasm(DASM_OPS_16) { print("<illegal 0x18_07_0e> (%04x)", op); return 2;} |
| 2030 | int arcompact_handle18_07_0f_dasm(DASM_OPS_16) { print("<illegal 0x18_07_0f> (%04x)", op); return 2;} |
| 2031 | int arcompact_handle18_07_10_dasm(DASM_OPS_16) { print("<illegal 0x18_07_10> (%04x)", op); return 2;} |
| 2032 | |
| 2033 | int 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 | |
| 2046 | int arcompact_handle18_07_12_dasm(DASM_OPS_16) { print("<illegal 0x18_07_12> (%04x)", op); return 2;} |
| 2047 | int arcompact_handle18_07_13_dasm(DASM_OPS_16) { print("<illegal 0x18_07_13> (%04x)", op); return 2;} |
| 2048 | int arcompact_handle18_07_14_dasm(DASM_OPS_16) { print("<illegal 0x18_07_14> (%04x)", op); return 2;} |
| 2049 | int arcompact_handle18_07_15_dasm(DASM_OPS_16) { print("<illegal 0x18_07_15> (%04x)", op); return 2;} |
| 2050 | int arcompact_handle18_07_16_dasm(DASM_OPS_16) { print("<illegal 0x18_07_16> (%04x)", op); return 2;} |
| 2051 | int arcompact_handle18_07_17_dasm(DASM_OPS_16) { print("<illegal 0x18_07_17> (%04x)", op); return 2;} |
| 2052 | int arcompact_handle18_07_18_dasm(DASM_OPS_16) { print("<illegal 0x18_07_18> (%04x)", op); return 2;} |
| 2053 | int arcompact_handle18_07_19_dasm(DASM_OPS_16) { print("<illegal 0x18_07_19> (%04x)", op); return 2;} |
| 2054 | int arcompact_handle18_07_1a_dasm(DASM_OPS_16) { print("<illegal 0x18_07_1a> (%04x)", op); return 2;} |
| 2055 | int arcompact_handle18_07_1b_dasm(DASM_OPS_16) { print("<illegal 0x18_07_1b> (%04x)", op); return 2;} |
| 2056 | int arcompact_handle18_07_1c_dasm(DASM_OPS_16) { print("<illegal 0x18_07_1c> (%04x)", op); return 2;} |
| 2057 | int arcompact_handle18_07_1d_dasm(DASM_OPS_16) { print("<illegal 0x18_07_1d> (%04x)", op); return 2;} |
| 2058 | int arcompact_handle18_07_1e_dasm(DASM_OPS_16) { print("<illegal 0x18_07_1e> (%04x)", op); return 2;} |
| 2059 | int arcompact_handle18_07_1f_dasm(DASM_OPS_16) { print("<illegal 0x18_07_1f> (%04x)", op); return 2;} |
| 2060 | |
| 2061 | |
| 2062 | int 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 | |
| 2078 | int arcompact_handle19_00_dasm(DASM_OPS_16) { print("LD_S r0 <- m[GP + s11].long (%04x)", op); return 2;} |
| 2079 | int arcompact_handle19_01_dasm(DASM_OPS_16) { print("LDB_S r0 <- m[GP + s9].byte (%04x)", op); return 2;} |
| 2080 | int arcompact_handle19_02_dasm(DASM_OPS_16) { print("LDW_S r0 <- m[GP + s10].word (%04x)", op); return 2;} |
| 2081 | int arcompact_handle19_03_dasm(DASM_OPS_16) { print("ADD_S r0 <- GP + s11 (%04x)", op); return 2;} |
| 2082 | |
| 2083 | |
| 2084 | |
| 2085 | int arcompact_handle1a_dasm(DASM_OPS_16) |
| 2086 | { |
| 2087 | print("PCL Instr (%04x)", op); |
| 2088 | return 2; |
| 2089 | } |
| 2090 | |
| 2091 | int arcompact_handle1b_dasm(DASM_OPS_16) |
| 2092 | { |
| 2093 | print("MOV_S (%04x)", op); |
| 2094 | return 2; |
| 2095 | } |
| 2096 | |
| 2097 | int 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 | |
| 2111 | int arcompact_handle1c_00_dasm(DASM_OPS_16) { print("ADD_S b <- b + u7 (%04x)", op); return 2;} |
| 2112 | int arcompact_handle1c_01_dasm(DASM_OPS_16) { print("CMP_S b - u7 (%04x)", op); return 2;} |
| 2113 | |
| 2114 | |
| 2115 | int 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 | |
| 2129 | int arcompact_handle1d_00_dasm(DASM_OPS_16) { print("BREQ_S (%04x)", op); return 2;} |
| 2130 | int arcompact_handle1d_01_dasm(DASM_OPS_16) { print("BRNE_S (%04x)", op); return 2;} |
| 2131 | |
| 2132 | |
| 2133 | int 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 | |
| 2149 | int arcompact_handle1e_00_dasm(DASM_OPS_16) { print("B_S (%04x)", op); return 2;} |
| 2150 | int arcompact_handle1e_01_dasm(DASM_OPS_16) { print("BEQ_S (%04x)", op); return 2;} |
| 2151 | int arcompact_handle1e_02_dasm(DASM_OPS_16) { print("BNE_S (%04x)", op); return 2;} |
| 2152 | |
| 2153 | |
| 2154 | int 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 | |
| 2176 | int arcompact_handle1e_03_00_dasm(DASM_OPS_16) { print("BGT_S (%04x)", op); return 2;} |
| 2177 | int arcompact_handle1e_03_01_dasm(DASM_OPS_16) { print("BGE_S (%04x)", op); return 2;} |
| 2178 | int arcompact_handle1e_03_02_dasm(DASM_OPS_16) { print("BLT_S (%04x)", op); return 2;} |
| 2179 | int arcompact_handle1e_03_03_dasm(DASM_OPS_16) { print("BLE_S (%04x)", op); return 2;} |
| 2180 | int arcompact_handle1e_03_04_dasm(DASM_OPS_16) { print("BHI_S (%04x)", op); return 2;} |
| 2181 | int arcompact_handle1e_03_05_dasm(DASM_OPS_16) { print("BHS_S (%04x)", op); return 2;} |
| 2182 | int arcompact_handle1e_03_06_dasm(DASM_OPS_16) { print("BLO_S (%04x)", op); return 2;} |
| 2183 | int arcompact_handle1e_03_07_dasm(DASM_OPS_16) { print("BLS_S (%04x)", op); return 2;} |
| 2184 | |
| 2185 | |
| 2186 | |
| 2187 | int arcompact_handle1f_dasm(DASM_OPS_16) |
| 2188 | { |
| 2189 | print("BL_S (%04x)", op); |
| 2190 | return 2; |
| 2191 | } |
| 2192 | |
| 2193 | CPU_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) |
| 373 | 2224 | } |
| 374 | 2225 | } |
| 2226 | else |
| 2227 | { |
| 2228 | size = 2; |
| 2229 | op &= ~0xf800; |
| 375 | 2230 | |
| 376 | 2231 | |
| 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 | |
| 377 | 2257 | return size | DASMFLAG_SUPPORTED; |
| 378 | 2258 | } |
trunk/src/emu/rendlay.c
| r242303 | r242304 | |
| 94 | 94 | |
| 95 | 95 | enum |
| 96 | 96 | { |
| 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 |
| 100 | 100 | }; |
| 101 | 101 | |
| 102 | 102 | |
| r242303 | r242304 | |
| 120 | 120 | |
| 121 | 121 | inline int gcd(int a, int b) |
| 122 | 122 | { |
| 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; |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | |
| r242303 | r242304 | |
| 137 | 137 | |
| 138 | 138 | inline void reduce_fraction(int &num, int &den) |
| 139 | 139 | { |
| 140 | | // search the greatest common divisor |
| 141 | | int div = gcd(num, den); |
| 140 | // search the greatest common divisor |
| 141 | int div = gcd(num, den); |
| 142 | 142 | |
| 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 | } |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | |
| r242303 | r242304 | |
| 161 | 161 | |
| 162 | 162 | static int get_variable_value(running_machine &machine, const char *string, char **outputptr) |
| 163 | 163 | { |
| 164 | | char temp[100]; |
| 164 | char temp[100]; |
| 165 | 165 | |
| 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 | } |
| 181 | 181 | |
| 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 | } |
| 192 | 192 | |
| 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 | } |
| 200 | 200 | |
| 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 | } |
| 209 | 209 | |
| 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; |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | |
| r242303 | r242304 | |
| 222 | 222 | |
| 223 | 223 | static const char *xml_get_attribute_string_with_subst(running_machine &machine, xml_data_node &node, const char *attribute, const char *defvalue) |
| 224 | 224 | { |
| 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]; |
| 227 | 227 | |
| 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; |
| 231 | 231 | |
| 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; |
| 235 | 235 | |
| 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++; |
| 244 | 244 | |
| 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; |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | |
| r242303 | r242304 | |
| 259 | 259 | |
| 260 | 260 | static int xml_get_attribute_int_with_subst(running_machine &machine, xml_data_node &node, const char *attribute, int defvalue) |
| 261 | 261 | { |
| 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; |
| 264 | 264 | |
| 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; |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | |
| r242303 | r242304 | |
| 282 | 282 | |
| 283 | 283 | static float xml_get_attribute_float_with_subst(running_machine &machine, xml_data_node &node, const char *attribute, float defvalue) |
| 284 | 284 | { |
| 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; |
| 287 | 287 | |
| 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; |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | |
| r242303 | r242304 | |
| 297 | 297 | |
| 298 | 298 | void parse_bounds(running_machine &machine, xml_data_node *boundsnode, render_bounds &bounds) |
| 299 | 299 | { |
| 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 | } |
| 307 | 307 | |
| 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"); |
| 327 | 327 | |
| 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); |
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | |
| r242303 | r242304 | |
| 337 | 337 | |
| 338 | 338 | void parse_color(running_machine &machine, xml_data_node *colornode, render_color &color) |
| 339 | 339 | { |
| 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 | } |
| 346 | 346 | |
| 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); |
| 352 | 352 | |
| 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); |
| 357 | 357 | } |
| 358 | 358 | |
| 359 | 359 | |
| r242303 | r242304 | |
| 364 | 364 | |
| 365 | 365 | static void parse_orientation(running_machine &machine, xml_data_node *orientnode, int &orientation) |
| 366 | 366 | { |
| 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 | } |
| 373 | 373 | |
| 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; |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | |
| r242303 | r242304 | |
| 400 | 400 | //------------------------------------------------- |
| 401 | 401 | |
| 402 | 402 | layout_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) |
| 407 | 407 | { |
| 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; |
| 413 | 413 | |
| 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); |
| 416 | 416 | |
| 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))); |
| 424 | 424 | |
| 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; |
| 431 | 431 | |
| 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 | | } |
| 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 | } |
| 454 | 454 | |
| 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); |
| 462 | 462 | |
| 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 | } |
| 472 | 472 | |
| 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); |
| 475 | 475 | } |
| 476 | 476 | |
| 477 | 477 | |
| r242303 | r242304 | |
| 492 | 492 | |
| 493 | 493 | render_texture *layout_element::state_texture(int state) |
| 494 | 494 | { |
| 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; |
| 503 | 503 | } |
| 504 | 504 | |
| 505 | 505 | |
| r242303 | r242304 | |
| 511 | 511 | |
| 512 | 512 | void layout_element::element_scale(bitmap_argb32 &dest, bitmap_argb32 &source, const rectangle &sbounds, void *param) |
| 513 | 513 | { |
| 514 | | texture *elemtex = (texture *)param; |
| 514 | texture *elemtex = (texture *)param; |
| 515 | 515 | |
| 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(); |
| 527 | 527 | |
| 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 | } |
| 531 | 531 | } |
| 532 | 532 | |
| 533 | 533 | |
| r242303 | r242304 | |
| 540 | 540 | //------------------------------------------------- |
| 541 | 541 | |
| 542 | 542 | layout_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) |
| 546 | 546 | { |
| 547 | 547 | } |
| 548 | 548 | |
| r242303 | r242304 | |
| 553 | 553 | |
| 554 | 554 | layout_element::texture::~texture() |
| 555 | 555 | { |
| 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); |
| 558 | 558 | } |
| 559 | 559 | |
| 560 | 560 | |
| r242303 | r242304 | |
| 568 | 568 | //------------------------------------------------- |
| 569 | 569 | |
| 570 | 570 | layout_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) |
| 574 | 574 | { |
| 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; |
| 577 | 577 | |
| 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); |
| 582 | 582 | |
| 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 | } |
| 593 | 593 | |
| 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 | } |
| 601 | 601 | |
| 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 | } |
| 615 | 615 | |
| 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 | } |
| 623 | 623 | |
| 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; |
| 628 | 628 | |
| 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"); |
| 630 | 630 | |
| 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; |
| 644 | 644 | |
| 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; |
| 648 | 648 | |
| 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)); |
| 657 | 657 | |
| 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 | } |
| 668 | 668 | |
| 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); |
| 673 | 673 | |
| 674 | | } |
| 674 | } |
| 675 | 675 | |
| 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; |
| 679 | 679 | |
| 680 | | // led8seg nodes |
| 681 | | else if (strcmp(compnode.name, "led8seg") == 0) |
| 682 | | m_type = CTYPE_LED8SEG; |
| 680 | // led8seg_gts1 nodes |
| 681 | else if (strcmp(compnode.name, "led8seg_gts1") == 0) |
| 682 | m_type = CTYPE_LED8SEG_GTS1; |
| 683 | 683 | |
| 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; |
| 687 | 687 | |
| 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; |
| 691 | 691 | |
| 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; |
| 695 | 695 | |
| 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; |
| 699 | 699 | |
| 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; |
| 703 | 703 | |
| 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; |
| 707 | 707 | |
| 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); |
| 711 | 711 | } |
| 712 | 712 | |
| 713 | 713 | |
| r242303 | r242304 | |
| 726 | 726 | |
| 727 | 727 | void layout_element::component::draw(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) |
| 728 | 728 | { |
| 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; |
| 739 | 739 | |
| 740 | | case CTYPE_RECT: |
| 741 | | draw_rect(dest, bounds); |
| 742 | | break; |
| 740 | case CTYPE_RECT: |
| 741 | draw_rect(dest, bounds); |
| 742 | break; |
| 743 | 743 | |
| 744 | | case CTYPE_DISK: |
| 745 | | draw_disk(dest, bounds); |
| 746 | | break; |
| 744 | case CTYPE_DISK: |
| 745 | draw_disk(dest, bounds); |
| 746 | break; |
| 747 | 747 | |
| 748 | | case CTYPE_TEXT: |
| 749 | | draw_text(machine, dest, bounds); |
| 750 | | break; |
| 748 | case CTYPE_TEXT: |
| 749 | draw_text(machine, dest, bounds); |
| 750 | break; |
| 751 | 751 | |
| 752 | | case CTYPE_LED7SEG: |
| 753 | | draw_led7seg(dest, bounds, state); |
| 754 | | break; |
| 752 | case CTYPE_LED7SEG: |
| 753 | draw_led7seg(dest, bounds, state); |
| 754 | break; |
| 755 | 755 | |
| 756 | | case CTYPE_LED8SEG: |
| 757 | | draw_led8seg(dest, bounds, state); |
| 758 | | break; |
| 756 | case CTYPE_LED8SEG_GTS1: |
| 757 | draw_led8seg_gts1(dest, bounds, state); |
| 758 | break; |
| 759 | 759 | |
| 760 | | case CTYPE_LED14SEG: |
| 761 | | draw_led14seg(dest, bounds, state); |
| 762 | | break; |
| 760 | case CTYPE_LED14SEG: |
| 761 | draw_led14seg(dest, bounds, state); |
| 762 | break; |
| 763 | 763 | |
| 764 | | case CTYPE_LED16SEG: |
| 765 | | draw_led16seg(dest, bounds, state); |
| 766 | | break; |
| 764 | case CTYPE_LED16SEG: |
| 765 | draw_led16seg(dest, bounds, state); |
| 766 | break; |
| 767 | 767 | |
| 768 | | case CTYPE_LED14SEGSC: |
| 769 | | draw_led14segsc(dest, bounds, state); |
| 770 | | break; |
| 768 | case CTYPE_LED14SEGSC: |
| 769 | draw_led14segsc(dest, bounds, state); |
| 770 | break; |
| 771 | 771 | |
| 772 | | case CTYPE_LED16SEGSC: |
| 773 | | draw_led16segsc(dest, bounds, state); |
| 774 | | break; |
| 772 | case CTYPE_LED16SEGSC: |
| 773 | draw_led16segsc(dest, bounds, state); |
| 774 | break; |
| 775 | 775 | |
| 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; |
| 779 | 779 | |
| 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; |
| 783 | 783 | |
| 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; |
| 787 | 787 | |
| 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; |
| 791 | 791 | |
| 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; |
| 795 | 795 | |
| 796 | | default: |
| 797 | | throw emu_fatalerror("Unknown component type requested draw()"); |
| 798 | | } |
| 796 | default: |
| 797 | throw emu_fatalerror("Unknown component type requested draw()"); |
| 798 | } |
| 799 | 799 | } |
| 800 | 800 | |
| 801 | 801 | |
| r242303 | r242304 | |
| 806 | 806 | |
| 807 | 807 | void layout_element::component::draw_rect(bitmap_argb32 &dest, const rectangle &bounds) |
| 808 | 808 | { |
| 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; |
| 814 | 814 | |
| 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; |
| 823 | 823 | |
| 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 | } |
| 832 | 832 | |
| 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 | } |
| 837 | 837 | } |
| 838 | 838 | |
| 839 | 839 | |
| r242303 | r242304 | |
| 844 | 844 | |
| 845 | 845 | void layout_element::component::draw_disk(bitmap_argb32 &dest, const rectangle &bounds) |
| 846 | 846 | { |
| 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; |
| 852 | 852 | |
| 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); |
| 859 | 859 | |
| 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); |
| 865 | 865 | |
| 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); |
| 869 | 869 | |
| 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; |
| 876 | 876 | |
| 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 | } |
| 885 | 885 | |
| 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 | } |
| 890 | 890 | } |
| 891 | 891 | |
| 892 | 892 | |
| r242303 | r242304 | |
| 896 | 896 | |
| 897 | 897 | void layout_element::component::draw_text(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds) |
| 898 | 898 | { |
| 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; |
| 904 | 904 | |
| 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; |
| 909 | 909 | |
| 910 | 910 | |
| 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 | } |
| 918 | 918 | |
| 919 | 919 | |
| 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; |
| 928 | 928 | |
| 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; |
| 933 | 933 | |
| 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 | } |
| 939 | 939 | |
| 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()); |
| 942 | 942 | |
| 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); |
| 949 | 949 | |
| 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 | } |
| 977 | 977 | |
| 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 | } |
| 981 | 981 | |
| 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); |
| 984 | 984 | } |
| 985 | 985 | |
| 986 | 986 | void layout_element::component::draw_simplecounter(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) |
| 987 | 987 | { |
| 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); |
| 992 | 992 | } |
| 993 | 993 | |
| 994 | 994 | /* 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 */ |
| 995 | 995 | void layout_element::component::draw_reel(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) |
| 996 | 996 | { |
| 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; |
| 1004 | 1004 | |
| 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; |
| 1007 | 1007 | |
| 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; |
| 1013 | 1013 | |
| 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; |
| 1018 | 1018 | |
| 1019 | 1019 | |
| 1020 | | int curry = 0; |
| 1021 | | int num_shown = m_numsymbolsvisible; |
| 1020 | int curry = 0; |
| 1021 | int num_shown = m_numsymbolsvisible; |
| 1022 | 1022 | |
| 1023 | | int ourheight = bounds.height(); |
| 1023 | int ourheight = bounds.height(); |
| 1024 | 1024 | |
| 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; |
| 1028 | 1028 | |
| 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 | } |
| 1037 | 1037 | |
| 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)); |
| 1043 | 1043 | |
| 1044 | | int endpos = basey+ourheight/num_shown; |
| 1044 | int endpos = basey+ourheight/num_shown; |
| 1045 | 1045 | |
| 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 | } |
| 1056 | 1056 | |
| 1057 | | INT32 curx; |
| 1058 | | curx = bounds.min_x + (bounds.width() - width) / 2; |
| 1057 | INT32 curx; |
| 1058 | curx = bounds.min_x + (bounds.width() - width) / 2; |
| 1059 | 1059 | |
| 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); |
| 1063 | 1063 | |
| 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); |
| 1067 | 1067 | |
| 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); |
| 1071 | 1071 | |
| 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; |
| 1075 | 1075 | |
| 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 | } |
| 1093 | 1093 | |
| 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()); |
| 1101 | 1101 | |
| 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); |
| 1108 | 1108 | |
| 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; |
| 1113 | 1113 | |
| 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 | } |
| 1137 | 1137 | |
| 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); |
| 1140 | 1140 | |
| 1141 | | } |
| 1141 | } |
| 1142 | 1142 | |
| 1143 | | } |
| 1144 | | } |
| 1143 | } |
| 1144 | } |
| 1145 | 1145 | |
| 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 | } |
| 1151 | 1151 | } |
| 1152 | 1152 | |
| 1153 | 1153 | |
| 1154 | 1154 | void layout_element::component::draw_beltreel(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) |
| 1155 | 1155 | { |
| 1156 | | const int max_state_used = 0x10000; |
| 1156 | const int max_state_used = 0x10000; |
| 1157 | 1157 | |
| 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; |
| 1160 | 1160 | |
| 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; |
| 1166 | 1166 | |
| 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; |
| 1173 | 1173 | |
| 1174 | | int ourwidth = bounds.width(); |
| 1174 | int ourwidth = bounds.width(); |
| 1175 | 1175 | |
| 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 | } |
| 1187 | 1187 | |
| 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)); |
| 1193 | 1193 | |
| 1194 | | int endpos = basex+(ourwidth/num_shown); |
| 1194 | int endpos = basex+(ourwidth/num_shown); |
| 1195 | 1195 | |
| 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 | } |
| 1206 | 1206 | |
| 1207 | | INT32 curx; |
| 1208 | | curx = bounds.min_x; |
| 1207 | INT32 curx; |
| 1208 | curx = bounds.min_x; |
| 1209 | 1209 | |
| 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); |
| 1213 | 1213 | |
| 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()); |
| 1217 | 1217 | |
| 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); |
| 1221 | 1221 | |
| 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; |
| 1225 | 1225 | |
| 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 | } |
| 1243 | 1243 | |
| 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()); |
| 1251 | 1251 | |
| 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); |
| 1258 | 1258 | |
| 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; |
| 1263 | 1263 | |
| 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 | } |
| 1287 | 1287 | |
| 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); |
| 1290 | 1290 | |
| 1291 | | } |
| 1291 | } |
| 1292 | 1292 | |
| 1293 | | } |
| 1294 | | } |
| 1293 | } |
| 1294 | } |
| 1295 | 1295 | |
| 1296 | | currx += ourwidth/num_shown; |
| 1297 | | } |
| 1296 | currx += ourwidth/num_shown; |
| 1297 | } |
| 1298 | 1298 | |
| 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); |
| 1301 | 1301 | } |
| 1302 | 1302 | |
| 1303 | 1303 | |
| r242303 | r242304 | |
| 1308 | 1308 | |
| 1309 | 1309 | void layout_element::component::load_bitmap() |
| 1310 | 1310 | { |
| 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]); |
| 1314 | 1314 | |
| 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); |
| 1318 | 1318 | |
| 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); |
| 1328 | 1328 | |
| 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 | } |
| 1335 | 1335 | } |
| 1336 | 1336 | |
| 1337 | 1337 | |
| 1338 | 1338 | void layout_element::component::load_reel_bitmap(int number) |
| 1339 | 1339 | { |
| 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]); |
| 1343 | 1343 | |
| 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); |
| 1347 | 1347 | |
| 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 | } |
| 1354 | 1354 | |
| 1355 | 1355 | } |
| 1356 | 1356 | |
| r242303 | r242304 | |
| 1362 | 1362 | |
| 1363 | 1363 | void layout_element::component::draw_led7seg(bitmap_argb32 &dest, const rectangle &bounds, int pattern) |
| 1364 | 1364 | { |
| 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); |
| 1367 | 1367 | |
| 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; |
| 1373 | 1373 | |
| 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)); |
| 1377 | 1377 | |
| 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); |
| 1380 | 1380 | |
| 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); |
| 1383 | 1383 | |
| 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); |
| 1386 | 1386 | |
| 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); |
| 1389 | 1389 | |
| 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); |
| 1392 | 1392 | |
| 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); |
| 1395 | 1395 | |
| 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); |
| 1398 | 1398 | |
| 1399 | | // apply skew |
| 1400 | | apply_skew(tempbitmap, 40); |
| 1399 | // apply skew |
| 1400 | apply_skew(tempbitmap, 40); |
| 1401 | 1401 | |
| 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); |
| 1404 | 1404 | |
| 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); |
| 1407 | 1407 | } |
| 1408 | 1408 | |
| 1409 | 1409 | |
| 1410 | 1410 | //----------------------------------------------------------------- |
| 1411 | | // draw_led8seg - draw a 8-segment fluorescent (Gottlieb System 1) |
| 1411 | // draw_led8seg_gts1 - draw a 8-segment fluorescent (Gottlieb System 1) |
| 1412 | 1412 | //----------------------------------------------------------------- |
| 1413 | 1413 | |
| 1414 | | void layout_element::component::draw_led8seg(bitmap_argb32 &dest, const rectangle &bounds, int pattern) |
| 1414 | void layout_element::component::draw_led8seg_gts1(bitmap_argb32 &dest, const rectangle &bounds, int pattern) |
| 1415 | 1415 | { |
| 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); |
| 1419 | 1419 | |
| 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; |
| 1425 | 1425 | |
| 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); |
| 1429 | 1429 | |
| 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); |
| 1432 | 1432 | |
| 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); |
| 1435 | 1435 | |
| 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); |
| 1438 | 1438 | |
| 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); |
| 1441 | 1441 | |
| 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); |
| 1444 | 1444 | |
| 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); |
| 1447 | 1447 | |
| 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); |
| 1451 | 1451 | |
| 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); |
| 1455 | 1455 | |
| 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); |
| 1458 | 1458 | |
| 1459 | | // apply skew |
| 1460 | | apply_skew(tempbitmap, 40); |
| 1459 | // apply skew |
| 1460 | apply_skew(tempbitmap, 40); |
| 1461 | 1461 | |
| 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); |
| 1464 | 1464 | } |
| 1465 | 1465 | |
| 1466 | 1466 | |
| r242303 | r242304 | |
| 1470 | 1470 | |
| 1471 | 1471 | void layout_element::component::draw_led14seg(bitmap_argb32 &dest, const rectangle &bounds, int pattern) |
| 1472 | 1472 | { |
| 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); |
| 1475 | 1475 | |
| 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; |
| 1481 | 1481 | |
| 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)); |
| 1485 | 1485 | |
| 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); |
| 1490 | 1490 | |
| 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); |
| 1495 | 1495 | |
| 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); |
| 1500 | 1500 | |
| 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); |
| 1505 | 1505 | |
| 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); |
| 1510 | 1510 | |
| 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); |
| 1515 | 1515 | |
| 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); |
| 1520 | 1520 | |
| 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); |
| 1525 | 1525 | |
| 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); |
| 1530 | 1530 | |
| 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); |
| 1535 | 1535 | |
| 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); |
| 1541 | 1541 | |
| 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); |
| 1547 | 1547 | |
| 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); |
| 1553 | 1553 | |
| 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); |
| 1559 | 1559 | |
| 1560 | | // apply skew |
| 1561 | | apply_skew(tempbitmap, 40); |
| 1560 | // apply skew |
| 1561 | apply_skew(tempbitmap, 40); |
| 1562 | 1562 | |
| 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); |
| 1565 | 1565 | } |
| 1566 | 1566 | |
| 1567 | 1567 | |
| r242303 | r242304 | |
| 1572 | 1572 | |
| 1573 | 1573 | void layout_element::component::draw_led14segsc(bitmap_argb32 &dest, const rectangle &bounds, int pattern) |
| 1574 | 1574 | { |
| 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); |
| 1577 | 1577 | |
| 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; |
| 1583 | 1583 | |
| 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)); |
| 1587 | 1587 | |
| 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); |
| 1592 | 1592 | |
| 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); |
| 1597 | 1597 | |
| 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); |
| 1602 | 1602 | |
| 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); |
| 1607 | 1607 | |
| 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); |
| 1612 | 1612 | |
| 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); |
| 1617 | 1617 | |
| 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); |
| 1622 | 1622 | |
| 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); |
| 1627 | 1627 | |
| 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); |
| 1632 | 1632 | |
| 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); |
| 1637 | 1637 | |
| 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); |
| 1643 | 1643 | |
| 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); |
| 1649 | 1649 | |
| 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); |
| 1655 | 1655 | |
| 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); |
| 1661 | 1661 | |
| 1662 | | // apply skew |
| 1663 | | apply_skew(tempbitmap, 40); |
| 1662 | // apply skew |
| 1663 | apply_skew(tempbitmap, 40); |
| 1664 | 1664 | |
| 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); |
| 1670 | 1670 | |
| 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); |
| 1673 | 1673 | |
| 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); |
| 1676 | 1676 | } |
| 1677 | 1677 | |
| 1678 | 1678 | |
| r242303 | r242304 | |
| 1682 | 1682 | |
| 1683 | 1683 | void layout_element::component::draw_led16seg(bitmap_argb32 &dest, const rectangle &bounds, int pattern) |
| 1684 | 1684 | { |
| 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); |
| 1687 | 1687 | |
| 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; |
| 1693 | 1693 | |
| 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)); |
| 1697 | 1697 | |
| 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); |
| 1702 | 1702 | |
| 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); |
| 1707 | 1707 | |
| 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); |
| 1712 | 1712 | |
| 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); |
| 1717 | 1717 | |
| 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); |
| 1722 | 1722 | |
| 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); |
| 1727 | 1727 | |
| 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); |
| 1732 | 1732 | |
| 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); |
| 1737 | 1737 | |
| 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); |
| 1742 | 1742 | |
| 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); |
| 1747 | 1747 | |
| 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); |
| 1752 | 1752 | |
| 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); |
| 1757 | 1757 | |
| 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); |
| 1763 | 1763 | |
| 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); |
| 1769 | 1769 | |
| 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); |
| 1775 | 1775 | |
| 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); |
| 1781 | 1781 | |
| 1782 | | // apply skew |
| 1783 | | apply_skew(tempbitmap, 40); |
| 1782 | // apply skew |
| 1783 | apply_skew(tempbitmap, 40); |
| 1784 | 1784 | |
| 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); |
| 1787 | 1787 | } |
| 1788 | 1788 | |
| 1789 | 1789 | |
| r242303 | r242304 | |
| 1794 | 1794 | |
| 1795 | 1795 | void layout_element::component::draw_led16segsc(bitmap_argb32 &dest, const rectangle &bounds, int pattern) |
| 1796 | 1796 | { |
| 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); |
| 1799 | 1799 | |
| 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; |
| 1805 | 1805 | |
| 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)); |
| 1809 | 1809 | |
| 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); |
| 1814 | 1814 | |
| 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); |
| 1819 | 1819 | |
| 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); |
| 1824 | 1824 | |
| 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); |
| 1829 | 1829 | |
| 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); |
| 1834 | 1834 | |
| 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); |
| 1839 | 1839 | |
| 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); |
| 1844 | 1844 | |
| 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); |
| 1849 | 1849 | |
| 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); |
| 1854 | 1854 | |
| 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); |
| 1859 | 1859 | |
| 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); |
| 1864 | 1864 | |
| 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); |
| 1869 | 1869 | |
| 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); |
| 1875 | 1875 | |
| 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); |
| 1881 | 1881 | |
| 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); |
| 1887 | 1887 | |
| 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); |
| 1893 | 1893 | |
| 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); |
| 1899 | 1899 | |
| 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); |
| 1902 | 1902 | |
| 1903 | | // apply skew |
| 1904 | | apply_skew(tempbitmap, 40); |
| 1903 | // apply skew |
| 1904 | apply_skew(tempbitmap, 40); |
| 1905 | 1905 | |
| 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); |
| 1908 | 1908 | } |
| 1909 | 1909 | |
| 1910 | 1910 | |
| r242303 | r242304 | |
| 1915 | 1915 | |
| 1916 | 1916 | void layout_element::component::draw_dotmatrix(int dots, bitmap_argb32 &dest, const rectangle &bounds, int pattern) |
| 1917 | 1917 | { |
| 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); |
| 1920 | 1920 | |
| 1921 | | // sizes for computation |
| 1922 | | int bmheight = 300; |
| 1923 | | int dotwidth = 250; |
| 1921 | // sizes for computation |
| 1922 | int bmheight = 300; |
| 1923 | int dotwidth = 250; |
| 1924 | 1924 | |
| 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)); |
| 1928 | 1928 | |
| 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); |
| 1931 | 1931 | |
| 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); |
| 1934 | 1934 | } |
| 1935 | 1935 | |
| 1936 | 1936 | |
| r242303 | r242304 | |
| 1942 | 1942 | |
| 1943 | 1943 | void layout_element::component::draw_segment_horizontal_caps(bitmap_argb32 &dest, int minx, int maxx, int midy, int width, int caps, rgb_t color) |
| 1944 | 1944 | { |
| 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; |
| 1951 | 1951 | |
| 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 | } |
| 1956 | 1956 | } |
| 1957 | 1957 | |
| 1958 | 1958 | |
| r242303 | r242304 | |
| 1963 | 1963 | |
| 1964 | 1964 | void layout_element::component::draw_segment_horizontal(bitmap_argb32 &dest, int minx, int maxx, int midy, int width, rgb_t color) |
| 1965 | 1965 | { |
| 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); |
| 1967 | 1967 | } |
| 1968 | 1968 | |
| 1969 | 1969 | |
| r242303 | r242304 | |
| 1975 | 1975 | |
| 1976 | 1976 | void layout_element::component::draw_segment_vertical_caps(bitmap_argb32 &dest, int miny, int maxy, int midx, int width, int caps, rgb_t color) |
| 1977 | 1977 | { |
| 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; |
| 1984 | 1984 | |
| 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 | } |
| 1989 | 1989 | } |
| 1990 | 1990 | |
| 1991 | 1991 | |
| r242303 | r242304 | |
| 1996 | 1996 | |
| 1997 | 1997 | void layout_element::component::draw_segment_vertical(bitmap_argb32 &dest, int miny, int maxy, int midx, int width, rgb_t color) |
| 1998 | 1998 | { |
| 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); |
| 2000 | 2000 | } |
| 2001 | 2001 | |
| 2002 | 2002 | |
| r242303 | r242304 | |
| 2007 | 2007 | |
| 2008 | 2008 | void layout_element::component::draw_segment_diagonal_1(bitmap_argb32 &dest, int minx, int maxx, int miny, int maxy, int width, rgb_t color) |
| 2009 | 2009 | { |
| 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); |
| 2013 | 2013 | |
| 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; |
| 2020 | 2020 | |
| 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 | } |
| 2025 | 2025 | } |
| 2026 | 2026 | |
| 2027 | 2027 | |
| r242303 | r242304 | |
| 2032 | 2032 | |
| 2033 | 2033 | void layout_element::component::draw_segment_diagonal_2(bitmap_argb32 &dest, int minx, int maxx, int miny, int maxy, int width, rgb_t color) |
| 2034 | 2034 | { |
| 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); |
| 2038 | 2038 | |
| 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; |
| 2045 | 2045 | |
| 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 | } |
| 2050 | 2050 | } |
| 2051 | 2051 | |
| 2052 | 2052 | |
| r242303 | r242304 | |
| 2056 | 2056 | |
| 2057 | 2057 | void layout_element::component::draw_segment_decimal(bitmap_argb32 &dest, int midx, int midy, int width, rgb_t color) |
| 2058 | 2058 | { |
| 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); |
| 2062 | 2062 | |
| 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; |
| 2070 | 2070 | |
| 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); |
| 2074 | 2074 | |
| 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 | } |
| 2079 | 2079 | } |
| 2080 | 2080 | |
| 2081 | 2081 | |
| r242303 | r242304 | |
| 2085 | 2085 | |
| 2086 | 2086 | void layout_element::component::draw_segment_comma(bitmap_argb32 &dest, int minx, int maxx, int miny, int maxy, int width, rgb_t color) |
| 2087 | 2087 | { |
| 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); |
| 2091 | 2091 | |
| 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; |
| 2097 | 2097 | |
| 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 | } |
| 2101 | 2101 | } |
| 2102 | 2102 | |
| 2103 | 2103 | |
| r242303 | r242304 | |
| 2107 | 2107 | |
| 2108 | 2108 | void layout_element::component::apply_skew(bitmap_argb32 &dest, int skewwidth) |
| 2109 | 2109 | { |
| 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 | } |
| 2119 | 2119 | } |
| 2120 | 2120 | |
| 2121 | 2121 | |
| r242303 | r242304 | |
| 2129 | 2129 | //------------------------------------------------- |
| 2130 | 2130 | |
| 2131 | 2131 | layout_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) |
| 2135 | 2135 | { |
| 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", ""); |
| 2138 | 2138 | |
| 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); |
| 2144 | 2144 | |
| 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))); |
| 2148 | 2148 | |
| 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))); |
| 2152 | 2152 | |
| 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))); |
| 2156 | 2156 | |
| 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))); |
| 2160 | 2160 | |
| 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))); |
| 2164 | 2164 | |
| 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))); |
| 2168 | 2168 | |
| 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()); |
| 2171 | 2171 | } |
| 2172 | 2172 | |
| 2173 | 2173 | |
| r242303 | r242304 | |
| 2187 | 2187 | |
| 2188 | 2188 | layout_view::item *layout_view::first_item(item_layer layer) const |
| 2189 | 2189 | { |
| 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 | } |
| 2200 | 2200 | } |
| 2201 | 2201 | |
| 2202 | 2202 | |
| r242303 | r242304 | |
| 2207 | 2207 | |
| 2208 | 2208 | void layout_view::recompute(render_layer_config layerconfig) |
| 2209 | 2209 | { |
| 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(); |
| 2214 | 2214 | |
| 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 | } |
| 2230 | 2230 | |
| 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; |
| 2241 | 2241 | |
| 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; |
| 2250 | 2250 | |
| 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 | } |
| 2256 | 2256 | |
| 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; |
| 2260 | 2260 | |
| 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); |
| 2267 | 2267 | |
| 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 | } |
| 2271 | 2271 | |
| 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); |
| 2277 | 2277 | |
| 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 | } |
| 2285 | 2285 | |
| 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); |
| 2291 | 2291 | |
| 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 | } |
| 2301 | 2301 | } |
| 2302 | 2302 | |
| 2303 | 2303 | |
| r242303 | r242304 | |
| 2311 | 2311 | //------------------------------------------------- |
| 2312 | 2312 | |
| 2313 | 2313 | layout_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) |
| 2319 | 2319 | { |
| 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", ""); |
| 2322 | 2322 | |
| 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", ""); |
| 2325 | 2325 | |
| 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; |
| 2334 | 2334 | |
| 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 | } |
| 2339 | 2339 | |
| 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); |
| 2353 | 2353 | |
| 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 | } |
| 2365 | 2365 | } |
| 2366 | 2366 | |
| 2367 | 2367 | |
| r242303 | r242304 | |
| 2381 | 2381 | |
| 2382 | 2382 | render_container *layout_view::item::screen_container(running_machine &machine) const |
| 2383 | 2383 | { |
| 2384 | | return (m_screen != NULL) ? &m_screen->container() : NULL; |
| 2384 | return (m_screen != NULL) ? &m_screen->container() : NULL; |
| 2385 | 2385 | } |
| 2386 | 2386 | |
| 2387 | 2387 | //------------------------------------------------- |
| r242303 | r242304 | |
| 2390 | 2390 | |
| 2391 | 2391 | int layout_view::item::state() const |
| 2392 | 2392 | { |
| 2393 | | int state = 0; |
| 2393 | int state = 0; |
| 2394 | 2394 | |
| 2395 | | assert(m_element != NULL); |
| 2395 | assert(m_element != NULL); |
| 2396 | 2396 | |
| 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); |
| 2400 | 2400 | |
| 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; |
| 2413 | 2413 | } |
| 2414 | 2414 | |
| 2415 | 2415 | |
| r242303 | r242304 | |
| 2423 | 2423 | //------------------------------------------------- |
| 2424 | 2424 | |
| 2425 | 2425 | layout_file::layout_file(running_machine &machine, xml_data_node &rootnode, const char *dirname) |
| 2426 | | : m_next(NULL) |
| 2426 | : m_next(NULL) |
| 2427 | 2427 | { |
| 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"); |
| 2432 | 2432 | |
| 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"); |
| 2437 | 2437 | |
| 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))); |
| 2441 | 2441 | |
| 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))); |
| 2445 | 2445 | } |
| 2446 | 2446 | |
| 2447 | 2447 | |