Author Topic: Error messages given from using different equates (EQU and =)  (Read 2300 times)

_japheth

  • Member
  • **
  • Posts: 115
Re: Error messages given from using different equates (EQU and =)
« Reply #15 on: March 18, 2022, 05:31:37 PM »
Why do i not get a symbol redefinition error for both of them?

Because the lines are handled differently.  :bgrin:
The angle brackets tell EQU that anything that follows must not be interpreted. As for the other case, masm is intelligent enough to translate the "2" to the hex value 032h - a valid number.
« Last Edit: March 18, 2022, 09:21:02 PM by _japheth »
Dummheit, gepaart mit Dreistigkeit - eine furchtbare Macht.

StillLearningMasm

  • Regular Member
  • *
  • Posts: 40
Re: Error messages given from using different equates (EQU and =)
« Reply #16 on: March 21, 2022, 02:44:16 PM »
Thanks again _japheth

I am SLOWLY starting to have a understanding of the equates, I think

in this program fragment:
cseg segment

start:
.386

rr equ <v>
;other code
rr = 1  ; no error

;other code
cseg ends
end start

No error occurs.

But if I change it to this:

cseg segment

start:
.386

rr equ <>
;other code
rr = 1  ; syntax error

;other code
cseg ends
end start

Why do I get a syntax error?
According to the documentation for EQU with a <>:
This form can be any text in <>.  Same name can be used to redefine this form.
« Last Edit: March 21, 2022, 03:55:00 PM by StillLearningMasm »

jj2007

  • Member
  • *****
  • Posts: 13957
  • Assembly is fun ;-)
    • MasmBasic
Re: Error messages given from using different equates (EQU and =)
« Reply #17 on: March 21, 2022, 07:51:52 PM »
Code: [Select]
rr equ <>
;other code
rr equ <1>  ; no error

Accept that the documentation is not perfect, and that Masm has its quirks.

If you need changing numeric constants, use number=123
If you need non-number constants, use equ.