ref: 2b1d0de25b9fa7aea6d32bf7d423d24e08becbe7
parent: 87b202a67e2d27f83702b4c353f8f66bc8d8056a
author: Antonio Niño Díaz <antonio_nd@outlook.com>
date: Fri May 25 21:01:59 EDT 2018
Fix syntax of jumps 'JP [HL]' and similar imply that the contents pointed by [HL] are read, and that is the address where the CPU jumps to. This is not the case. That syntax would mean that a byte is loaded from the address pointed by HL, and a byte is not a valid address. The actual behaviour is to move the value of HL to the PC, which means that there is no indirection, and that the syntax should be 'JP HL'. The same applies to 'JP [IX]' and 'JP [IY]'.
--- a/as/target/x80/x80.dat
+++ b/as/target/x80/x80.dat
@@ -358,9 +358,9 @@
JP cc,imm16 3 0xc2 jp Z80,R800,GB80
JR imm16 2 0x18 jr Z80,R800,GB80
JR ss,imm16 2 0x00 jr Z80,R800,GB80
-JP (HL) 1 0xe9 jp Z80,R800,GB80
-JP (IX) 2 0xdd,0xe9 jp Z80,R800
-JP (IY) 2 0xfd,0xe9 jp Z80,R800
+JP HL 1 0xe9 noargs Z80,R800,GB80
+JP IX 2 0xdd,0xe9 noargs Z80,R800
+JP IY 2 0xfd,0xe9 noargs Z80,R800
DJNZ imm16 2 0x10 jr Z80,R800
# Call and return group
--- a/tests/as/execute/z80.s
+++ b/tests/as/execute/z80.s
@@ -757,7 +757,7 @@
POP IX / DD E1
EX (SP),IX / DD E3
PUSH IX / DD E5
- JP (IX) / DD E9
+ JP IX / DD E9
LD SP,IX / DD F9
SBC A,$64 / DE 40
RST $24 / DF
@@ -770,7 +770,7 @@
AND A,$16 / E6 10
RST $32 / E7
RET PE / E8
- JP (HL) / E9
+ JP HL / E9
JP PE,$16384 / EA 00 40
EX DE,HL / EB
CALL PE,$16384 / EC 00 40
@@ -1130,7 +1130,7 @@
POP IY / FD E1
EX (SP),IY / FD E3
PUSH IY / FD E5
- JP (IY) / FD E9
+ JP IY / FD E9
LD SP,IY / FD F9
CP A,$32 / FE 20
RST $56 / FF