According to Gameboy Programming Manual,
HALT mode is canceled by the following events, which have the starting addresses indicated.
A LOW signal to the /RESET terminal Starting address: 0x0000
The interrupt-enable flag and its corresponding interrupt request flag are set
IME = 0 (Interrupt Master Enable flag disabled) Starting address: address following that of the HALT instruction
IME = 1 (Interrupt Master Enable flag enabled) Starting address: each interrupt starting address
Assume a program enters HALT
mode with Interrupt Master Enable flag enabled IME = 1
and Interrupt Enable disabled for any interrupt 0xFF0F = 0
, what would happen? What is the expected behaviour on the actual Gameboy device?
I am not sure if I understand your question right, but anyway:
According to the cited manual, the IE
(interrupt enable) register, address FFFF
, determines which one of the 5 interrupt types are enabled. Only those set to 1
will be accepted if IME
(interrupt master enable) ist set to 1
.
The IF
(interrupt flags) register, address FF0F
, provides merely information which interrupts are requested.
So, if a program is in the HALT
state with IME
= 1
, any interrupt is accepted that is enabled in IE
. Of course, somebody had to generate the interrupt(s) which would be indicated by a (or more) 1 in the IF
register.
EDIT:
Maybe this answers your question now:
If the program enters HALT mode, Interrupt Master Enable is enabled (IME = 1), but all specific interrupt types are disabled (IE = 0), no interrupt will be accepted, and HALT mode is not left. This is the expected behavior on the device.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With