trunk/src/emu/cpu/mcs96/mcs96.c
| r26272 | r26273 | |
| 141 | 141 | void mcs96_device::execute_set_input(int inputnum, int state) |
| 142 | 142 | { |
| 143 | 143 | switch(inputnum) { |
| 144 | case EXINT_LINE: |
| 145 | if(state) |
| 146 | pending_irq |= 0x80; |
| 147 | else |
| 148 | pending_irq &= 0x7f; |
| 149 | check_irq(); |
| 150 | break; |
| 144 | 151 | } |
| 145 | 152 | } |
| 146 | 153 | |
| r26272 | r26273 | |
| 293 | 300 | flags |= 3; |
| 294 | 301 | break; |
| 295 | 302 | |
| 303 | case DASM_immed_or_reg_2b: |
| 304 | if(oprom[1] >= 0x10) |
| 305 | sprintf(buffer, " %s, %s", regname(oprom[2]).cstr(), regname(oprom[1]).cstr()); |
| 306 | else |
| 307 | sprintf(buffer, " %s, #%02x", regname(oprom[2]).cstr(), oprom[1]); |
| 308 | flags |= 3; |
| 309 | break; |
| 310 | |
| 296 | 311 | case DASM_immed_3b: |
| 297 | 312 | sprintf(buffer, " %s, %s, #%02x", regname(oprom[3]).cstr(), regname(oprom[2]).cstr(), oprom[1]); |
| 298 | 313 | flags |= 4; |
| r26272 | r26273 | |
| 366 | 381 | sprintf(buffer, " %02x", delta); |
| 367 | 382 | } else { |
| 368 | 383 | if(delta < 0) |
| 369 | | sprintf(buffer, " -%02x[%s]", -delta, regname(oprom[1]-1).cstr()); |
| 384 | sprintf(buffer, " -%02x[%s]", -delta, regname(oprom[1]).cstr()); |
| 370 | 385 | else |
| 371 | | sprintf(buffer, " %02x[%s]", delta, regname(oprom[1]-1).cstr()); |
| 386 | sprintf(buffer, " %02x[%s]", delta, regname(oprom[1]).cstr()); |
| 372 | 387 | } |
| 373 | 388 | flags |= 3; |
| 374 | 389 | } |
| r26272 | r26273 | |
| 392 | 407 | sprintf(buffer, " %s, %02x", regname(oprom[3]).cstr(), delta); |
| 393 | 408 | } else { |
| 394 | 409 | if(delta < 0) |
| 395 | | sprintf(buffer, " %s, -%02x[%s]", regname(oprom[3]).cstr(), -delta, regname(oprom[1]-1).cstr()); |
| 410 | sprintf(buffer, " %s, -%02x[%s]", regname(oprom[3]).cstr(), -delta, regname(oprom[1]).cstr()); |
| 396 | 411 | else |
| 397 | | sprintf(buffer, " %s, %02x[%s]", regname(oprom[3]).cstr(), delta, regname(oprom[1]-1).cstr()); |
| 412 | sprintf(buffer, " %s, %02x[%s]", regname(oprom[3]).cstr(), delta, regname(oprom[1]).cstr()); |
| 398 | 413 | } |
| 399 | 414 | flags |= 4; |
| 400 | 415 | } |
| r26272 | r26273 | |
| 418 | 433 | sprintf(buffer, " %s, %s, %02x", regname(oprom[4]).cstr(), regname(oprom[3]).cstr(), delta); |
| 419 | 434 | } else { |
| 420 | 435 | if(delta < 0) |
| 421 | | sprintf(buffer, " %s, %s, -%02x[%s]", regname(oprom[4]).cstr(), regname(oprom[3]).cstr(), -delta, regname(oprom[1]-1).cstr()); |
| 436 | sprintf(buffer, " %s, %s, -%02x[%s]", regname(oprom[4]).cstr(), regname(oprom[3]).cstr(), -delta, regname(oprom[1]).cstr()); |
| 422 | 437 | else |
| 423 | | sprintf(buffer, " %s, %s, %02x[%s]", regname(oprom[4]).cstr(), regname(oprom[3]).cstr(), delta, regname(oprom[1]-1).cstr()); |
| 438 | sprintf(buffer, " %s, %s, %02x[%s]", regname(oprom[4]).cstr(), regname(oprom[3]).cstr(), delta, regname(oprom[1]).cstr()); |
| 424 | 439 | } |
| 425 | 440 | flags |= 5; |
| 426 | 441 | } |
trunk/src/emu/cpu/mcs96/mcs96ops.lst
| r26272 | r26273 | |
| 2 | 2 | if(irq_requested) { |
| 3 | 3 | int level; |
| 4 | 4 | for(level = 7; level >= 0 && !(PSW & pending_irq & (1<<level)); level--); |
| 5 | | pending_irq &= ~(1<<level); |
| 5 | if(level != 7) |
| 6 | pending_irq &= ~(1<<level); |
| 6 | 7 | OP1 = level; |
| 7 | 8 | TMP = reg_r16(0x18); |
| 8 | 9 | TMP -= 2; |
| r26272 | r26273 | |
| 73 | 74 | OP1 = read_pc(); |
| 74 | 75 | OP2 = read_pc(); |
| 75 | 76 | |
| 77 | eadr immed_or_reg_2b |
| 78 | OP1 = read_pc(); |
| 79 | OP2 = read_pc(); |
| 80 | |
| 76 | 81 | eadr immed_3b |
| 77 | 82 | OP1 = read_pc(); |
| 78 | 83 | OP2 = read_pc(); |
| r26272 | r26273 | |
| 199 | 204 | reg_w16(OP1, do_add(TMP, 1)); |
| 200 | 205 | next(4); |
| 201 | 206 | |
| 202 | | 08 shr immed_2b |
| 203 | | OP1 &= 0x1f; |
| 207 | 08 shr immed_or_reg_2b |
| 208 | if(OP1 >= 0x10) { |
| 209 | OP1 = reg_r8(OP1) & 0x1f; |
| 210 | } |
| 204 | 211 | TMP = reg_r16(OP2); |
| 205 | 212 | PSW &= ~(F_Z|F_N|F_C|F_V|F_ST); |
| 206 | 213 | if(OP1 >= 2 && (TMP & (0xffff >> (OP1 <= 16 ? 17-OP1 : 0)))) |
| r26272 | r26273 | |
| 215 | 222 | reg_w16(OP2, TMP); |
| 216 | 223 | next(OP1 ? 7+OP1 : 8); |
| 217 | 224 | |
| 218 | | 09 shl immed_2b |
| 219 | | OP1 &= 0x1f; |
| 225 | 09 shl immed_or_reg_2b |
| 226 | if(OP1 >= 0x10) { |
| 227 | OP1 = reg_r8(OP1) & 0x1f; |
| 228 | } |
| 220 | 229 | TMP = reg_r16(OP2); |
| 221 | 230 | PSW &= ~(F_Z|F_N|F_C|F_V|F_ST); |
| 222 | 231 | if(OP1 >= 2 && (TMP & (0xffff << (OP1 <= 16 ? 17-OP1 : 0)))) |
| r26272 | r26273 | |
| 231 | 240 | reg_w16(OP2, TMP); |
| 232 | 241 | next(OP1 ? 7+OP1 : 8); |
| 233 | 242 | |
| 234 | | 0a shra immed_2b |
| 235 | | OP1 &= 0x1f; |
| 243 | 0a shra immed_or_reg_2b |
| 244 | if(OP1 >= 0x10) { |
| 245 | OP1 = reg_r8(OP1) & 0x1f; |
| 246 | } |
| 236 | 247 | TMP = reg_r16(OP2); |
| 237 | 248 | PSW &= ~(F_Z|F_N|F_C|F_V|F_ST); |
| 238 | 249 | if(OP1 >= 2 && (TMP & (0xffff >> (OP1 <= 16 ? 17-OP1 : 0)))) |
| r26272 | r26273 | |
| 247 | 258 | reg_w16(OP2, TMP); |
| 248 | 259 | next(OP1 ? 7+OP1 : 8); |
| 249 | 260 | |
| 250 | | 0c shrl immed_2b |
| 251 | | OP1 &= 0x1f; |
| 261 | 0c shrl immed_or_reg_2b |
| 262 | if(OP1 >= 0x10) { |
| 263 | OP1 = reg_r8(OP1) & 0x1f; |
| 264 | } |
| 252 | 265 | OP2 &= 0xfc; |
| 253 | 266 | TMP = reg_r16(OP2); |
| 254 | 267 | TMP |= reg_r16(OP2+2) << 16; |
| r26272 | r26273 | |
| 266 | 279 | reg_w16(OP2+2, TMP >> 16); |
| 267 | 280 | next(OP1 ? 7+OP1 : 8); |
| 268 | 281 | |
| 269 | | 0d shll immed_2b |
| 270 | | OP1 &= 0x1f; |
| 282 | 0d shll immed_or_reg_2b |
| 283 | if(OP1 >= 0x10) { |
| 284 | OP1 = reg_r8(OP1) & 0x1f; |
| 285 | } |
| 271 | 286 | OP2 &= 0xfc; |
| 272 | 287 | TMP = reg_r16(OP2); |
| 273 | 288 | TMP |= reg_r16(OP2+2) << 16; |
| r26272 | r26273 | |
| 285 | 300 | reg_w16(OP2+2, TMP >> 16); |
| 286 | 301 | next(OP1 ? 7+OP1 : 8); |
| 287 | 302 | |
| 288 | | 0e shral immed_2b |
| 289 | | OP1 &= 0x1f; |
| 303 | 0e shral immed_or_reg_2b |
| 304 | if(OP1 >= 0x10) { |
| 305 | OP1 = reg_r8(OP1) & 0x1f; |
| 306 | } |
| 290 | 307 | OP2 &= 0xfc; |
| 291 | 308 | TMP = reg_r16(OP2); |
| 292 | 309 | TMP |= reg_r16(OP2+2) << 16; |
| r26272 | r26273 | |
| 351 | 368 | reg_w8(OP1, do_addb(TMP, 1)); |
| 352 | 369 | next(4); |
| 353 | 370 | |
| 354 | | 18 shrb immed_2b |
| 355 | | OP1 &= 0x1f; |
| 371 | 18 shrb immed_or_reg_2b |
| 372 | if(OP1 >= 0x10) { |
| 373 | OP1 = reg_r8(OP1) & 0x1f; |
| 374 | } |
| 356 | 375 | TMP = reg_r8(OP2); |
| 357 | 376 | PSW &= ~(F_Z|F_N|F_C|F_V|F_ST); |
| 358 | 377 | if(OP1 >= 2 && (TMP & (0xff >> (OP1 <= 8 ? 9-OP1 : 0)))) |
| r26272 | r26273 | |
| 367 | 386 | reg_w8(OP2, TMP); |
| 368 | 387 | next(OP1 ? 7+OP1 : 8); |
| 369 | 388 | |
| 370 | | 19 shlb immed_2b |
| 371 | | OP1 &= 0x1f; |
| 389 | 19 shlb immed_or_reg_2b |
| 390 | if(OP1 >= 0x10) { |
| 391 | OP1 = reg_r8(OP1) & 0x1f; |
| 392 | } |
| 372 | 393 | TMP = reg_r8(OP2); |
| 373 | 394 | PSW &= ~(F_Z|F_N|F_C|F_V|F_ST); |
| 374 | 395 | if(OP1 >= 2 && (TMP & (0xff << (OP1 <= 8 ? 9-OP1 : 0)))) |
| r26272 | r26273 | |
| 383 | 404 | reg_w8(OP2, TMP); |
| 384 | 405 | next(OP1 ? 7+OP1 : 8); |
| 385 | 406 | |
| 386 | | 1a shrab immed_2b |
| 387 | | OP1 &= 0x1f; |
| 407 | 1a shrab immed_or_reg_2b |
| 408 | if(OP1 >= 0x10) { |
| 409 | OP1 = reg_r8(OP1) & 0x1f; |
| 410 | } |
| 388 | 411 | TMP = reg_r8(OP2); |
| 389 | 412 | PSW &= ~(F_Z|F_N|F_C|F_V|F_ST); |
| 390 | 413 | if(OP1 >= 2 && (TMP & (0xff >> (OP1 <= 8 ? 9-OP1 : 0)))) |
| r26272 | r26273 | |
| 1603 | 1626 | } |
| 1604 | 1627 | |
| 1605 | 1628 | d1 jnh rel8 |
| 1606 | | if((PSW & (F_Z|F_N)) != F_C) { |
| 1629 | if((PSW & (F_C|F_N)) != F_C) { |
| 1607 | 1630 | PC += OP1; |
| 1608 | 1631 | next(8); |
| 1609 | 1632 | } else { |
| r26272 | r26273 | |
| 1669 | 1692 | } |
| 1670 | 1693 | |
| 1671 | 1694 | d9 jh rel8 |
| 1672 | | if((PSW & (F_Z|F_N)) == F_C) { |
| 1695 | if((PSW & (F_C|F_N)) == F_C) { |
| 1673 | 1696 | PC += OP1; |
| 1674 | 1697 | next(8); |
| 1675 | 1698 | } else { |
trunk/src/emu/cpu/mcs96/mcs96.h
| r26272 | r26273 | |
| 42 | 42 | |
| 43 | 43 | class mcs96_device : public cpu_device { |
| 44 | 44 | public: |
| 45 | enum { |
| 46 | EXINT_LINE = 1 |
| 47 | }; |
| 48 | |
| 45 | 49 | mcs96_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, int data_width, const char *shortname, const char *source); |
| 46 | 50 | |
| 47 | 51 | UINT64 get_cycle(); |
| r26272 | r26273 | |
| 69 | 73 | }; |
| 70 | 74 | |
| 71 | 75 | enum { |
| 72 | | DASM_none, /* No parameters */ |
| 73 | | DASM_nop_2, /* One ignored parameter byte */ |
| 74 | | DASM_rel8, /* Relative, 8 bits */ |
| 75 | | DASM_rel11, /* Relative, 11 bits */ |
| 76 | | DASM_rel16, /* Relative, 16 bits */ |
| 77 | | DASM_rrel8, /* Register + relative, 8 bits */ |
| 78 | | DASM_brrel8, /* Bit test + register + relative, 8 bits */ |
| 79 | | DASM_direct_1, /* Register-direct references, 1 operator */ |
| 80 | | DASM_direct_2, /* Register-direct references, 2 operators */ |
| 81 | | DASM_direct_3, /* Register-direct references, 3 operators */ |
| 82 | | DASM_immed_1b, /* Immediate references to byte, 1 operator */ |
| 83 | | DASM_immed_2b, /* Immediate references to byte, 2 operators */ |
| 84 | | DASM_immed_3b, /* Immediate references to byte, 3 operators */ |
| 85 | | DASM_immed_1w, /* Immediate references to word, 1 operator */ |
| 86 | | DASM_immed_2w, /* Immediate references to word, 2 operators */ |
| 87 | | DASM_immed_3w, /* Immediate references to word, 3 operators */ |
| 88 | | DASM_indirect_1n, /* Indirect normal, 1 operator */ |
| 89 | | DASM_indirect_1, /* Indirect, normal or auto-incrementing, 1 operator */ |
| 90 | | DASM_indirect_2, /* Indirect, normal or auto-incrementing, 2 operators */ |
| 91 | | DASM_indirect_3, /* Indirect, normal or auto-incrementing, 3 operators */ |
| 92 | | DASM_indexed_1, /* Indexed, short or long, 1 operator */ |
| 93 | | DASM_indexed_2, /* Indexed, short or long, 2 operators */ |
| 94 | | DASM_indexed_3, /* Indexed, short or long, 3 operators */ |
| 76 | DASM_none, /* No parameters */ |
| 77 | DASM_nop_2, /* One ignored parameter byte */ |
| 78 | DASM_rel8, /* Relative, 8 bits */ |
| 79 | DASM_rel11, /* Relative, 11 bits */ |
| 80 | DASM_rel16, /* Relative, 16 bits */ |
| 81 | DASM_rrel8, /* Register + relative, 8 bits */ |
| 82 | DASM_brrel8, /* Bit test + register + relative, 8 bits */ |
| 83 | DASM_direct_1, /* Register-direct references, 1 operator */ |
| 84 | DASM_direct_2, /* Register-direct references, 2 operators */ |
| 85 | DASM_direct_3, /* Register-direct references, 3 operators */ |
| 86 | DASM_immed_1b, /* Immediate references to byte, 1 operator */ |
| 87 | DASM_immed_2b, /* Immediate references to byte, 2 operators */ |
| 88 | DASM_immed_or_reg_2b, /* Immediate references to byte or register, 2 operators */ |
| 89 | DASM_immed_3b, /* Immediate references to byte, 3 operators */ |
| 90 | DASM_immed_1w, /* Immediate references to word, 1 operator */ |
| 91 | DASM_immed_2w, /* Immediate references to word, 2 operators */ |
| 92 | DASM_immed_3w, /* Immediate references to word, 3 operators */ |
| 93 | DASM_indirect_1n, /* Indirect normal, 1 operator */ |
| 94 | DASM_indirect_1, /* Indirect, normal or auto-incrementing, 1 operator */ |
| 95 | DASM_indirect_2, /* Indirect, normal or auto-incrementing, 2 operators */ |
| 96 | DASM_indirect_3, /* Indirect, normal or auto-incrementing, 3 operators */ |
| 97 | DASM_indexed_1, /* Indexed, short or long, 1 operator */ |
| 98 | DASM_indexed_2, /* Indexed, short or long, 2 operators */ |
| 99 | DASM_indexed_3, /* Indexed, short or long, 3 operators */ |
| 95 | 100 | }; |
| 96 | 101 | |
| 97 | 102 | // device-level overrides |
| r26272 | r26273 | |
| 245 | 250 | O(rst_none); |
| 246 | 251 | O(scall_rel11); |
| 247 | 252 | O(setc_none); |
| 248 | | O(shl_immed_2b); |
| 249 | | O(shlb_immed_2b); |
| 250 | | O(shll_immed_2b); |
| 251 | | O(shr_immed_2b); |
| 252 | | O(shra_immed_2b); |
| 253 | | O(shrab_immed_2b); |
| 254 | | O(shral_immed_2b); |
| 255 | | O(shrb_immed_2b); |
| 256 | | O(shrl_immed_2b); |
| 253 | O(shl_immed_or_reg_2b); |
| 254 | O(shlb_immed_or_reg_2b); |
| 255 | O(shll_immed_or_reg_2b); |
| 256 | O(shr_immed_or_reg_2b); |
| 257 | O(shra_immed_or_reg_2b); |
| 258 | O(shrab_immed_or_reg_2b); |
| 259 | O(shral_immed_or_reg_2b); |
| 260 | O(shrb_immed_or_reg_2b); |
| 261 | O(shrl_immed_or_reg_2b); |
| 257 | 262 | O(sjmp_rel11); |
| 258 | 263 | O(skip_immed_1b); |
| 259 | 264 | O(st_direct_2); O(st_indexed_2); O(st_indirect_2); |