hi, Let assume that one .asm file contains next definitions:
PUBLIC FLAG1,FLAG2 FLAG1 EQU 00000001b FLAG2 EQU 00000010b
MOV A,#(FLAG1 OR FLAG2)
The limitation, I think, is in just how much compuational complexity you want to burden the linker with, and how bad code is allowed to become because the assembler didn't know the value of such an expression, during its pass through the code. The workaround: don't hide such published EQU in the module's source --- put them into the .inc file exporting the first file's services, as SET values.
I have nothing about this particular case, however I have, since ages, abolished extern constants. I honestly do not remember why, but it was something like what you refer to. so, today, and since whenever, all constants are in .inc or .h files. I did ask Keil support and got an answer I could accept/understand as to why but what it was is long lost. Erik
hi, because the assembler didn't know the value of such an expression, during its pass through the code Well, I see it clean, but what is about next: First file:
PUBLIC XBUF ?XD?XBUF SEGMENT XDATA RSEG ?XD?XBUF XBUF: DS 1024
EXTRN XDATA(XBUF) MOV A,#(LOW(XBUF) + 1) ; line 1 MOV A,#(LOW(XBUF) OR 1) ; line 2
Both statements in the second file contain references that are external. This means that they are resolved by the linker. The linker can resolve externals and some simple mathematical operations (typically + and -). However, more sophisticated operations are not supported by the linker (actually they are not supported by the OMF since this is how the assembler and compiler pass this information to the linker). In line 1,
MOV A,#(LOW(XBUF) + 1) ; line 1
MOV A,#(LOW(XBUF) OR 1) ; line 2
MOV A,#LOW(XBUF) ORL A,#1