fork of PCE focusing on macplus, supporting DaynaPort SCSI network emulation
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

8086: Allow interrupts only if IF was set before and after the instruction

This ensures that instructions like popf or sti that set the interrupt
flag are not immediately followed by an interrupt.

+15 -22
+10 -14
src/cpu/e8086/e8086.c
··· 5 5 /***************************************************************************** 6 6 * File name: src/cpu/e8086/e8086.c * 7 7 * Created: 1996-04-28 by Hampa Hug <hampa@hampa.ch> * 8 - * Copyright: (C) 1996-2019 Hampa Hug <hampa@hampa.ch> * 8 + * Copyright: (C) 1996-2021 Hampa Hug <hampa@hampa.ch> * 9 9 *****************************************************************************/ 10 10 11 11 /***************************************************************************** ··· 392 392 e86_set_cs (c, e86_get_mem16 (c, 0, ofs + 2)); 393 393 c->flg &= ~(E86_FLG_I | E86_FLG_T); 394 394 395 - c->trap_flag = c->flg; 395 + c->save_flags = e86_get_flags (c); 396 396 397 397 e86_pq_init (c); 398 398 } ··· 465 465 e86_set_ip (c, 0xfff0); 466 466 e86_set_flags (c, c->reset_flags); 467 467 468 - c->trap_flag = 0; 468 + c->save_flags = 0; 469 469 470 470 c->pq_cnt = 0; 471 471 ··· 503 503 c->cur_ip = c->ip; 504 504 } 505 505 506 - c->trap_flag = c->flg; 506 + c->save_flags = e86_get_flags (c); 507 507 508 508 irq = c->irq; 509 - 510 - c->enable_int = 1; 511 509 512 510 do { 513 511 e86_pq_fill (c); ··· 531 529 532 530 c->opcnt += 1; 533 531 534 - if (c->enable_int) { 535 - if (c->trap_flag & E86_FLG_T) { 536 - c->state &= ~E86_STATE_HALT; 537 - e86_trap (c, 1); 538 - } 539 - else if (irq && c->irq && e86_get_if (c)) { 540 - e86_irq_ack (c); 541 - } 532 + if (c->save_flags & E86_FLG_T) { 533 + c->state &= ~E86_STATE_HALT; 534 + e86_trap (c, 1); 535 + } 536 + else if (irq && c->irq && (c->save_flags & e86_get_flags (c) & E86_FLG_I)) { 537 + e86_irq_ack (c); 542 538 } 543 539 } 544 540
+2 -3
src/cpu/e8086/e8086.h
··· 5 5 /***************************************************************************** 6 6 * File name: src/cpu/e8086/e8086.h * 7 7 * Created: 1996-04-28 by Hampa Hug <hampa@hampa.ch> * 8 - * Copyright: (C) 1996-2019 Hampa Hug <hampa@hampa.ch> * 8 + * Copyright: (C) 1996-2021 Hampa Hug <hampa@hampa.ch> * 9 9 *****************************************************************************/ 10 10 11 11 /***************************************************************************** ··· 105 105 unsigned short ip; 106 106 unsigned short flg; 107 107 108 - unsigned short trap_flag; 108 + unsigned short save_flags; 109 109 110 110 void *mem; 111 111 e86_get_uint8_f mem_get_uint8; ··· 153 153 unsigned char state; 154 154 155 155 char irq; 156 - char enable_int; 157 156 158 157 unsigned int_cnt; 159 158 unsigned char int_vec;
+3 -5
src/cpu/e8086/opcodes.c
··· 5 5 /***************************************************************************** 6 6 * File name: src/cpu/e8086/opcodes.c * 7 7 * Created: 1996-04-28 by Hampa Hug <hampa@hampa.ch> * 8 - * Copyright: (C) 1996-2019 Hampa Hug <hampa@hampa.ch> * 8 + * Copyright: (C) 1996-2021 Hampa Hug <hampa@hampa.ch> * 9 9 *****************************************************************************/ 10 10 11 11 /***************************************************************************** ··· 496 496 e86_set_ss (c, e86_pop (c)); 497 497 e86_set_clk (c, 8); 498 498 499 - c->enable_int = 0; 499 + c->save_flags &= ~E86_FLG_I; 500 500 501 501 return (1); 502 502 } ··· 2350 2350 e86_pq_init (c); 2351 2351 } 2352 2352 else if (reg == E86_REG_SS) { 2353 - c->enable_int = 0; 2353 + c->save_flags &= ~E86_FLG_I; 2354 2354 } 2355 2355 2356 2356 return (c->ea.cnt + 1); ··· 3368 3368 e86_set_ip (c, e86_pop (c)); 3369 3369 e86_set_cs (c, e86_pop (c)); 3370 3370 c->flg = e86_pop (c); 3371 - 3372 - c->enable_int = 0; 3373 3371 3374 3372 e86_pq_init (c); 3375 3373