Reply by Marco December 29, 20092009-12-29
On Dec 28, 10:19=A0am, Chris H <ch...@phaedsys.org> wrote:
> In message <d6b5e078-9226-4f28-9f2d-db945618a...@o28g2000yqh.googlegroup > s.com>, Marco <prenom_no...@yahoo.com> writes > > >On Dec 27, 10:23 am, Hul Tytus <h...@panix.com> wrote: > >> comp.arch.embedded > >> Assembly code with Borland's C compiler > > >> Anyone have suggestions regarding the form for assembley code files us=
ed
> >> with Borland's version C compiler? > > > What embedded target is this for? > > X86 =A0AFAIK Borland only did compilers for X86
CPU type is fairly obvious. Not what I meant. Is the OP targeting some kind of DOS like target, bare-metal (Phar Lap like target) or some kind of Win32 based target? To me it sounds like he may be trying to target something Win32 based and needs to contact the specific vendor. Most people don't mix Microsoft and Borland for DOS or bare metal targets.
Reply by Stefan Reuther December 28, 20092009-12-28
Vladimir Vassilevsky wrote:
> Chris H wrote: >> I always recommended that method. Particularly when people wanted in >> line assembly or a small amount of assembly in a C program. >> >> write an empty c function call, with all the parameters, compile to >> assembler and out the body in by hand. > > The simple and stupid way for passing parameters between C and assembler > is by global variables.
It depends. On some architectures, fetching a few values from parameter registers is a lot easier than constructing a global variable address in an address register and dereferencing that. The best way is, of course, to use GNU-style asm operand constraints. Stefan
Reply by December 28, 20092009-12-28
Thanks Chris. I'll follow your suggestion.

Hul

Chris H <chris@phaedsys.org> wrote:
> In message <xaudnWLLO9McMqrWnZ2dnUVZ_tJi4p2d@web-ster.com>, Tim Wescott > <tim@seemywebsite.com> writes > >On Sun, 27 Dec 2009 17:23:59 +0000, Hul Tytus wrote: > > > >> comp.arch.embedded > >> Assembly code with Borland's C compiler > >> > >> Anyone have suggestions regarding the form for assembley code files > >> used > >> with Borland's version C compiler? The code below, assembled by masm6, > >> doesn't satisfy the linker (Borland's). > >> The segment names are a guess for the most part - taken from masm6's > >> accrued examples on other projects. "cs:DGROUP" appears off but, if the > >> error is due to segment names, maybe someone here knows suitable names? > >> The code & bat file & error messages are included below. > >> > >-- snip -- > > > >If I'm working with a tool chain that supports compiling to assembly I > >cheat. I write a framework file in C and compile to assembly, then find > >the insides of the functions and start writing code. > > > >It may not be manly, but it works just fine.
> I always recommended that method. Particularly when people wanted in > line assembly or a small amount of assembly in a C program.
> write an empty c function call, with all the parameters, compile to > assembler and out the body in by hand.
> This sorts out all the parameter passing and you can call it with a > standard C include file. Much more efficient.
> Of course at one time all compilers went to assembly code Then you > assembled and linked. Actually even the compilers tended to be 3 pass > affairs. Now it is a single pass to object code ...
> -- > \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ > \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/ > \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Reply by Chris H December 28, 20092009-12-28
In message <hhar7v$jbt$1@news.eternal-september.org>, FreeRTOS info
<noemail@given.com> writes
>Chris H wrote: >> In message <d6b5e078-9226-4f28-9f2d-db945618abe7@o28g2000yqh.googlegroup >> s.com>, Marco <prenom_nomus@yahoo.com> writes >>> On Dec 27, 10:23 am, Hul Tytus <h...@panix.com> wrote: >>>> comp.arch.embedded >>>> Assembly code with Borland's C compiler >>>> >>>> Anyone have suggestions regarding the form for assembley code files used >>>> with Borland's version C compiler? >>> What embedded target is this for? >> >> X86 AFAIK Borland only did compilers for X86 > >I thought that until recently - but apparently they did others too. We >had a request the other day for some other CPU. Although I forget which >it was exactly I think it was an old Motorola thing, maybe 68K?
That would be Pascal. Borland did do some Pascal stuff in the beginning (this is from memory but it was decades ago) hence their Delphi was based on Pascal.
>Maybe this has already been written here as I have not read the whole >thread, but Borland C 5.5 I think is now (legitimately) free.
I believe the Borland x86 C and C++ compilers are available on free download. -- \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/ \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Reply by FreeRTOS info December 28, 20092009-12-28
Chris H wrote:
> In message <d6b5e078-9226-4f28-9f2d-db945618abe7@o28g2000yqh.googlegroup > s.com>, Marco <prenom_nomus@yahoo.com> writes >> On Dec 27, 10:23 am, Hul Tytus <h...@panix.com> wrote: >>> comp.arch.embedded >>> Assembly code with Borland's C compiler >>> >>> Anyone have suggestions regarding the form for assembley code files used >>> with Borland's version C compiler? >> What embedded target is this for? > > X86 AFAIK Borland only did compilers for X86
I thought that until recently - but apparently they did others too. We had a request the other day for some other CPU. Although I forget which it was exactly I think it was an old Motorola thing, maybe 68K? Maybe this has already been written here as I have not read the whole thread, but Borland C 5.5 I think is now (legitimately) free. Paradigm have their own version that is still updated and supported. OpenWatcom have some nice alternative solutions too (not Borland based). -- Regards, Richard. + http://www.FreeRTOS.org Designed for Microcontrollers. More than 7000 downloads per month. + http://www.SafeRTOS.com Certified by T&#4294967295;V as meeting the requirements for safety related systems.
Reply by Tim Wescott December 28, 20092009-12-28
On Mon, 28 Dec 2009 09:02:58 -0600, Vladimir Vassilevsky wrote:

> Chris H wrote: > >> In message <xaudnWLLO9McMqrWnZ2dnUVZ_tJi4p2d@web-ster.com>, Tim Wescott >> <tim@seemywebsite.com> writes >> >> >>>If I'm working with a tool chain that supports compiling to assembly I >>>cheat. I write a framework file in C and compile to assembly, then >>>find the insides of the functions and start writing code. >>> >>>It may not be manly, but it works just fine. >> >> >> I always recommended that method. Particularly when people wanted in >> line assembly or a small amount of assembly in a C program. >> >> write an empty c function call, with all the parameters, compile to >> assembler and out the body in by hand. > > The simple and stupid way for passing parameters between C and assembler > is by global variables. It is trivial, it is portable, and independent > from possible changes in the calling agreements of the future versions > of the same toolset. The aesthetes can implement some sort of locking or > roll their own stack to ensure atomic access to globals.
I don't recall having a single problem with calling agreements breaking down with toolset version. That doesn't seem to be something that changes often -- and I've always been in an environment where we bind a software version to a toolset version, and treat a toolset upgrade as major. It's certainly a dire thing when the agreement does change, though. -- www.wescottdesign.com
Reply by Chris H December 28, 20092009-12-28
In message <d6b5e078-9226-4f28-9f2d-db945618abe7@o28g2000yqh.googlegroup
s.com>, Marco <prenom_nomus@yahoo.com> writes
>On Dec 27, 10:23&#4294967295;am, Hul Tytus <h...@panix.com> wrote: >> comp.arch.embedded >> Assembly code with Borland's C compiler >> >> &#4294967295; &#4294967295;Anyone have suggestions regarding the form for assembley code files used >> with Borland's version C compiler? > > What embedded target is this for?
X86 AFAIK Borland only did compilers for X86 -- \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/ \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Reply by Marco December 28, 20092009-12-28
On Dec 27, 10:23=A0am, Hul Tytus <h...@panix.com> wrote:
> comp.arch.embedded > Assembly code with Borland's C compiler > > =A0 =A0Anyone have suggestions regarding the form for assembley code file=
s used
> with Borland's version C compiler?
What embedded target is this for?
Reply by Vladimir Vassilevsky December 28, 20092009-12-28

Chris H wrote:

> In message <xaudnWLLO9McMqrWnZ2dnUVZ_tJi4p2d@web-ster.com>, Tim Wescott > <tim@seemywebsite.com> writes >
>>If I'm working with a tool chain that supports compiling to assembly I >>cheat. I write a framework file in C and compile to assembly, then find >>the insides of the functions and start writing code. >> >>It may not be manly, but it works just fine. > > > I always recommended that method. Particularly when people wanted in > line assembly or a small amount of assembly in a C program. > > write an empty c function call, with all the parameters, compile to > assembler and out the body in by hand.
The simple and stupid way for passing parameters between C and assembler is by global variables. It is trivial, it is portable, and independent from possible changes in the calling agreements of the future versions of the same toolset. The aesthetes can implement some sort of locking or roll their own stack to ensure atomic access to globals. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
Reply by Chris H December 28, 20092009-12-28
In message <xaudnWLLO9McMqrWnZ2dnUVZ_tJi4p2d@web-ster.com>, Tim Wescott
<tim@seemywebsite.com> writes
>On Sun, 27 Dec 2009 17:23:59 +0000, Hul Tytus wrote: > >> comp.arch.embedded >> Assembly code with Borland's C compiler >> >> Anyone have suggestions regarding the form for assembley code files >> used >> with Borland's version C compiler? The code below, assembled by masm6, >> doesn't satisfy the linker (Borland's). >> The segment names are a guess for the most part - taken from masm6's >> accrued examples on other projects. "cs:DGROUP" appears off but, if the >> error is due to segment names, maybe someone here knows suitable names? >> The code & bat file & error messages are included below. >> >-- snip -- > >If I'm working with a tool chain that supports compiling to assembly I >cheat. I write a framework file in C and compile to assembly, then find >the insides of the functions and start writing code. > >It may not be manly, but it works just fine.
I always recommended that method. Particularly when people wanted in line assembly or a small amount of assembly in a C program. write an empty c function call, with all the parameters, compile to assembler and out the body in by hand. This sorts out all the parameter passing and you can call it with a standard C include file. Much more efficient. Of course at one time all compilers went to assembly code Then you assembled and linked. Actually even the compilers tended to be 3 pass affairs. Now it is a single pass to object code ... -- \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/ \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/