🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.transputer
2 messages
2 total messages Started by Jie cheng Jiang Wed, 22 Nov 1989 04:20
Assembly Escape in Logical C
#410
Author: Jie cheng Jiang
Date: Wed, 22 Nov 1989 04:20
27 lines
1633 bytes
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
--------------------------------------------------------------------------------
Re: Assembly Escape in Logical C
#411
Author: Kirk Bailey
Date: Wed, 22 Nov 1989 06:30
15 lines
1175 bytes
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads