@@ -669,7 +669,7 @@ static inline unsigned process_interrupts(z80* const z) {
669
669
}
670
670
671
671
if (z -> nmi_pending ) {
672
- z -> nmi_pending = 0 ;
672
+ z -> nmi_pending &= ~ Z80_PULSE ;
673
673
z -> halted = 0 ;
674
674
z -> iff1 = 0 ;
675
675
inc_r (z );
@@ -679,8 +679,8 @@ static inline unsigned process_interrupts(z80* const z) {
679
679
return cyc ;
680
680
}
681
681
682
- if (z -> int_pending && z -> iff1 ) {
683
- // z->int_pending = 0; // Commented when function to clear the line was added
682
+ if (z -> irq_pending && z -> iff1 ) {
683
+ z -> irq_pending &= ~ Z80_PULSE ;
684
684
z -> halted = 0 ;
685
685
z -> iff1 = 0 ;
686
686
z -> iff2 = 0 ;
@@ -689,7 +689,7 @@ static inline unsigned process_interrupts(z80* const z) {
689
689
switch (z -> interrupt_mode ) {
690
690
case 0 :
691
691
cyc += 11 ;
692
- cyc += exec_opcode (z , z -> int_data );
692
+ cyc += exec_opcode (z , z -> irq_data );
693
693
break ;
694
694
695
695
case 1 :
@@ -699,7 +699,7 @@ static inline unsigned process_interrupts(z80* const z) {
699
699
700
700
case 2 :
701
701
cyc += 19 ;
702
- call (z , rw (z , (z -> i << 8 ) | z -> int_data ));
702
+ call (z , rw (z , (z -> i << 8 ) | z -> irq_data ));
703
703
break ;
704
704
705
705
default :
@@ -748,9 +748,9 @@ Z80_EXPORT void z80_init(z80* const z) {
748
748
z -> iff1 = 0 ;
749
749
z -> iff2 = 0 ;
750
750
z -> halted = 0 ;
751
- z -> int_pending = 0 ;
751
+ z -> irq_pending = 0 ;
752
752
z -> nmi_pending = 0 ;
753
- z -> int_data = 0 ;
753
+ z -> irq_data = 0 ;
754
754
}
755
755
756
756
Z80_EXPORT void z80_reset (z80 * const z ) {
@@ -1267,19 +1267,32 @@ Z80_EXPORT void z80_debug_output(z80* const z) {
1267
1267
}
1268
1268
#endif /* Z80_DEBUG */
1269
1269
1270
- // function to call when an NMI is to be serviced
1271
- Z80_EXPORT void z80_gen_nmi (z80 * const z ) {
1272
- z -> nmi_pending = 1 ;
1270
+ // functions to call when an NMI is to be serviced
1271
+ Z80_EXPORT void z80_assert_nmi (z80 * const z ) {
1272
+ z -> nmi_pending |= Z80_ASSERT ;
1273
1273
}
1274
1274
1275
- // function to call when an INT is to be serviced
1276
- Z80_EXPORT void z80_gen_int (z80 * const z , uint8_t data ) {
1277
- z -> int_pending = 1 ;
1278
- z -> int_data = data ;
1275
+ Z80_EXPORT void z80_pulse_nmi (z80 * const z ) {
1276
+ z -> nmi_pending |= Z80_PULSE ;
1279
1277
}
1280
1278
1281
- Z80_EXPORT void z80_clr_int (z80 * const z ) {
1282
- z -> int_pending = 0 ;
1279
+ Z80_EXPORT void z80_clr_nmi (z80 * const z ) {
1280
+ z -> nmi_pending = 0 ;
1281
+ }
1282
+
1283
+ // functions to call when an INT is to be serviced
1284
+ Z80_EXPORT void z80_assert_irq (z80 * const z , uint8_t data ) {
1285
+ z -> irq_pending |= Z80_ASSERT ;
1286
+ z -> irq_data = data ;
1287
+ }
1288
+
1289
+ Z80_EXPORT void z80_pulse_irq (z80 * const z , uint8_t data ) {
1290
+ z -> irq_pending |= Z80_PULSE ;
1291
+ z -> irq_data = data ;
1292
+ }
1293
+
1294
+ Z80_EXPORT void z80_clr_irq (z80 * const z ) {
1295
+ z -> irq_pending = 0 ;
1283
1296
}
1284
1297
1285
1298
// executes a non-prefixed opcode
0 commit comments