This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

how .if compiler directive works in HET programming code

Currently I am using HET 1.7 assembler. As per the Assembler user guide -SPNU490 , I am trying to use compiler directive ".if" for certain line only if condition met. Here is the example, I am continuously getting .if syntax error, so would anyone help me understanding this ?

Here is my code snippet :

Test   .equ   1

Instruction1:  CNT  {reg=A, irq=OFF, max=10, data=0}    

.if Test

Instruction 2: BR {next=START, cond_addr=START, event=NOCOND}

.endif 

  • Can you pls try using the .if/.endif directive with a Tab space in front.

    Test   .equ   0

    Instruction1:  CNT  {reg=A, irq=OFF, max=10, data=0}   

                    .if Test

    Instruction2: BR {next=Instruction1, cond_addr=Instruction1, event=NOCOND}

                    .endif

  • Thanks for answer.

    Now I don't see any error, but in above example for Test = 1 or Test =0 for both cases, it does execute instruction 2.

    I did try " .if (test ==1) " or greater condition for Test=1 or Test=0 condition, but turns out all time, it assemble all line of code.

    would you help me how do I make this working such a way that it assemble instruction if condition true.

  • I can see the .if directive working fine generating only the first HET instruction or both the instruction's based on Test.

    Attaching the code as well as the corresponding files that got generated for your reference.

    Case:1

    Test   .equ   0

    Instruction1:  CNT  {reg=A, irq=OFF, max=10, data=0}  

                     .if Test

    Instruction2: BR {next=Instruction1, cond_addr=Instruction1, event=NOCOND}

                     .endif

    Output

      .sect ".HETCODE"

                    .word 0x00002C20

                    .word 0x0000000A

                    .word 0x00000000

                    .word 0x00000000

    Case:2 

    Test   .equ   1

    Instruction1:  CNT  {reg=A, irq=OFF, max=10, data=0}  

                     .if Test

    Instruction2: BR {next=Instruction1, cond_addr=Instruction1, event=NOCOND}

                     .endif

    Output

      .sect ".HETCODE"

                    .word 0x00002C20

                    .word 0x0000000A

                    .word 0x00000000

                    .word 0x00000000

                    .word 0x00001A00

                    .word 0x00000000

                    .word 0x00000000

                    .word 0x00000000

  • Thanks for your support. I got it working.