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?
Why?
Didn't you read the answers you got?
"Look in the assembler manual what EQU means - it declares an assembly-time constant, not a run-time variable. The linker on the other hand processes run-time variables."
PUBLIC and EXTRN are used for link-time symbols, not for assembly-time symbols. But your MAX_NUM is not a program variable that will be stored in any memory cell, and so will not be assigned any address by the linker.
This is the same as programming in C:
#define MAX_NUM 8
or
enum { MAX_NUM 8 };
as compared to:
int MAX_NUM = 8;
Only the "int MAX_NUM" alternative will be a link-time symbol, where generated code reads from the memory to pick up the value.