From: Tim Wescott on
On Mon, 28 Dec 2009 09:02:58 -0600, Vladimir Vassilevsky wrote:

> Chris H wrote:
>
>> In message <xaudnWLLO9McMqrWnZ2dnUVZ_tJi4p2d(a)web-ster.com>, Tim Wescott
>> <tim(a)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
From: FreeRTOS info on
Chris H wrote:
> In message <d6b5e078-9226-4f28-9f2d-db945618abe7(a)o28g2000yqh.googlegroup
> s.com>, Marco <prenom_nomus(a)yahoo.com> writes
>> On Dec 27, 10:23 am, Hul Tytus <h...(a)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�V as meeting the requirements for safety related systems.

From: Jim Stewart on
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).

You might want to dig around on our download page..

http://www.jkmicro.com/downloads/downloads.html

I know that FC.ZIP

http://www.jkmicro.com/downloads/zip/fc.zip

implements an interrupt-driven frequency counter
in asm along with a Borland host environment.
From: Chris H on
In message <hhar7v$jbt$1(a)news.eternal-september.org>, FreeRTOS info
<noemail(a)given.com> writes
>Chris H wrote:
>> In message <d6b5e078-9226-4f28-9f2d-db945618abe7(a)o28g2000yqh.googlegroup
>> s.com>, Marco <prenom_nomus(a)yahoo.com> writes
>>> On Dec 27, 10:23 am, Hul Tytus <h...(a)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 /\/\/\/\/
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/



From: dbr on
Thanks Chris. I'll follow your suggestion.

Hul

Chris H <chris(a)phaedsys.org> wrote:
> In message <xaudnWLLO9McMqrWnZ2dnUVZ_tJi4p2d(a)web-ster.com>, Tim Wescott
> <tim(a)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 /\/\/\/\/
> \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/