Special variables: Difference between revisions
Content added Content deleted
Puppydrum64 (talk | contribs) |
Puppydrum64 (talk | contribs) |
||
Line 2,243: | Line 2,243: | ||
retn ;in this example, the NMI routine will immediately return without doing anything.</lang> |
retn ;in this example, the NMI routine will immediately return without doing anything.</lang> |
||
The <code>I</code> register handles the interrupt operation in <code>IM 2</code> mode. The Game Boy does not have this register, as it handles interrupts differently. |
|||
The <code>r</code> register handles memory refresh. You should '''not''' write to this register, as doing so can damage your hardware. But reading from this register is safe. It basically contains a pseudo-random value, and while its randomness isn't sufficient to reliably seed a PRNG, it can be used to add a little "salt" to a random value. (It should be noted that the Game Boy doesn't have this register, so don't bother trying.) |
|||
<lang z80> ld a,r ;read from the refresh register.</lang> |
|||
=={{header|zkl}}== |
=={{header|zkl}}== |