Jan, > - in assembler functions, either inline or externally linked, the assumption > is, that no register may be trashed. Correct?
This is correct for naked functions or inline assembly inside non-naked C functions with surrounding C statements. If however you write a function completely in assembly and start its name with an underscore, you can make a C prototype (without the underscore) for it and call it. The caller will save the registers around the call (unless you use --callee-saves). Also if you use inline assembly inside a non-naked C function without any C statements I doubt any register will be used. Best check the generated asm though. > - on the other hand, DPTR, ACC, B may be freely thrashed (provided the > return type is void). Correct? Yes, these are at your disposal. > - therefore, for a register intensive application, I'd like to swap register > banks as a least processing-expensive solution. My assumption is, that in > the declaration, I'd add the "using" attribute (with the appropriate bank > number), together with "naked". I assume, that I still need to provide the > switching code upon entry/exit on my own; but the compiler is aware that the > register bank is in usage and will not assign it to iram/dram/stack or > otherwise. Correct? Yes, that's correct. If you do not use naked the switching will be done for you (by the caller!). > I am uncertain for the last item, as there are cryptic comments in the > documentation regarding the 'using' attribute. Chapter 3.10 says, "The using > attribute will have no effect on the generated code for a non-interrupt > function (but may occasionally be useful anyway3.3). (pending: Note, > nowadays the using attribute has an effect on the generated code for a > non-interrupt function.)". What is this supposed to mean? This means the documentation should be updated ;) Interrupt functions with a "using" switch register banks at the entry/exit. Other functions assume the bank is switched already. This is done by the caller if it uses a different register bank. > On a similar note, chapter 3.12 says on labels in inline assembler, that "In > older versions of the compiler all labels defined within inline assembler > code had to be of the form nnnnn$ where nnnn is a number less than 100 > (which implies a limit of utmost 100 inline assembler labels per function)." > OK, which is "older versions of compiler" and assuming I have the up-to-date > version, what are the rules now? I don't know what "older versions" means. The label does not need to be of the form nnnnn$ but these are treated as local labels by the assembler. They can reoccur after any other label. The compiler will generate only local labels above 100 and so all <100 are at your disposal. If you need more you might need to rethink your implementation strategy. > Thanks, > > Jan Waclawek You're welcome. I hope it clears things up a bit. Maarten ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user