code segment:
... EXTRN NUMBER (MAX_NUM) DS MAX_NUM END
another code segment:
PUBLIC MAX_NUM MAX_NUM EQU 8
when i assembled and linked these codes, there was an error:
Build target 'test' assembling test.asm... test.asm(13): error A28: ABSOLUTE EXPRESSION REQUIRED Target not created
How did it hanppen?
I can't understand you,aren't both PUBLIC and EXTRN work in assembly time?
They work in assembly, but for runtime variables - variables that gets a memory address. The linker must be able to know how to get a reference from one source code module to be able to use a variable that exists in another module.
But this is separate from assembly-time numeric constants used by the assembler. EQU does not produce a runtime variable. There will be no memory allocated in the RAM of the microcontroller for an EQU symbol. And since it is an assembly time constant without a memory address, there will be no need/use for any EXTRN/PUBLIC to inform the linker about the constant. Without a memory address to share between multiple source modules, the linker don't need to know.
But all this is introductory stuff, and as I have already mentioned, the same concept exists for C also. Get a good introductory book about assembly programming.