branches/alto2/src/emu/cpu/alto2/a2emu.c
| r26424 | r26425 | |
| 12 | 12 | /** @brief CTL2K_U3 address line for F2 function */ |
| 13 | 13 | #define CTL2K_U3(f2) (f2 == f2_emu_idisp ? 0x80 : 0x00) |
| 14 | 14 | |
| 15 | | /** @brief set non-zero to use expressions after the schematics for RSEL[3-4] */ |
| 16 | | #define USE_SCHEMATICS_RSEL 0 |
| 17 | | |
| 18 | 15 | /** |
| 19 | 16 | * width,from,to of the 16 bit instruction register |
| 20 | 17 | * 1 1 1 1 1 1 |
| r26424 | r26425 | |
| 237 | 234 | * </PRE> |
| 238 | 235 | */ |
| 239 | 236 | |
| 240 | | #if USE_SCHEMATICS_RSEL |
| 241 | | #define RA3(f2,ir,rs) (\ |
| 242 | | (((ALTO2_GET(f2,4,0,2)==5 && ALTO2_GET(ir,16,3,3)==0) ? 0 : 1) && \ |
| 243 | | ((ALTO2_GET(f2,4,0,2)==7 && ALTO2_GET(ir,16,1,1)==0) ? 0 : 1) && \ |
| 244 | | (ALTO2_GET(rs,5,3,3)==0)) ? 0 : 1) |
| 245 | | |
| 246 | | #define RA4(f2,ir,rs) (\ |
| 247 | | (((ALTO2_GET(f2,4,0,2)==5 && ALTO2_GET(ir,16,4,4)==0) ? 0 : 1) && \ |
| 248 | | ((ALTO2_GET(f2,4,0,2)==7 && ALTO2_GET(ir,16,2,2)==0) ? 0 : 1) && \ |
| 249 | | (ALTO2_GET(rs,5,4,4)==0)) ? 0 : 1) |
| 250 | | #endif /* USE_SCHEMATICS_RSEL */ |
| 251 | | |
| 252 | 237 | /** |
| 253 | 238 | * @brief bs_disp early: drive bus by IR[8-15], possibly sign extended |
| 254 | 239 | * |
| r26424 | r26425 | |
| 367 | 352 | } |
| 368 | 353 | |
| 369 | 354 | /** |
| 370 | | * @brief f2_busodd late: branch on odd bus |
| 355 | * @brief branch on odd bus |
| 371 | 356 | */ |
| 372 | 357 | void alto2_cpu_device::f2_late_busodd() |
| 373 | 358 | { |
| r26424 | r26425 | |
| 377 | 362 | } |
| 378 | 363 | |
| 379 | 364 | /** |
| 380 | | * @brief f2_magic late: shift and use T[0] or T[15] |
| 365 | * @brief f2_magic late: shift and use T[0] or T[15] for bit 15 or 0 |
| 381 | 366 | */ |
| 382 | 367 | void alto2_cpu_device::f2_late_magic() |
| 383 | 368 | { |
| r26424 | r26425 | |
| 403 | 388 | } |
| 404 | 389 | |
| 405 | 390 | /** |
| 406 | | * @brief dns early: modify RESELECT with DstAC = (3 - IR[3-4]) |
| 391 | * @brief do novel shifts: modify RESELECT with DstAC = (3 - IR[3-4]) |
| 407 | 392 | */ |
| 408 | 393 | void alto2_cpu_device::f2_early_load_dns() |
| 409 | 394 | { |
| 410 | | #if USE_SCHEMATICS_RSEL |
| 411 | | X_WRBITS(m_rsel, 5, 3, 3, RA3(f2_emu_load_dns, m_emu.ir, m_rsel)); |
| 412 | | X_WRBITS(m_rsel, 5, 4, 4, RA4(f2_emu_load_dns, m_emu.ir, m_rsel)); |
| 413 | | #else |
| 414 | 395 | X_WRBITS(m_rsel, 5, 3, 4, IR_DstAC(m_emu.ir) ^ 3); |
| 415 | | #endif |
| 416 | 396 | LOG((LOG_EMU,2," DNS←; rsel := DstAC (%#o %s)\n", m_rsel, r_name(m_rsel))); |
| 417 | 397 | } |
| 418 | 398 | |
| 419 | 399 | /** |
| 420 | | * @brief f2_load_dns late: do novel shifts |
| 400 | * @brief do novel shifts |
| 421 | 401 | * |
| 422 | 402 | * <PRE> |
| 423 | 403 | * New emulator carry is selected by instruction register |
| r26424 | r26425 | |
| 499 | 479 | } |
| 500 | 480 | |
| 501 | 481 | /** |
| 502 | | * @brief f2_acdest early: modify RSELECT with DstAC = (3 - IR[3-4]) |
| 482 | * @brief destiantion accu: modify RSELECT with DstAC = (3 - IR[3-4]) |
| 503 | 483 | */ |
| 504 | 484 | void alto2_cpu_device::f2_early_acdest() |
| 505 | 485 | { |
| 506 | | #if USE_SCHEMATICS_RSEL |
| 507 | | ALTO2_PUT(m_rsel, 5, 3, 3, RA3(f2_emu_acdest, m_emu.ir, m_rsel)); |
| 508 | | ALTO2_PUT(m_rsel, 5, 4, 4, RA4(f2_emu_acdest, m_emu.ir, m_rsel)); |
| 509 | | #else |
| 510 | 486 | X_WRBITS(m_rsel, 5, 3, 4, IR_DstAC(m_emu.ir) ^ 3); |
| 511 | | #endif |
| 512 | 487 | LOG((LOG_EMU,2," ACDEST←; mux (rsel:%#o %s)\n", m_rsel, r_name(m_rsel))); |
| 513 | 488 | } |
| 514 | 489 | |
| r26424 | r26425 | |
| 555 | 530 | #endif /* DEBUG */ |
| 556 | 531 | |
| 557 | 532 | /** |
| 558 | | * @brief f2_load_ir late: load instruction register IR and branch on IR[0,5-7] |
| 533 | * @brief load instruction register IR and branch on IR[0,5-7] |
| 559 | 534 | * |
| 560 | 535 | * Loading the IR clears the skip latch. |
| 561 | 536 | */ |
| r26424 | r26425 | |
| 563 | 538 | { |
| 564 | 539 | UINT16 r = (X_BIT(m_bus,16,0) << 3) | X_RDBITS(m_bus,16,5,7); |
| 565 | 540 | |
| 541 | #if ALTO2_DEBUG |
| 566 | 542 | /* special logging of some opcodes */ |
| 567 | 543 | switch (m_bus) { |
| 568 | 544 | case op_CYCLE: |
| r26424 | r26425 | |
| 595 | 571 | m_r[rsel_ac2], m_r[rsel_ac3])); |
| 596 | 572 | break; |
| 597 | 573 | case op_BITBLT: |
| 598 | | #if ALTO2_DEBUG |
| 599 | 574 | bitblt_info(); |
| 600 | | #endif |
| 601 | 575 | break; |
| 602 | 576 | case op_RDRAM: |
| 603 | 577 | LOG((LOG_EMU,3," RDRAM addr:%#o\n", m_r[rsel_ac1])); |
| r26424 | r26425 | |
| 615 | 589 | LOG((LOG_EMU,3," XMSTA [bank:%o AC1:#o] = AC0 (%#o)\n", m_bank_reg[m_task] & 3, m_r[rsel_ac1], m_r[rsel_ac0])); |
| 616 | 590 | break; |
| 617 | 591 | } |
| 592 | #endif |
| 618 | 593 | m_emu.ir = m_bus; |
| 619 | 594 | m_emu.skip = 0; |
| 620 | 595 | m_next2 |= r; |
| r26424 | r26425 | |
| 622 | 597 | |
| 623 | 598 | |
| 624 | 599 | /** |
| 625 | | * @brief f2_idisp late: branch on: arithmetic IR_SH, others PROM ctl2k_u3[IR[1-7]] |
| 600 | * @brief branch on: arithmetic IR_SH, others PROM ctl2k_u3[IR[1-7]] |
| 626 | 601 | */ |
| 627 | 602 | void alto2_cpu_device::f2_late_idisp() |
| 628 | 603 | { |
| r26424 | r26425 | |
| 642 | 617 | } |
| 643 | 618 | |
| 644 | 619 | /** |
| 645 | | * @brief f2_acsource early: modify RSELECT with SrcAC = (3 - IR[1-2]) |
| 620 | * @brief source accu: modify RSELECT with SrcAC = (3 - IR[1-2]) |
| 646 | 621 | */ |
| 647 | 622 | void alto2_cpu_device::f2_early_acsource() |
| 648 | 623 | { |
| 649 | | #if USE_SCHEMATICS_RSEL |
| 650 | | X_WRBITS(m_rsel, 5, 3, 3, RA3(f2_emu_acsource, m_emu.ir, m_rsel)); |
| 651 | | X_WRBITS(m_rsel, 5, 4, 4, RA4(f2_emu_acsource, m_emu.ir, m_rsel)); |
| 652 | | #else |
| 653 | 624 | X_WRBITS(m_rsel, 5, 3, 4, IR_SrcAC(m_emu.ir) ^ 3); |
| 654 | | #endif |
| 655 | 625 | LOG((LOG_EMU,2," ←ACSOURCE; rsel := SrcAC (%#o %s)\n", m_rsel, r_name(m_rsel))); |
| 656 | 626 | } |
| 657 | 627 | |
| 658 | 628 | /** |
| 659 | | * @brief f2_acsource late: branch on: arithmetic IR_SH, others PROM ctl2k_u3[IR[1-7]] |
| 629 | * @brief branch on: arithmetic IR_SH, others PROM ctl2k_u3[IR[1-7]] |
| 660 | 630 | */ |
| 661 | 631 | void alto2_cpu_device::f2_late_acsource() |
| 662 | 632 | { |