@@ -5,6 +5,10 @@ <h2 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIP
55 description, the number of bytes needed to encode them and the number of CPU
66 cycles at 1MHz (or 2MHz in GBC double speed mode) needed to complete
77 them.</ p >
8+ < p class ="Pp "> Instructons are documented according to the syntax accepted by
9+ < a class ="Xr " href ="./rgbasm.1 "> rgbasm(1)</ a > , which does not always match
10+ one-to-one with the way instructions are
11+ < a class ="Lk " href ="encoded "> https://gbdev.io/gb-opcodes/optables/</ a > .</ p >
812< p class ="Pp "> Note: All arithmetic and logic instructions that use register
913 < b class ="Sy "> A</ b > as a destination can omit the destination, since it is
1014 assumed to be register < b class ="Sy "> A</ b > by default. So the following two
@@ -842,11 +846,11 @@ <h3 class="Ss" id="JP_HL"><a class="permalink" href="#JP_HL">JP HL</a></h3>
842846< section class ="Ss ">
843847< h3 class ="Ss " id ="JR_n16 "> < a class ="permalink " href ="#JR_n16 "> JR n16</ a > </ h3 >
844848< p class ="Pp "> Relative Jump to address < var class ="Ar "> n16</ var > .</ p >
845- < p class ="Pp "> The address is encoded as a signed 8-bit offset from the address
846- immediately following the < code class ="Ic " > JR </ code > instruction, so the
847- target address < var class ="Ar " > n16 </ var > must be between
848- < b class ="Sy "> -128</ b > and < b class ="Sy "> 127</ b > bytes away. For
849- example:</ p >
849+ < p class ="Pp "> The target address < var class =" Ar " > n16 </ var > is
850+ < i class ="Em " > encoded </ i > as a signed 8-bit offset from the address
851+ immediately following the < code class ="Ic " > JR </ code > instruction, so it must
852+ be between < b class ="Sy "> -128</ b > and < b class ="Sy "> 127</ b > bytes away. For
853+ example:</ p >
850854< div class ="Bd Pp Bd-indent Li ">
851855< pre > JR Label ; no-op; encoded offset of 0
852856Label:
@@ -861,6 +865,10 @@ <h3 class="Ss" id="JR_cc,n16"><a class="permalink" href="#JR_cc,n16">JR
861865 cc,n16</ a > </ h3 >
862866< p class ="Pp "> Relative Jump to address < var class ="Ar "> n16</ var > if condition
863867 < var class ="Ar "> cc</ var > is met.</ p >
868+ < p class ="Pp "> The target address < var class ="Ar "> n16</ var > is
869+ < i class ="Em "> encoded</ i > as a signed 8-bit offset from the address
870+ immediately following the < code class ="Ic "> JR</ code > instruction, so it must
871+ be between < b class ="Sy "> -128</ b > and < b class ="Sy "> 127</ b > bytes away.</ p >
864872< p class ="Pp "> Cycles: 3 taken / 2 untaken</ p >
865873< p class ="Pp "> Bytes: 2</ p >
866874< p class ="Pp "> Flags: None affected.</ p >
@@ -945,7 +953,10 @@ <h3 class="Ss" id="LD__n16_,A"><a class="permalink" href="#LD__n16_,A">LD
945953< h3 class ="Ss " id ="LDH__n16_,A "> < a class ="permalink " href ="#LDH__n16_,A "> LDH
946954 [n16],A</ a > </ h3 >
947955< p class ="Pp "> Copy the value in register < b class ="Sy "> A</ b > into the byte at
948- address < var class ="Ar "> n16</ var > , provided the address is between
956+ address < var class ="Ar "> n16</ var > .</ p >
957+ < p class ="Pp "> The destination address < var class ="Ar "> n16</ var > is
958+ < i class ="Em "> encoded</ i > as its 8-bit low byte and assumes a high byte of
959+ < span class ="Ad "> $FF</ span > , so it must be between
949960 < span class ="Ad "> $FF00</ span > and < span class ="Ad "> $FFFF</ span > .</ p >
950961< p class ="Pp "> Cycles: 3</ p >
951962< p class ="Pp "> Bytes: 2</ p >
@@ -984,7 +995,10 @@ <h3 class="Ss" id="LD_A,_n16_"><a class="permalink" href="#LD_A,_n16_">LD
984995< h3 class ="Ss " id ="LDH_A,_n16_ "> < a class ="permalink " href ="#LDH_A,_n16_ "> LDH
985996 A,[n16]</ a > </ h3 >
986997< p class ="Pp "> Copy the byte at address < var class ="Ar "> n16</ var > into register
987- < b class ="Sy "> A</ b > , provided the address is between
998+ < b class ="Sy "> A</ b > .</ p >
999+ < p class ="Pp "> The source address < var class ="Ar "> n16</ var > is
1000+ < i class ="Em "> encoded</ i > as its 8-bit low byte and assumes a high byte of
1001+ < span class ="Ad "> $FF</ span > , so it must be between
9881002 < span class ="Ad "> $FF00</ span > and < span class ="Ad "> $FFFF</ span > .</ p >
9891003< p class ="Pp "> Cycles: 3</ p >
9901004< p class ="Pp "> Bytes: 2</ p >
0 commit comments