I am trying to learn to call some C floating point routines from Assembly. I am quite proficient in writing Assembly programs which | have done commercially for many years. I have read the <http://www.keil.com/support/docs/697.htm> page but can make no sense of it Basically where is what to be done? For example what does "You can then use the src file as a template to...." And "....you must also include the EXTRN directive for the function, eg: EXTRN CODE (_foo)" I include it where? Will the final project be an assembly project or a C project? I have written my own Assy routines for +-x/ in Floating point but now need some Sin/Cos/log functions. Hence the need for C. Which I hate. I found that it is not possible to use the #pragma src is directed and I have to assemble the file twice. Can some kind person please help by, say, pointing to some page where I can begin to understand Keil C language conventions. The Keil Documents do not give a place where I can find the start of a thread to unravel. Every explanation points to another explanation in another place. I do know C/C++ but not segment controls much. Thanks for the help
I wonder if he really needs it anyhow...?
As the OP said in his opening gambit:
I am trying to learn to call some C floating point routines from Assembly.
There is a difference between trying to learn and needing. In achieving his goal he may well learn plenty of other aspects useful to future projects.
Hi fellas! Thanks for all your comments and very helpful suggestions.
Like my usual hasty self. Perhaps I did not explain too well. The Situation: I am self taught; Therefore there are holes (gaping voids in fact) in my understanding of programming. I can and do professionally write embedded programs for industry. (I make/sell machines from gas fired conversions for diesel generaors to environment monitoring/logging for GMP) All I ever learned was to use some basic assembly rules. My assy programs (all) have one core *.asm file where I start from the reset jump to a central sections. I include my self-written *.inc libraries. (I have these by the scores) the only assembler directive I have ever used are ( examples)
$include (TRIAXDEF.inc) org 0 rx_buf_head data 12 ; This is how I allocate space for program varialbels ljmp start in_progress: db 'Cutting in Progress ',22h all_clear: mov @r0,#0 (a label) END And a few more
That about all I know about how to use assy. I never used segmentation or any advanced control. I have witten extensive libraries of routines (assy) as *.inc files which I add to the programs I write to call my functions. All variables are in fixed locations except I define more than one variable at the same location if they are needed elsewhere/elsewhen later.
When I started to get problems with handling very large or small numbers, and particularly division, I tried to use C routines . but I found that I did not understand the C conventions and I have no patience for learning. So I decided to write my own Floating point software. The four basic functions are easy to do ascii to float and vice-versa a bit more tedious.
However soon I ran into log, trig and xendental functions and had to search through the Taylor/Mclaurin expansion based methods. Too much work required. (By the way I did write some of the higher functions using the Folder routines but for use with programmable hardware, (VHDL, not u controllers) But I don't get that sort of work often). That is when I decided to go back and learn some C (by this I mean the controls/directives etc. I can make C code no prob).
I find the readable material at Keil to be rather useless. I think the writers assume that the reader already knows everything about Keil C. What then the purpose? I guess I need a proper tutorial for Keil C. I don't/shouldn't expect you guys to teach me C on the forum. All I hope is to find a tutorial written in a curt and precise manner to read through. I assure you I possess normal intelligence and don't need "C for dummies" type of guides. My problem is with declarations, acesssibility/scope, linkages etc and the control directives.etc etc. I understand the MCS 51 hardware like the back of my hand.
All I hope for is your help, to find the right tutorial. I, once long ago, when learning C bought a book which after page 30 was still discussing, in a puerile fashion, the Printf() command. I had to throw it away at page 31. I am 66 and have no time for the too basic. I need something curt, but COMPLETE, written in a linear fashion, not circuitous.
Please help
Thanks Guys.
Why nitpick on words? need? want? They are used interchangeably in conversation bro.
Why?
No - they assume that you are profficient in 'C' in general and, therefore, focus only on the specific details of the Keil implementation.
Compiler manuals are never intended to teach you 'C' - their purpose is to explain the specific implementation details.
Just as you wouldn't expect the handbook for a car to teach you to drive!
"All I hope for is your help, to find the right tutorial"
My suggestions here: blog.antronics.co.uk/.../
"I am 66 and have no time for the too basic"
But you need to lay solid foundations before you can start start building - if you skimp on the basics, you will come unstuck later...