tada@athena.mit.edu (Michael Zehr) (05/19/88)
I need some simple examples on how to combine assembly code with high level language source. For example, suppose i want to write some C code, but tweak the machine code it produces. I have a vague idea on how to proceed (compile the C source with the /machine option, then edit the listing to make the changes, then assemble the machine code, then link everything) but i need some examples to get me started. anyone out there have experience with this? thanks in advance. -michael j zehr
WHEELER@CC.UTAH.EDU (05/19/88)
Posting-Version: unknown; site unknown Subject: merging assembly with high-level languauges Trying to assemble the listing that comes from cc/list/mach will not work. The only compiler that can produce machine language listing that can be assembled without problems is Bliss. (A truely wonderful language!) What you want to do is write you machine language routines and then call them from C. You can get a good feel for what to write by looking at the code generated from the compilers. I learned PDP assembly by looking at the output from a FORTRAN compiler. Bob Wheeler Howard Hughes Medical Institute at Salt Lake City bob%howard@cc.utah.edu
EPRF@SNYCENVM.BITNET (Peter Flass) (05/24/88)
> >I need some simple examples on how to combine assembly code with high >level language source. For example, suppose i want to write some C >code, but tweak the machine code it produces. I have a vague idea on >how to proceed (compile the C source with the /machine option, then >edit the listing to make the changes, then assemble the machine code, >then link everything) but i need some examples to get me started. > Last time I did anything like this I swore off for life! For what my two cents is worth you'd be *MUCH* better off leaving the compiled code alone and putting your 'tweaked' code into a handcoded Macro function (using the compiler output as a model if needed). Otherwise every time you make a source change you have to remember to make your Macro changes again and you're at the mercy of the compiler as to whether they'll fit. - Pete