~ubuntu-branches/ubuntu/maverick/vice/maverick

« back to all changes in this revision

Viewing changes to src/c128/z80.c

  • Committer: Bazaar Package Importer
  • Author(s): Zed Pobre
  • Date: 2005-02-01 11:30:26 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20050201113026-3eyakzsmmheclvjg
Tags: 1.16-1
* New upstream version
* Fixes crash on 64-bit architectures (closes: #287640)
* x128 working again (closes: #286767)
* Works fine with /dev/dsp in use (not in the main changelog, but tested
  on my local machine as working).  Presumably, this also takes care of
  the issue with dsp being held.  I'm not sure if this is because I'm
  testing it on a 2.6 kernel now -- if you are still having problems
  with /dev/dsp, please reopen the bugs. (closes: #152952, #207942)
* Don't kill Makefile.in on clean

Show diffs side-by-side

added added

removed removed

Lines of Context:
410
410
 
411
411
/* Interrupt handling.  */
412
412
 
413
 
#define DO_INTERRUPT(int_kind)                                           \
414
 
    do {                                                                 \
415
 
        BYTE ik = (int_kind);                                            \
416
 
                                                                         \
417
 
        if (ik & (IK_IRQ | IK_NMI)) {                                    \
418
 
            if ((ik & IK_NMI) && 0) {                                    \
419
 
            } else if ((ik & IK_IRQ) && iff1                             \
420
 
                && !OPINFO_DISABLES_IRQ(LAST_OPCODE_INFO)) {             \
421
 
                WORD jumpdst;                                            \
422
 
                /*TRACE_IRQ();*/                                         \
423
 
                if (mon_mask[e_comp_space] & (MI_STEP)) {                \
424
 
                    mon_check_icount_interrupt();                        \
425
 
                }                                                        \
426
 
                CLK += 4;                                                \
427
 
                --reg_sp;                                                \
428
 
                STORE((reg_sp), ((BYTE)(z80_reg_pc >> 8)));              \
429
 
                CLK += 4;                                                \
430
 
                --reg_sp;                                                \
431
 
                STORE((reg_sp), ((BYTE)(z80_reg_pc & 0xff)));            \
432
 
                iff1 = 0;                                                \
433
 
                iff2 = 0;                                                \
434
 
                if (im_mode == 1) {                                      \
435
 
                    jumpdst = 0x38;                                      \
436
 
                    CLK += 4;                                            \
437
 
                    JUMP(jumpdst);                                       \
438
 
                    CLK += 3;                                            \
439
 
                } else {                                                 \
440
 
                    jumpdst = (LOAD(reg_i << 8) << 8);                   \
441
 
                    CLK += 4;                                            \
442
 
                    jumpdst |= (LOAD((reg_i << 8) + 1));                 \
443
 
                    JUMP(jumpdst);                                       \
444
 
                    CLK += 3;                                            \
445
 
                }                                                        \
446
 
            }                                                            \
447
 
        }                                                                \
448
 
        if (ik & (IK_TRAP | IK_RESET)) {                                 \
449
 
            if (ik & IK_TRAP) {                                          \
450
 
                export_registers();                                      \
451
 
                interrupt_do_trap(cpu_int_status, (WORD)z80_reg_pc);     \
452
 
                import_registers();                                      \
453
 
                if (cpu_int_status->global_pending_int & IK_RESET)       \
454
 
                    ik |= IK_RESET;                                      \
455
 
            }                                                            \
456
 
            if (ik & IK_RESET) {                                         \
457
 
                interrupt_ack_reset(cpu_int_status);                     \
458
 
                maincpu_reset();                                         \
459
 
            }                                                            \
460
 
        }                                                                \
461
 
        if (ik & (IK_MONITOR)) {                                         \
462
 
            caller_space = e_comp_space;                                 \
463
 
            if (mon_force_import(e_comp_space))                          \
464
 
                import_registers();                                      \
465
 
            if (mon_mask[e_comp_space])                                  \
466
 
                export_registers();                                      \
467
 
            if (mon_mask[e_comp_space] & (MI_BREAK)) {                   \
468
 
                if (check_breakpoints(e_comp_space, (WORD)z80_reg_pc)) { \
469
 
                   monitor_startup();                                    \
470
 
                }                                                        \
471
 
            }                                                            \
472
 
            if (mon_mask[e_comp_space] & (MI_STEP)) {                    \
473
 
                mon_check_icount((WORD)z80_reg_pc);                      \
474
 
            }                                                            \
475
 
            if (mon_mask[e_comp_space] & (MI_WATCH)) {                   \
476
 
                mon_check_watchpoints((WORD)z80_reg_pc);                 \
477
 
            }                                                            \
478
 
        }                                                                \
 
413
#define DO_INTERRUPT(int_kind)                                       \
 
414
    do {                                                             \
 
415
        BYTE ik = (int_kind);                                        \
 
416
                                                                     \
 
417
        if (ik & (IK_IRQ | IK_NMI)) {                                \
 
418
            if ((ik & IK_NMI) && 0) {                                \
 
419
            } else if ((ik & IK_IRQ) && iff1                         \
 
420
                && !OPINFO_DISABLES_IRQ(LAST_OPCODE_INFO)) {         \
 
421
                WORD jumpdst;                                        \
 
422
                /*TRACE_IRQ();*/                                     \
 
423
                if (monitor_mask[e_comp_space] & (MI_STEP)) {        \
 
424
                    monitor_check_icount_interrupt();                \
 
425
                }                                                    \
 
426
                CLK += 4;                                            \
 
427
                --reg_sp;                                            \
 
428
                STORE((reg_sp), ((BYTE)(z80_reg_pc >> 8)));          \
 
429
                CLK += 4;                                            \
 
430
                --reg_sp;                                            \
 
431
                STORE((reg_sp), ((BYTE)(z80_reg_pc & 0xff)));        \
 
432
                iff1 = 0;                                            \
 
433
                iff2 = 0;                                            \
 
434
                if (im_mode == 1) {                                  \
 
435
                    jumpdst = 0x38;                                  \
 
436
                    CLK += 4;                                        \
 
437
                    JUMP(jumpdst);                                   \
 
438
                    CLK += 3;                                        \
 
439
                } else {                                             \
 
440
                    jumpdst = (LOAD(reg_i << 8) << 8);               \
 
441
                    CLK += 4;                                        \
 
442
                    jumpdst |= (LOAD((reg_i << 8) + 1));             \
 
443
                    JUMP(jumpdst);                                   \
 
444
                    CLK += 3;                                        \
 
445
                }                                                    \
 
446
            }                                                        \
 
447
        }                                                            \
 
448
        if (ik & (IK_TRAP | IK_RESET)) {                             \
 
449
            if (ik & IK_TRAP) {                                      \
 
450
                export_registers();                                  \
 
451
                interrupt_do_trap(cpu_int_status, (WORD)z80_reg_pc); \
 
452
                import_registers();                                  \
 
453
                if (cpu_int_status->global_pending_int & IK_RESET)   \
 
454
                    ik |= IK_RESET;                                  \
 
455
            }                                                        \
 
456
            if (ik & IK_RESET) {                                     \
 
457
                interrupt_ack_reset(cpu_int_status);                 \
 
458
                maincpu_reset();                                     \
 
459
            }                                                        \
 
460
        }                                                            \
 
461
        if (ik & (IK_MONITOR)) {                                     \
 
462
            caller_space = e_comp_space;                             \
 
463
            if (monitor_force_import(e_comp_space))                  \
 
464
                import_registers();                                  \
 
465
            if (monitor_mask[e_comp_space])                          \
 
466
                export_registers();                                  \
 
467
            if (monitor_mask[e_comp_space] & (MI_BREAK)) {           \
 
468
                if (monitor_check_breakpoints(e_comp_space,          \
 
469
                    (WORD)z80_reg_pc)) {                             \
 
470
                    monitor_startup();                               \
 
471
                }                                                    \
 
472
            }                                                        \
 
473
            if (monitor_mask[e_comp_space] & (MI_STEP)) {            \
 
474
                monitor_check_icount((WORD)z80_reg_pc);              \
 
475
            }                                                        \
 
476
            if (monitor_mask[e_comp_space] & (MI_WATCH)) {           \
 
477
                monitor_check_watchpoints((WORD)z80_reg_pc);         \
 
478
            }                                                        \
 
479
        }                                                            \
479
480
    } while (0)
480
481
 
481
482
/* ------------------------------------------------------------------------- */
6258
6259
            CALL(0x38, 3, 3, 5, 1);
6259
6260
            break;
6260
6261
        }
 
6262
 
 
6263
        cpu_int_status->num_dma_per_opcode = 0;
 
6264
 
6261
6265
    } while (!dma_request);
6262
6266
 
6263
6267
    export_registers();