diff --git a/man/gbz80.7 b/man/gbz80.7 index 139f365a4..a51f1acfd 100644 --- a/man/gbz80.7 +++ b/man/gbz80.7 @@ -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 diff --git a/src/asm/lexer.cpp b/src/asm/lexer.cpp index 9574622d9..161b4b6a5 100644 --- a/src/asm/lexer.cpp +++ b/src/asm/lexer.cpp @@ -329,6 +329,8 @@ static std::unordered_map ke {"OPT", T_(POP_OPT) }, }; +static auto ldio = keywordDict.find("LDIO"); + static bool isWhitespace(int c) { return c == ' ' || c == '\t'; } @@ -1168,8 +1170,12 @@ 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 diff --git a/src/asm/parser.y b/src/asm/parser.y index 40c50a198..f4aae733b 100644 --- a/src/asm/parser.y +++ b/src/asm/parser.y @@ -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(); diff --git a/test/asm/deprecated-ldio.asm b/test/asm/deprecated-ldio.asm new file mode 100644 index 000000000..4c381e4b4 --- /dev/null +++ b/test/asm/deprecated-ldio.asm @@ -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] diff --git a/test/asm/deprecated-ldio.err b/test/asm/deprecated-ldio.err new file mode 100644 index 000000000..b6c038321 --- /dev/null +++ b/test/asm/deprecated-ldio.err @@ -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 diff --git a/test/asm/deprecated-ldio.out.bin b/test/asm/deprecated-ldio.out.bin new file mode 100644 index 000000000..12fc9a906 --- /dev/null +++ b/test/asm/deprecated-ldio.out.bin @@ -0,0 +1 @@ +âòàðâòêÿúÿâòàðâòàðâòêÿúÿâòàð \ No newline at end of file