Skip to main content
Visitor II
January 13, 2004
Question

Jump table in inline assembly

  • January 13, 2004
  • 2 replies
  • 855 views
Posted on January 13, 2004 at 01:57

Jump table in inline assembly

    This topic has been closed for replies.

    2 replies

    Visitor II
    January 7, 2004
    Posted on January 07, 2004 at 06:06

    How con I implement a jump table in inline assembly with Metrowerks C compiler? Following code doesn't work :

    asm{

    ...

    LD X,Nerx

    SLL X ; X <- Nerx * 2

    LD A,(TB_GRAF_RX+1,X)

    PUSH A ; MSB of return @

    LD A,(TB_GRAF_RX,X)

    PUSH A ; LSB of return @

    RET

    ; Branch to subroutine (TB_GRAF_RX + 2*Nerx)

    TB_GRAF_RX:

    DC graf_rx_0, graf_rx_1, graf_rx_2 ,graf_rx_3

    DC graf_rx_4, graf_rx_5, graf_rx_6 ,graf_rx_7

    graf_rx_0:

    ...

    graf_rx_1:

    ...

    and so on...

    VD

    Visitor II
    January 13, 2004
    Posted on January 13, 2004 at 01:57

    Hai Vdelpy,

    Could you please mention what kind of error you are getting.

    If the variables used in the inline assembly being used by your c functions in another file, then you have to declare those variables using 'xref'. I hope you are aware of these things.

    Please specify the error.

    Tx