jiang@cs.ubc.ca (Jie cheng Jiang) (11/22/89)
I have implemented a clock synchronization algorithm on the transputer network in Logical C. To set the timer, I need to insert two transputer instructions in my C code: #pragma asm ldl time sttimer #pragma endasm where "time" is the C variable which contains the desired value of the clock. However, the tcx compiler will not compile "time" to its address as in the C code, and thus tasm will not be able to recognize it. The way I get round this problem is really a big hack. I go pp and tcx, and then I edit the .tal file and change "time" in the above instruction to its address manually before I assemble and link to get the executable. I would like to know if there is a more elegant way to do that in Logical C as what can be done by the Occam compiler. Jie -------------------------------------------------------------------------------- Jie C. Jiang (Mr.) | E-mail: Department of Computer Science | <jiang@cs.ubc.ca>(Internet) University of British Columbia | <ubc-vision!grads.cs.ubc.ca!jiang.uucp>(UUCP) Vancouver, B.C. V6T 1W5 | Tel: Canada | (604)224-5699 --------------------------------------------------------------------------------
bailey@jacobs.CS.ORST.EDU (Kirk Bailey) (11/22/89)
RE: Accessing 'C' variables from assembly: The approach suggested is unnecessary, you can use the '[' ']' notation (see the TCX users manual), to "symbolically" get access to the local stackframe offset of a local variable or parameter in all versions of Logical Systems "C" from 88.4 on. For a "global" variable, just listing the name (as in the example), will work. Although the bracket notation may always be replaced by a programmer computed offset (counting up the local variables, etc.), its use is STRONGLY encouraged since newer versions of TCX include some optimizations which make programmer determination difficult (and version dependent). Kirk Bailey Logical Systems