Commit 5c3c7e7
committed
V7 microcode + eu.v: IRET interrupt-recognition fix
Real 8086 only delays interrupt recognition after STI / MOV SS / POP SS.
MCL86jr was also deferring after IRET, which broke the BIOS timer ISR's
return path: IRET pops FLAGS (with IF=1) and the very next 18.2Hz tick
that lands during the return-from-ISR should be taken immediately.
MCL86jr was skipping that poll and the tick got dropped until the next
real new_instruction edge.
Two pieces needed fixing in tandem:
1. Microcode (Microcode_MCL86.txt). IRET's terminating jump went to
0x0474 (the legacy skip-INT path used by POP/MOV SS). Redirected to
the with-INT-poll ending at 0x0FCB.
2. EU (eu.v). intr_enable_delayed only updates on new_instruction
edges, so even with the with-INT-poll path the IRET microcode's
post-FLAGS-load INT poll would still see IF=0 from before the
restore. eu.v now detects the "OR r0 into FLAGS" microcode step
(at ROM addr 0x0532; BRAM has 1-cycle synchronous read so the
detection is gated on eu_rom_address == 0x0533) and syncs
intr_enable_delayed in-cycle from bit 9 of the ALU output. Must
come BEFORE the eu_flag_i==0 short-circuit because eu_flag_i is
the OLD value at this point.
Caught running King's Quest I on PCjr under the cosim: the BIOS timer
ISR IRETs to user code, and the next 18.2 Hz tick races the return.1 parent 063896e commit 5c3c7e7
4 files changed
Lines changed: 51 additions & 5 deletions
File tree
- MCL86jr/FPGA/src4synth
- MCL86/Core
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
63 | 80 | | |
64 | 81 | | |
65 | 82 | | |
| |||
5676 | 5693 | | |
5677 | 5694 | | |
5678 | 5695 | | |
5679 | | - | |
| 5696 | + | |
| 5697 | + | |
| 5698 | + | |
| 5699 | + | |
| 5700 | + | |
| 5701 | + | |
| 5702 | + | |
5680 | 5703 | | |
5681 | 5704 | | |
5682 | 5705 | | |
| |||
5711 | 5734 | | |
5712 | 5735 | | |
5713 | 5736 | | |
5714 | | - | |
| 5737 | + | |
| 5738 | + | |
| 5739 | + | |
| 5740 | + | |
| 5741 | + | |
5715 | 5742 | | |
5716 | 5743 | | |
5717 | | - | |
| 5744 | + | |
5718 | 5745 | | |
5719 | 5746 | | |
5720 | 5747 | | |
| |||
Lines changed: 2 additions & 0 deletions
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
405 | 405 | | |
406 | 406 | | |
407 | 407 | | |
408 | | - | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
409 | 424 | | |
410 | 425 | | |
411 | 426 | | |
| |||
623 | 638 | | |
624 | 639 | | |
625 | 640 | | |
626 | | - | |
| 641 | + | |
627 | 642 | | |
628 | 643 | | |
629 | 644 | | |
| |||
0 commit comments