Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!mcvax!ukc!cheviot!robert From: robert@cheviot.newcastle.ac.uk (Robert Stroud) Newsgroups: net.lang.c Subject: Re: Compiler Specific Operators Message-ID: <889@cheviot.newcastle.ac.uk> Date: Tue, 15-Jul-86 10:22:07 EDT Article-I.D.: cheviot.889 Posted: Tue Jul 15 10:22:07 1986 Date-Received: Thu, 24-Jul-86 00:29:02 EDT References: <1825@uw-beaver> <5780@alice.uUCp> <3519@lll-crg.ARpA> Reply-To: robert@cheviot.ncl.ac.uk (Robert Stroud) Organization: Computing Laboratory, University of Newcastle upon Tyne, UK Lines: 37 In article <3519@lll-crg.ARpA> brooks@lll-crg.UUCP (Eugene D. Brooks III) writes: >It would be nice if asm was more "printf like" instead of just dumping >a string. >suppose you want to change the stack pointer... > > char *oldpointer; > char *newpointer; > > asm("store sp,%a", oldpointer); > asm("load sp,%a", newpointer); > >The code is machine dependent, but the compiler takes care of the >C name -> AS name mapping for you. Of course I guess the compiler >should not encourage such screwing around. A machine called the Orion made by a British company called High Level Hardware has something similar. It is based on a bit slice architecture and has been microcoded as a stack based C machine. Consequently, it is possible to interpret asm(opcode, expr, ...) as "push all the C expressions onto the stack and then perform opcode". This lets you mix C expressions with special-purpose opcodes (you can define your own because the microcode is user-extensible). However, the clean semantics are only possible because it is a stack machine and all operations are performed in this way. Robert Stroud, Computing Laboratory, University of Newcastle upon Tyne. ARPA robert%cheviot.newcastle@ucl-cs.ARPA UUCP ...!ukc!cheviot!robert JANET robert@newcastle.cheviot