III.7 Segment Type
Every assembly time expression is assigned a segment type, depending on its operands and operators. The segment type indicates the address space, the expression result might belong to, if it were used as an address. There are six possible segment types:
CODE DATA IDATA XDATA BIT NUMBER (typeless)
Most expression results have the segment type NUMBER. That means they are assumed to be typeless. However, in some cases it may be useful to assign a particular segment type! The following six rules apply when the segment type is evaluated:
The following symbols have been defined in a program:OFFSET EQU 16 START CODE 30H DOIT CODE 0100H REDLED BIT P1.3 VARIAB4 DATA 20H PORT DATA 0C8H RELAY EQU 5
The segment type is checked, when expressions appear as addresses. If the
expression result is not typeless and does not have the segment type of the
corresponding segment, the instruction is flagged with an error message.
Line I Addr Code Source 1: N 30 DSEG AT 030H ;internal RAM 2: 30 N 01 COUNT: DS 1 ;counter variable 3: 4: CSEG ;ROM 5: 0000 C2 30 START: CLR COUNT ^ @@@@@ segment type mismatch @@@@@
The CLR instruction is flagged with the error message "segment type mismatch" in the assembler list file, because only a BIT type address is allowed here. However, COUNT is a label with the segment type DATA!