Closed pomann closed 3 years ago
This conflicts with issue #1: the modern rgbasm syntax is jp hl
. ([hl]
implies dereferencing its contents, which is not the case.)
(HL) or [HL] isn't the point of this issue. 0xE9 shouldn't jump to the location stored in register HL, it should jump to the location pointed by the memory at HL
That is not the case: ld hl, Function / jp hl
will jump to Function
. And regardless, the current rgbasm syntax for it is jp hl
, so according to #1 that should be used.
0xE9 shouldn't jump to the location stored in register HL, it should jump to the location pointed by the memory at HL
Take a closer look at https://clrhome.org/table/, that's not even the case on z80:
Loads the value of hl into pc
Though somebody argued that jp hl
would mean jumping to the register.
ASM mnemonic | Pseudo-C |
---|---|
ld hl, 0 |
hl = 0; |
ld [hl], 0 |
*hl = 0; |
ld a, c |
a = c; |
ld a, [hl] |
a = *hl; |
ld pc, $1234 ( jp $1234 ) |
pc = 0x1234; |
jp hl |
pc = hl; |
jp [hl] |
pc = *hl; |
@max-m actually originally implemented this instruction as pc = *hl
in his emulator, and I believe that fixing this was one of the reasons why he begun this project in the first place.
It's pretty widely agreed upon that jp hl
is more consistent; thus, closing.
Based on z80 documentation and many other sites like https://clrhome.org/table/ and http://imrannazar.com/GameBoy-Z80-Opcode-Map the instruction 0xE9 should be JP (HL), the immediate var should therefore be set to false for this instruction