Skip to content

Commit eb4c695

Browse files
authored
Fix misc. formatting in interrupts page
1 parent 59fb2cc commit eb4c695

File tree

1 file changed

+22
-25
lines changed

1 file changed

+22
-25
lines changed

src/Interrupts.md

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ using a I/O address. IME can be modified by
1313
the following instructions/events only:
1414

1515
```
16-
EI ;Enables interrupts (that is, IME=1)
17-
DI ;Disables interrupts (that is, IME=0)
18-
RETI ;Enables interrupts and returns (same as the instruction sequence EI, RET)
19-
<INT> ;Disables interrupts and calls interrupt vector
16+
EI ; Enables interrupts (that is, IME=1)
17+
DI ; Disables interrupts (that is, IME=0)
18+
RETI ; Enables interrupts and returns (same as the instruction sequence EI, RET)
19+
<INT> ; Disables interrupts and calls interrupt vector
2020
```
2121

2222
where \<INT\> means the operation which is automatically executed by the
@@ -29,21 +29,21 @@ This interacts with the [`halt` bug](<#halt bug>) in an interesting way.
2929
## FFFF - IE - Interrupt Enable (R/W)
3030

3131
```
32-
Bit 0: VBlank Interrupt Enable (INT 40h) (1=Enable)
33-
Bit 1: LCD STAT Interrupt Enable (INT 48h) (1=Enable)
34-
Bit 2: Timer Interrupt Enable (INT 50h) (1=Enable)
35-
Bit 3: Serial Interrupt Enable (INT 58h) (1=Enable)
36-
Bit 4: Joypad Interrupt Enable (INT 60h) (1=Enable)
32+
Bit 0: VBlank Interrupt Enable (INT $40) (1=Enable)
33+
Bit 1: LCD STAT Interrupt Enable (INT $48) (1=Enable)
34+
Bit 2: Timer Interrupt Enable (INT $50) (1=Enable)
35+
Bit 3: Serial Interrupt Enable (INT $58) (1=Enable)
36+
Bit 4: Joypad Interrupt Enable (INT $60) (1=Enable)
3737
```
3838

3939
## FF0F - IF - Interrupt Flag (R/W)
4040

4141
```
42-
Bit 0: VBlank Interrupt Request (INT 40h) (1=Request)
43-
Bit 1: LCD STAT Interrupt Request (INT 48h) (1=Request)
44-
Bit 2: Timer Interrupt Request (INT 50h) (1=Request)
45-
Bit 3: Serial Interrupt Request (INT 58h) (1=Request)
46-
Bit 4: Joypad Interrupt Request (INT 60h) (1=Request)
42+
Bit 0: VBlank Interrupt Request (INT $40) (1=Request)
43+
Bit 1: LCD STAT Interrupt Request (INT $48) (1=Request)
44+
Bit 2: Timer Interrupt Request (INT $50) (1=Request)
45+
Bit 3: Serial Interrupt Request (INT $58) (1=Request)
46+
Bit 4: Joypad Interrupt Request (INT $60) (1=Request)
4747
```
4848

4949
When an interrupt signal changes from low to high, the
@@ -70,19 +70,16 @@ from being handled until the program re-enables them, typically by using the `re
7070
called by the CPU. This is a regular call, exactly like what would be performed by a `call <vector>` instruction (the current PC is pushed on the stack
7171
and then set to the address of the interrupt vector).
7272

73-
According to Z80 datasheets, the following occurs when control is being
74-
transferred to an interrupt handler:
73+
The following occurs when control is being transferred to an interrupt handler:
7574

76-
1. Two wait states are executed (2 machine cycles pass while nothing
77-
occurs, presumably the CPU is executing NOPs during this time).
78-
2. The current PC is pushed onto the stack, this process consumes 2 more
79-
machine cycles.
80-
3. The high byte of the PC is set to 0, the low byte is set to the
81-
address of the handler ($40,$48,$50,$58,$60). This consumes one
82-
last machine cycle.
75+
1. Two wait states are executed (2 M-cycles pass while nothing
76+
occurs, presumably the CPU is executing `nop`s during this time).
77+
2. The current PC is pushed onto the stack, consuming 2 more M-cycles.
78+
3. The PC register is set to the address of the handler ($40, $48, $50, $58, $60).
79+
This consumes one last M-cycle.
8380

84-
The entire ISR **should** consume a total of 5 machine cycles. This has
85-
yet to be tested, but is what the Z80 datasheet implies.
81+
The entire ISR **should** consume a total of 5 M-cycles.
82+
This has yet to be tested, but is what the Z80 datasheet implies.
8683

8784
## Interrupt Priorities
8885

0 commit comments

Comments
 (0)