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, addressFFFF
, determines which one of the 5 interrupt types are enabled. Only those set to1
will be accepted ifIME
(interrupt master enable) ist set to1
. TheIF
(interrupt flags) register, addressFF0F
, provides merely information which interrupts are requested.So, if a program is in the
HALT
state withIME
=1
, any interrupt is accepted that is enabled inIE
. Of course, somebody had to generate the interrupt(s) which would be indicated by a (or more) 1 in theIF
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.