Clarify the JR documentation based on its usage (#1032)

Fixes #1020
This commit is contained in:
Rangi
2022-08-28 15:42:04 -04:00
committed by GitHub
parent 14e6a79adc
commit 4363ffcad4

View File

@@ -171,8 +171,8 @@ and
.It Sx JP HL .It Sx JP HL
.It Sx JP n16 .It Sx JP n16
.It Sx JP cc,n16 .It Sx JP cc,n16
.It Sx JR e8 .It Sx JR n16
.It Sx JR cc,e8 .It Sx JR cc,n16
.It Sx RET cc .It Sx RET cc
.It Sx RET .It Sx RET
.It Sx RETI .It Sx RETI
@@ -754,22 +754,34 @@ Cycles: 1
Bytes: 1 Bytes: 1
.Pp .Pp
Flags: None affected. Flags: None affected.
.Ss JR e8 .Ss JR n16
Relative Jump by adding Relative Jump to address
.Ar e8 .Ar n16 .
to the address of the instruction following the The address is encoded as a signed 8-bit offset from the address immediately following the
.Sy JR . .Ic JR
To clarify, an operand of 0 is equivalent to no jumping. instruction, so the target address
.Ar n16
must be between
.Sy -128
and
.Sy 127
bytes away.
For example:
.Bd -literal -offset indent
JR Label ; no-op; encoded offset of 0
Label:
JR Label ; infinite loop; encoded offset of -2
.Ed
.Pp .Pp
Cycles: 3 Cycles: 3
.Pp .Pp
Bytes: 2 Bytes: 2
.Pp .Pp
Flags: None affected. Flags: None affected.
.Ss JR cc,e8 .Ss JR cc,n16
Relative Jump by adding Relative Jump to address
.Ar e8 .Ar n16
to the current address if condition if condition
.Ar cc .Ar cc
is met. is met.
.Pp .Pp