[Compile asm] 8051

Help
Minh Tri
2012-07-20
2013-03-12
  • Minh Tri
    Minh Tri
    2012-07-20

    I can't compile file .asm in sdcc. I use Ubuntu 12.4
    This is my code.
    ORG   0000h
    Start:
       CLR   P2.0     
       CALL   Delay     
       SETB   P2.0     
       CALL   Delay     
       SJMP   Start     
    Delay:
       MOV   R1, #255
    Delay1:   Mov    R2, #255
    Delay2:   DJNZ   R2, Delay2  
       DJNZ   R1, Delay1  
       RET
    END
    This is issue sentence:
    warning 119: don't know what to do with file 'led.asm'. file extension unsupported
    SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08 2.9.0 #5416 (Feb  3 2010) (UNIX)

     
  • Maarten Brock
    Maarten Brock
    2012-07-20

    Well, SDCC is a C compiler and not an assembler. It comes with sdas8051 (or asxxxx as it was called with 2.9.0) which is the assembler used after compiling.

     
  • Minh Tri
    Minh Tri
    2012-07-21

    But the instructions are written like this:
    #define DELAY
    __asm
    nop
    nop
    __endasm
    * __asm, __end asm: I don't know what it take to line?

     
  • Maarten Brock
    Maarten Brock
    2012-07-21

    You stated that SDCC would not compile file .asm. When you specify a .asm file extension I assume that is what you were trying to give to SDCC. But SDCC only accepts .c files for compiling.

    Further, __asm / __endasm can only be used inside C functions. And __endasm usually requires a semicolon.