Deprecate LDIO (#1567)

* Deprecate `LDIO`

* `ld [$ff00+n8], a` is not treated as `ldh [n8], a`
This commit is contained in:
Sylvie
2024-12-05 12:49:13 -05:00
committed by GitHub
parent ceb43c7aa4
commit 573e044b30
6 changed files with 57 additions and 17 deletions

View File

@@ -1008,11 +1008,6 @@ Cycles: 3
Bytes: 2
.Pp
Flags: None affected.
.Pp
This is sometimes written as
.Ql LDIO [n16],A ,
or
.Ql LD [$FF00+n8],A .
.Ss LDH [C],A
Copy the value in register
.Sy A
@@ -1026,8 +1021,6 @@ Bytes: 1
Flags: None affected.
.Pp
This is sometimes written as
.Ql LDIO [C],A ,
or
.Ql LD [$FF00+C],A .
.Ss LD A,[r16]
Copy the byte pointed to by
@@ -1066,11 +1059,6 @@ Cycles: 3
Bytes: 2
.Pp
Flags: None affected.
.Pp
This is sometimes written as
.Ql LDIO A,[n16] ,
or
.Ql LD A,[$FF00+n8] .
.Ss LDH A,[C]
Copy the byte at address
.Ad $FF00+c
@@ -1084,8 +1072,6 @@ Bytes: 1
Flags: None affected.
.Pp
This is sometimes written as
.Ql LDIO A,[C] ,
or
.Ql LD A,[$FF00+C] .
.Ss LD [HLI],A
Copy the value in register

View File

@@ -329,6 +329,8 @@ static std::unordered_map<std::string, int, CaseInsensitive, CaseInsensitive> ke
{"OPT", T_(POP_OPT) },
};
static auto ldio = keywordDict.find("LDIO");
static bool isWhitespace(int c) {
return c == ' ' || c == '\t';
}
@@ -1168,9 +1170,13 @@ static Token readIdentifier(char firstChar, bool raw) {
// Attempt to check for a keyword if the identifier is not raw
if (!raw) {
if (auto search = keywordDict.find(identifier); search != keywordDict.end())
if (auto search = keywordDict.find(identifier); search != keywordDict.end()) {
if (search == ldio) {
warning(WARNING_OBSOLETE, "LDIO is deprecated; use LDH\n");
}
return Token(search->second);
}
}
// Label scopes `.` and `..` are the only nonlocal identifiers that start with a dot
if (identifier.find_first_not_of('.') == identifier.npos)

View File

@@ -1752,8 +1752,8 @@ cpu_command:
| z80_jr
| z80_ld
| z80_ldd
| z80_ldh
| z80_ldi
| z80_ldio
| z80_nop
| z80_or
| z80_pop
@@ -1947,7 +1947,7 @@ z80_ldd:
}
;
z80_ldio:
z80_ldh:
Z80_LDH MODE_A COMMA op_mem_ind {
$4.makeCheckHRAM();

View File

@@ -0,0 +1,31 @@
SECTION "LDIO", ROM0
ldh [c], a
ldh a, [c]
ldh [$11], a
ldh a, [$11]
ld [$ff00+c], a
ld a, [$ff00+c]
ld [$ff11], a
ld a, [$ff11]
ldio [c], a
ldio a, [c]
ldio [$ff11], a
ldio a, [$ff11]
LDH [C], A
LDH A, [C]
LDH [$11], A
LDH A, [$11]
LD [$FF00+C], A
LD A, [$FF00+C]
LD [$FF11], A
LD A, [$FF11]
LDIO [C], A
LDIO A, [C]
LDIO [$FF11], A
LDIO A, [$FF11]

View File

@@ -0,0 +1,16 @@
warning: deprecated-ldio.asm(13): [-Wobsolete]
LDIO is deprecated; use LDH
warning: deprecated-ldio.asm(14): [-Wobsolete]
LDIO is deprecated; use LDH
warning: deprecated-ldio.asm(15): [-Wobsolete]
LDIO is deprecated; use LDH
warning: deprecated-ldio.asm(16): [-Wobsolete]
LDIO is deprecated; use LDH
warning: deprecated-ldio.asm(28): [-Wobsolete]
LDIO is deprecated; use LDH
warning: deprecated-ldio.asm(29): [-Wobsolete]
LDIO is deprecated; use LDH
warning: deprecated-ldio.asm(30): [-Wobsolete]
LDIO is deprecated; use LDH
warning: deprecated-ldio.asm(31): [-Wobsolete]
LDIO is deprecated; use LDH

View File

@@ -0,0 +1 @@
<EFBFBD><EFBFBD><EFBFBD><11><11><><EFBFBD><11><><11><><EFBFBD><EFBFBD><11><11><><EFBFBD><11><11><><EFBFBD><11><><11><><EFBFBD><EFBFBD><11>