
Conditional Assembly UM017105-0511
244
Zilog Developer Studio II – ZNEO™
User Manual
If name is specified with the .ENDWITH directive, the name must match that used for the
.WITH directive. The intent is to allow for code readability with some checking by the
assembler.
Examine the following
COMPUTE_PAY routine.
COMPUTE_PAY:
; Enter with pointer to an EMPLOYEE in R2, days in R1
; Return with pay in R0
LD.SB R0,EMPLOYEE.SALARY(R2)
MUL R0,R1
RET
The preceding routine could be written using the .WITH directive as follows:
COMPUTE_PAY:
; Enter with pointer to an EMPLOYEE in R2, days in R1
; Return with pay in R0
.WITH EMPLOYEE
LD.SB R0, SALARY(R2)
MUL R0,R1
RET
.ENDWITH EMPLOYEE
Conditional Assembly
Conditional assembly is used to control the assembly of blocks of code. Entire blocks of
code can be enabled or disabled using conditional assembly directives.
Conditional Assembly Directives
The following conditional assembly directives are allowed:
•
IF
•
IFDEF
•
IFSAME
•
IFMA
Any symbol used in a conditional directive must be previously defined by an
EQU or VAR
directive. Relational operators can be used in the expression. Relational expressions eval-
uate to 1 if true, and 0 if false.
Comentários a estes Manuais