home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sys / amiga / programm / 12848 < prev    next >
Encoding:
Internet Message Format  |  1992-08-29  |  1.6 KB

  1. Path: sparky!uunet!decwrl!contessa!mwm
  2. From: mwm@contessa.palo-alto.ca.us (Mike Meyer)
  3. Subject: Re: including 68000 code in C
  4. Newsgroups: comp.sys.amiga.programmer
  5. Distribution: world
  6. References: <1992Aug25.023906.8962@ccu.umanitoba.ca>
  7. X-NewsSoftware: Amiga Yarn 3.4, 1992/08/12 15:49:52
  8. Keywords: 
  9. Summary: 
  10. Message-ID: <mwm.1n8r@contessa.palo-alto.ca.us>
  11. Date: 26 Aug 92 11:24:15 PST
  12. Organization: Missionaria Phonibalonica
  13. Lines: 25
  14.  
  15. In <1992Aug25.023906.8962@ccu.umanitoba.ca>, umfehr06@ccu.umanitoba.ca (John Fehr) wrote:
  16. > Is there any way to simply insert 68000 code in your C programs?  Say I want to
  17. > put some in a for loop or something.
  18.  
  19. Not portably; otherwise your Amiga C compiler would have to be able to
  20. deal with 8086 assembler. However, most compilers provide some such
  21. functionality. Under SAS/C, use emit() to insert instructions. Under
  22. Manx, use #asm. Both of these cripple the optimizer for that function,
  23. and so should only be used for short functions.
  24.  
  25. I assume DICE has such functionality, as I've seen Matt use it. I
  26. don't know how it and the optimizer get along, though. GCC (at least
  27. with 2.0) should have asm hooks that let you feed the optimizer
  28. information so it isn't crippled by this process.
  29.  
  30. I'd avoid this practice if at all possible. If you're doing it for
  31. speed, encapsulate a large enough chunk into assembler that you can
  32. call it as a functioon. Be sure and check to see if your compiler
  33. supports fast calls to asm by passing args in registers, etc.
  34.  
  35. If you're doing it to do something you can't get to from C, create a
  36. function that does that, and call it. Again, check to see if your
  37. compiler supports fast calls to asm.
  38.  
  39.     <mike
  40.