Allow syntax cpl a

This commit is contained in:
Rangi42
2024-09-06 12:42:45 -04:00
committed by Eldred Habert
parent 610f04beeb
commit 068ad93427
4 changed files with 42 additions and 3 deletions

View File

@@ -11,16 +11,28 @@ This is the list of opcodes supported by
.Xr rgbasm 1 , .Xr rgbasm 1 ,
including a short description, the number of bytes needed to encode them and the number of CPU cycles at 1MHz (or 2MHz in GBC dual speed mode) needed to complete them. including a short description, the number of bytes needed to encode them and the number of CPU cycles at 1MHz (or 2MHz in GBC dual speed mode) needed to complete them.
.Pp .Pp
Note: All arithmetic/logic operations that use register Note: All arithmetic/logic instructions that use register
.Sy A .Sy A
as destination can omit the destination as it is assumed to be register as a destination can omit the destination, since it is assumed to be register
.Sy A .Sy A
by default. by default.
The following two lines have the same effect: So the following two lines have the same effect:
.Bd -literal -offset indent .Bd -literal -offset indent
OR A,B OR A,B
OR B OR B
.Ed .Ed
.Pp
Furthermore, the
.Sy CPL
instruction can take an optional
.Sy A
destination, since it can only be register
.Sy A .
So the following two lines have the same effect:
.Bd -literal -offset indent
CPL
CPL A
.Ed
.Sh LEGEND .Sh LEGEND
List of abbreviations used in this document. List of abbreviations used in this document.
.Bl -tag -width Ds .Bl -tag -width Ds

View File

@@ -1874,6 +1874,9 @@ z80_cpl:
Z80_CPL { Z80_CPL {
sect_ConstByte(0x2F); sect_ConstByte(0x2F);
} }
| Z80_CPL MODE_A {
sect_ConstByte(0x2F);
}
; ;
z80_daa: z80_daa:

View File

@@ -0,0 +1,21 @@
SECTION "destination optional", ROM0[0]
MACRO both
REDEF op EQUS "\1"
SHIFT
{op} \#
if _NARG
{op} a, \#
else
{op} a
endc
ENDM
both cpl
both add, b
both adc, 42
both sub, 69
both sbc, c
both and, d
both or, %1010
both xor, $80

View File

@@ -0,0 +1,3 @@
//<2F><><EFBFBD>*<2A>*<2A>E<EFBFBD>E<EFBFBD><45><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>