10

According to Gameboy Programming Manual,

HALT mode is canceled by the following events, which have the starting addresses indicated.

  1. A LOW signal to the /RESET terminal Starting address: 0x0000

  2. 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?

GabrielOshiro
  • 7,986
  • 4
  • 45
  • 57
  • By the way, if you like emulation and you think that questions like this one would be more suitable for a separate stack exchange site, please take a look at two proposals on Area 51 [Emulation](http://area51.stackexchange.com/proposals/79736/emulation) and [Retrocomputing](http://area51.stackexchange.com/proposals/74814/retrocomputing). – GabrielOshiro May 27 '15 at 16:09
  • Does the [current answer](http://stackoverflow.com/a/30717825/3991344) fit your needs? – Pokechu22 Jun 10 '15 at 15:07
  • @pokechu22 no, it doesn't. – GabrielOshiro Jun 14 '15 at 12:31
  • The CPU will halt forever, as the answer states, that's it. If that's not the answer then edit your question to better reflect what you actually want to know. – creker Feb 28 '16 at 00:04

1 Answers1

2

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.

Reinhard Männer
  • 14,022
  • 5
  • 54
  • 116