Jump to content

GB Programming: Difference between revisions

m
→‎A special jp: Change "jp (hl)" to "jp hl"
>ISSOtm
(→‎Flags: Remove flags that don't exist on Game Boy)
>Bbbbbbbbba
m (→‎A special jp: Change "jp (hl)" to "jp hl")
Line 770:
There is one special case of jp, though !
{| class="wikitable"
|JP (HL)
|Has execution jumping to the address pointed to by hl.<br/>Does not accept any conditionals.
|}
Line 776:
<pre>
ld hl, $2457
jp (hl)
</pre>
will jump to $2457. Some might argue that "jp $2457" is better, as it'd save 1 byte and preserve the hl register.
 
However, "jp (hl)" is used to do dynamic jumps : "jp (hl)" may jump to a different location every time it is ran. When doing "static" (ie. always the same) jumps, it IS'''is''' better to use jp $xxyy. "jp (hl)" mostly used with function pointer tables - we'll see that later.
 
===Comparing stuff===
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.