cancel
Showing results for 
Search instead for 
Did you mean: 

Jump table in inline assembly

Posted on January 13, 2004 at 01:57

Jump table in inline assembly

2 REPLIES 2
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

kr
Associate II
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