You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Interrupt_Sources.md
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
1
# Interrupt Sources
2
2
3
-
## INT 40 - VBlank Interrupt
3
+
## INT $40 — VBlank interrupt
4
4
5
-
This interrupt is requested every time the Game Boy enters VBlank ([Mode 1](<#FF41 - STAT (LCD Status) (R/W)>)).
5
+
This interrupt is requested every time the Game Boy enters VBlank ([Mode 1](<#FF41 — STAT: LCD status>)).
6
6
7
7
The VBlank interrupt occurs ca. 59.7 times a second on a handheld Game
8
8
Boy (DMG or CGB) or Game Boy Player and ca. 61.1 times a second on a
@@ -11,10 +11,10 @@ VBlank period (LY=144). During this period video hardware is not using
11
11
VRAM so it may be freely accessed. This period lasts approximately 1.1
12
12
milliseconds.
13
13
14
-
## INT 48 - STAT Interrupt
14
+
## INT $48 — STAT interrupt
15
15
16
16
There are various sources which can trigger this interrupt to occur as
17
-
described in [STAT register (\$FF41)](<#FF41 - STAT (LCD Status) (R/W)>).
17
+
described in [STAT register (\$FF41)](<#FF41 — STAT: LCD status>).
18
18
19
19
The various STAT interrupt sources (modes 0-2 and LYC=LY) have their
20
20
state (inactive=low and active=high) logically ORed into a shared
@@ -30,7 +30,7 @@ If a STAT interrupt source logically ORs the interrupt line high while
30
30
there will be no low-to-high transition and so no interrupt will occur.
31
31
This phenomenon is known as "STAT blocking" ([test ROM example](https://github.com/Gekkio/mooneye-gb/blob/2d52008228557f9e713545e702d5b7aa233d09bb/tests/acceptance/ppu/stat_irq_blocking.s#L21-L22)).
32
32
33
-
As mentioned in the description of the [STAT register](<#FF41 - STAT (LCD Status) (R/W)>),
33
+
As mentioned in the description of the [STAT register](<#FF41 — STAT: LCD status>),
34
34
the PPU cycles through the different modes in a fixed order. So for
35
35
example, if interrupts are enabled for two consecutive modes such as
36
36
Mode 0 and Mode 1, then no interrupt will trigger for Mode 1 (since
@@ -50,14 +50,14 @@ the handler disable sprites. This can be used if you use the window for
50
50
a text box (at the bottom of the screen), and you want sprites to be
51
51
hidden by the text box.
52
52
53
-
## INT 50 - Timer Interrupt
53
+
## INT $50 — Timer interrupt
54
54
55
-
Every time that the timer overflows (that is, when [TIMA](<#FF05 - TIMA - Timer counter (R/W)>) exceeds $FF),
55
+
Every time that the timer overflows (that is, when [TIMA](<#FF05 — TIMA: Timer counter>) exceeds $FF),
56
56
an interrupt is requested by setting bit 2 in the IF register
57
57
($FF0F). As soon as that interrupt is enabled, the CPU will execute it by
58
58
calling the timer interrupt vector at $0050.
59
59
60
-
## INT 58 - Serial Interrupt
60
+
## INT $58 — Serial interrupt
61
61
62
62
**XXXXXX\...**
63
63
@@ -96,15 +96,15 @@ port and a byte to be shifted into \$FF01:
96
96
The Game Boy does not support wake-on-LAN. Completion of an externally
97
97
clocked serial transfer does not exit STOP mode.
98
98
99
-
## INT 60 - Joypad Interrupt
99
+
## INT $60 — Joypad interrupt
100
100
101
-
The Joypad interrupt is requested when any of [`P1`](<#FF00 - P1/JOYP - Joypad (R/W)>) bits 0-3 change
101
+
The Joypad interrupt is requested when any of [`P1`](<#FF00 — P1/JOYP: Joypad>) bits 0-3 change
102
102
from High to Low. This happens when a button is
103
103
pressed (provided that the action/direction buttons are enabled by
104
104
bit 5/4, respectively), however, due to switch bounce, one or more High to Low
105
105
transitions are usually produced when pressing a button.
106
106
107
-
### Using the Joypad Interrupt
107
+
### Using the joypad interrupt
108
108
109
109
This interrupt is useful to identify button presses if we have only selected
110
110
either action (bit 5) or direction (bit 4), but not both.
Copy file name to clipboardExpand all lines: src/Interrupts.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Interrupts
2
2
3
-
## IME - Interrupt Master Enable Flag (Write Only)
3
+
## IME: Interrupt master enable flag \[write only\]
4
4
5
5
```
6
6
0 - Disable all interrupts
@@ -26,7 +26,7 @@ The effect of `ei` is delayed by one instruction. This means that `ei`
26
26
followed immediately by `di` does not allow any interrupts between them.
27
27
This interacts with the [`halt` bug](<#halt bug>) in an interesting way.
28
28
29
-
## FFFF - IE - Interrupt Enable (R/W)
29
+
## FFFF — IE: Interrupt enable
30
30
31
31
```
32
32
Bit 0: VBlank Interrupt Enable (INT $40) (1=Enable)
@@ -36,7 +36,7 @@ Bit 3: Serial Interrupt Enable (INT $58) (1=Enable)
36
36
Bit 4: Joypad Interrupt Enable (INT $60) (1=Enable)
37
37
```
38
38
39
-
## FF0F - IF - Interrupt Flag (R/W)
39
+
## FF0F — IF: Interrupt flag
40
40
41
41
```
42
42
Bit 0: VBlank Interrupt Request (INT $40) (1=Request)
@@ -66,7 +66,7 @@ unless/until IME and IE allow it.
66
66
1. The IF bit corresponding to this interrupt and the IME flag are reset by the CPU.
67
67
The former "acknowledges" the interrupt, while the latter prevents any further interrupts
68
68
from being handled until the program re-enables them, typically by using the `reti` instruction.
69
-
2. The corresponding interrupt handler (see the IE and IF register descriptions [above](<#FFFF - IE - Interrupt Enable (R/W)>)) is
69
+
2. The corresponding interrupt handler (see the IE and IF register descriptions [above](<#FFFF — IE: Interrupt enable>)) is
70
70
called by the CPU. This is a regular call, exactly like what would be performed by a `call <address>` instruction (the current PC is pushed onto the stack
71
71
and then set to the address of the interrupt handler).
0 commit comments