diff --git a/man/rgbasm.5 b/man/rgbasm.5 index 80722ca9..89f09faf 100644 --- a/man/rgbasm.5 +++ b/man/rgbasm.5 @@ -1216,40 +1216,6 @@ See the command-line option in .Xr rgbasm 1 . The same problem can occur if the expansion of a macro invokes another macro, recursively. -.Pp -The examples above for -.Ql EQU , -.Ql = , -.Ql RB , -.Ql RW , -.Ql RL , -and -.Ql EQUS -all start with -.Ql DEF . -(A variable definition may start with -.Ql REDEF -instead, since they are redefinable.) -You may use the older syntax without -.Ql DEF , -but then the name being defined -.Em must not -have any whitespace before it; -otherwise -.Nm -will treat it as a macro invocation. -Furthermore, without the -.Ql DEF -keyword, -string constants may be expanded for the name. -This can lead to surprising results: -.Bd -literal -offset indent -X EQUS "Y" -; this defines Y, not X! -X EQU 42 -; prints "Y $2A" -PRINTLN "{X} {Y}" -.Ed .Ss Macros One of the best features of an assembler is the ability to write macros for it. Macros can be called with arguments, and can react depending on input using diff --git a/src/asm/parser.y b/src/asm/parser.y index 7f17bd6d..5788ef4b 100644 --- a/src/asm/parser.y +++ b/src/asm/parser.y @@ -429,7 +429,6 @@ plain_directive: | label cpu_commands | label macro | label directive - | assignment_directive ; endc: @@ -522,9 +521,6 @@ macro_args: } ; -// These commands start with a LABEL. -assignment_directive: equ | assignment | rb | rw | rl | equs; - directive: endc | print @@ -604,105 +600,6 @@ compound_eq: } ; -equ: - LABEL POP_EQU const { - warning( - WARNING_OBSOLETE, - "`%s EQU` is deprecated; use `DEF %s EQU`\n", - $1.c_str(), - $1.c_str() - ); - sym_AddEqu($1, $3); - } -; - -assignment: - LABEL POP_EQUAL const { - warning(WARNING_OBSOLETE, "`%s =` is deprecated; use `DEF %s =`\n", $1.c_str(), $1.c_str()); - sym_AddVar($1, $3); - } - | LABEL compound_eq const { - char const *compoundEqOperator = nullptr; - switch ($2) { - case RPN_ADD: compoundEqOperator = "+="; break; - case RPN_SUB: compoundEqOperator = "-="; break; - case RPN_MUL: compoundEqOperator = "*="; break; - case RPN_DIV: compoundEqOperator = "/="; break; - case RPN_MOD: compoundEqOperator = "%="; break; - case RPN_XOR: compoundEqOperator = "^="; break; - case RPN_OR: compoundEqOperator = "|="; break; - case RPN_AND: compoundEqOperator = "&="; break; - case RPN_SHL: compoundEqOperator = "<<="; break; - case RPN_SHR: compoundEqOperator = ">>="; break; - default: break; - } - - warning( - WARNING_OBSOLETE, - "`%s %s` is deprecated; use `DEF %s %s`\n", - $1.c_str(), - compoundEqOperator, - $1.c_str(), - compoundEqOperator - ); - compoundAssignment($1, $2, $3); - } -; - -equs: - LABEL POP_EQUS string { - warning( - WARNING_OBSOLETE, - "`%s EQUS` is deprecated; use `DEF %s EQUS`\n", - $1.c_str(), - $1.c_str() - ); - sym_AddString($1, std::make_shared($3)); - } -; - -rb: - LABEL POP_RB rs_uconst { - warning( - WARNING_OBSOLETE, - "`%s RB` is deprecated; use `DEF %s RB`\n", - $1.c_str(), - $1.c_str() - ); - uint32_t rs = sym_GetRSValue(); - sym_AddEqu($1, rs); - sym_SetRSValue(rs + $3); - } -; - -rw: - LABEL POP_RW rs_uconst { - warning( - WARNING_OBSOLETE, - "`%s RW` is deprecated; use `DEF %s RW`\n", - $1.c_str(), - $1.c_str() - ); - uint32_t rs = sym_GetRSValue(); - sym_AddEqu($1, rs); - sym_SetRSValue(rs + 2 * $3); - } -; - -rl: - LABEL Z80_RL rs_uconst { - warning( - WARNING_OBSOLETE, - "`%s RL` is deprecated; use `DEF %s RL`\n", - $1.c_str(), - $1.c_str() - ); - uint32_t rs = sym_GetRSValue(); - sym_AddEqu($1, rs); - sym_SetRSValue(rs + 4 * $3); - } -; - align: OP_ALIGN align_spec { sect_AlignPC($2.alignment, $2.alignOfs); diff --git a/test/asm/compound-assignment.asm b/test/asm/compound-assignment.asm index 279abc17..5255ef55 100644 --- a/test/asm/compound-assignment.asm +++ b/test/asm/compound-assignment.asm @@ -26,7 +26,6 @@ println \2 ; 10 purge prefix endm - try "", p try "def ", q try "redef ", r diff --git a/test/asm/compound-assignment.err b/test/asm/compound-assignment.err index 77b0e300..1d7fc2c9 100644 --- a/test/asm/compound-assignment.err +++ b/test/asm/compound-assignment.err @@ -1,25 +1,3 @@ -warning: compound-assignment.asm(29) -> compound-assignment.asm::try(4): [-Wobsolete] - `p =` is deprecated; use `DEF p =` -warning: compound-assignment.asm(29) -> compound-assignment.asm::try(6): [-Wobsolete] - `p +=` is deprecated; use `DEF p +=` -warning: compound-assignment.asm(29) -> compound-assignment.asm::try(8): [-Wobsolete] - `p -=` is deprecated; use `DEF p -=` -warning: compound-assignment.asm(29) -> compound-assignment.asm::try(10): [-Wobsolete] - `p *=` is deprecated; use `DEF p *=` -warning: compound-assignment.asm(29) -> compound-assignment.asm::try(12): [-Wobsolete] - `p /=` is deprecated; use `DEF p /=` -warning: compound-assignment.asm(29) -> compound-assignment.asm::try(14): [-Wobsolete] - `p %=` is deprecated; use `DEF p %=` -warning: compound-assignment.asm(29) -> compound-assignment.asm::try(16): [-Wobsolete] - `p |=` is deprecated; use `DEF p |=` -warning: compound-assignment.asm(29) -> compound-assignment.asm::try(18): [-Wobsolete] - `p ^=` is deprecated; use `DEF p ^=` -warning: compound-assignment.asm(29) -> compound-assignment.asm::try(20): [-Wobsolete] - `p &=` is deprecated; use `DEF p &=` -warning: compound-assignment.asm(29) -> compound-assignment.asm::try(22): [-Wobsolete] - `p <<=` is deprecated; use `DEF p <<=` -warning: compound-assignment.asm(29) -> compound-assignment.asm::try(24): [-Wobsolete] - `p >>=` is deprecated; use `DEF p >>=` -error: compound-assignment.asm(36): +error: compound-assignment.asm(35): Expected constant expression: 'UnDeFiNeD' is not constant at assembly time error: Assembly aborted (1 error)! diff --git a/test/asm/compound-assignment.out b/test/asm/compound-assignment.out index 621566b7..c9d3f97c 100644 --- a/test/asm/compound-assignment.out +++ b/test/asm/compound-assignment.out @@ -1,15 +1,3 @@ -p: -$A -$F -$E -$1C -$7 -$1 -$B -$7 -$5 -$14 -$A def q: $A $F diff --git a/test/asm/def.asm b/test/asm/def.asm index 21b8d8c9..580fbda8 100644 --- a/test/asm/def.asm +++ b/test/asm/def.asm @@ -28,22 +28,3 @@ redef string equs "there" redef constant equ 6*9 println constant - -old_constant EQU 42 -old_string EQUS "hello" - -old_variable = 2 + 2 -old_variable += 3 -old_variable *= 4 -old_variable -= 1 -old_variable /= 5 -old_variable %= 7 -old_variable &= $ffff -old_variable |= %1010 -old_variable ^= &123 -old_variable <<= 2 -old_variable >>= 1 - -old_byte rb -old_word rw -old_long rl diff --git a/test/asm/def.err b/test/asm/def.err index afdfa613..e2e1e978 100644 --- a/test/asm/def.err +++ b/test/asm/def.err @@ -1,35 +1,3 @@ error: def.asm(23): 'constant' already defined at def.asm(10) -warning: def.asm(32): [-Wobsolete] - `old_constant EQU` is deprecated; use `DEF old_constant EQU` -warning: def.asm(33): [-Wobsolete] - `old_string EQUS` is deprecated; use `DEF old_string EQUS` -warning: def.asm(35): [-Wobsolete] - `old_variable =` is deprecated; use `DEF old_variable =` -warning: def.asm(36): [-Wobsolete] - `old_variable +=` is deprecated; use `DEF old_variable +=` -warning: def.asm(37): [-Wobsolete] - `old_variable *=` is deprecated; use `DEF old_variable *=` -warning: def.asm(38): [-Wobsolete] - `old_variable -=` is deprecated; use `DEF old_variable -=` -warning: def.asm(39): [-Wobsolete] - `old_variable /=` is deprecated; use `DEF old_variable /=` -warning: def.asm(40): [-Wobsolete] - `old_variable %=` is deprecated; use `DEF old_variable %=` -warning: def.asm(41): [-Wobsolete] - `old_variable &=` is deprecated; use `DEF old_variable &=` -warning: def.asm(42): [-Wobsolete] - `old_variable |=` is deprecated; use `DEF old_variable |=` -warning: def.asm(43): [-Wobsolete] - `old_variable ^=` is deprecated; use `DEF old_variable ^=` -warning: def.asm(44): [-Wobsolete] - `old_variable <<=` is deprecated; use `DEF old_variable <<=` -warning: def.asm(45): [-Wobsolete] - `old_variable >>=` is deprecated; use `DEF old_variable >>=` -warning: def.asm(47): [-Wobsolete] - `old_byte RB` is deprecated; use `DEF old_byte RB` -warning: def.asm(48): [-Wobsolete] - `old_word RW` is deprecated; use `DEF old_word RW` -warning: def.asm(49): [-Wobsolete] - `old_long RL` is deprecated; use `DEF old_long RL` error: Assembly aborted (1 error)! diff --git a/test/asm/equs-nest.asm b/test/asm/equs-nest.asm index 8af6da31..eebb73da 100644 --- a/test/asm/equs-nest.asm +++ b/test/asm/equs-nest.asm @@ -1,5 +1,3 @@ -; the nested EQUS can't use DEF because Y1 would not be expanded -def X1 equs "Y1 equs \"\\\"Success!\\\\n\\\"\"" -def Y1 equs "Z1" -X1 - PRINT Z1 +def X equs "redef X equs \"\\\"Success!\\\\n\\\"\"" +X + print X diff --git a/test/asm/equs-nest.err b/test/asm/equs-nest.err deleted file mode 100644 index 98200fcd..00000000 --- a/test/asm/equs-nest.err +++ /dev/null @@ -1,3 +0,0 @@ -warning: equs-nest.asm(4): [-Wobsolete] - `Z1 EQUS` is deprecated; use `DEF Z1 EQUS` -while expanding symbol "X1" diff --git a/test/asm/label-macro-arg.asm b/test/asm/label-macro-arg.asm index 42db8a68..7cd5acdd 100644 --- a/test/asm/label-macro-arg.asm +++ b/test/asm/label-macro-arg.asm @@ -1,12 +1,12 @@ MACRO m1 -def x\1 + def x\1 ENDM DEF S EQUS "y" DEF S2 EQUS "yy" MACRO m2 -S\1 ; can't use DEF, so this will EQUS expand + def {S}\1 ENDM m1 = 5 @@ -17,7 +17,7 @@ ENDM println x println y println xx - println yy + println y2 MACRO test_char diff --git a/test/asm/label-macro-arg.err b/test/asm/label-macro-arg.err index 2ef5822a..c2843b93 100644 --- a/test/asm/label-macro-arg.err +++ b/test/asm/label-macro-arg.err @@ -1,7 +1,3 @@ -warning: label-macro-arg.asm(13) -> label-macro-arg.asm::m2(9): [-Wobsolete] - `y =` is deprecated; use `DEF y =` -warning: label-macro-arg.asm(15) -> label-macro-arg.asm::m2(9): [-Wobsolete] - `yy =` is deprecated; use `DEF yy =` error: label-macro-arg.asm(38) -> label-macro-arg.asm::test_char(25): syntax error, unexpected local identifier, expecting identifier while expanding symbol "VAR_DEF" diff --git a/test/asm/syntax-error-after-syntax-error.err b/test/asm/syntax-error-after-syntax-error.err index d7865a38..1712c3ee 100644 --- a/test/asm/syntax-error-after-syntax-error.err +++ b/test/asm/syntax-error-after-syntax-error.err @@ -1,10 +1,10 @@ error: syntax-error-after-syntax-error.asm(6): - syntax error, unexpected newline + syntax error, unexpected newline, expecting : or :: error: syntax-error-after-syntax-error.asm(7): - syntax error, unexpected newline + syntax error, unexpected newline, expecting : or :: To invoke `mac` as a macro it must be indented error: syntax-error-after-syntax-error.asm(8): - syntax error, unexpected number + syntax error, unexpected number, expecting : or :: To invoke `mac` as a macro it must be indented error: syntax-error-after-syntax-error.asm(9): 'mac' already defined at syntax-error-after-syntax-error.asm(1)