Luben Hristov
   
Reged: Oct 26 2003
Posts: 24
Loc: UK
|
|
Hello,
In the manual of the HOLTEK compiler is written that the inline assembler port definitions will be OK if you put:
#include <ashtk.h>
Unfortunately I can't find such file on my disk....
Shell I download such file from somewhere or it's missing in the installation files.
And how I can declare bit in one variable and use it in assembler. Is it OK like:
unsigned char temp;
asm("BCLR [_temp].0");
Best regards
Luben Hristov
Edited by Luben Hristov (Wed May 11 2005 01:02 PM)
|
lucky
HI-TECH team member
   
Reged: Oct 06 2003
Posts: 1054
Loc: Brisbane, Australia
|
|
Quote:
In the manual of the HOLTEK compiler is written that the inline assembler port definitions will be OK if you put:
#include <ashtk.h>
Unfortunately I can't find such file on my disk....
Missing from installation - see the attached...
Quote:
And how I can declare bit in one variable and use it in assembler.
The easiest way to learn is to do a test program in C, compile it to assembly and examine the output.
Code:
unsigned char tst;
main()
{
tst |= 1;
tst &= 0xFE;
}
htkc --chip=ht47c20-1 file.c -s
This creates file.as which will contain something like:
set [_tst].0
clr [_tst].0
-------------------- Matt Luckman
HI-TECH Software
|
Luben Hristov
   
Reged: Oct 26 2003
Posts: 24
Loc: UK
|
|
Hello,
Yes, now works!
The main confusion is comming from the small ldifference between the way you and HOLTEK define assembler in C. Actually your way is the correct one.
For example HOLTEK allows
SET _var
In HiTech you should write
SET [_var]
BTW, I made some tests to see how good is the optimization of the code.... and what I found is really shocking - the compiler just produces perfect assembler code. From ~30 tests only in :
unsigned char data8 ;
unsigned int dataA16;
.....
if ((dataA16 >> 8) & 4)
data8 |= 4;
I succeeded to fool the compiler and it created 3 sensless instructions.
126 ;TEST.C: 42: if ((dataA16 >> 8) & 4) data8 |= 4
+ ;
127 0054 0761 mov a,[_dataA16+1]
128 0055 00E5 mov [??_main],a
129 0056 1F66 clr [??_main+1]
130 0057 3D65 sz [??_main].2
131 0058 3164 set [_data8].2
132 ;TEST.C: 46: }
1
I meant - if somebody is hesitating to switch to HiTech compiler, it's really no place to worry - it works not worse then assembler programmer with 20 years experience (sounds sad, huh?)
best regards
Luben
Edited by Luben Hristov (Thu May 12 2005 06:31 AM)
|
Luben Hristov
   
Reged: Oct 26 2003
Posts: 24
Loc: UK
|
|
Hello,
I think there is some mistake in the the file ashtk.h.
Inside the the file the definitions (#if.. #endif) are like in C and the the includings are made with #include, that's not acceptable from the macro assembler. Note that this file is inluded in ASM section and have to obbey assembler rules.
Anyway, I just put directly the header file and works, but definitely the ashtk.h should be remade.
best regards
Luben Hristov
Edited by Luben Hristov (Thu May 12 2005 09:11 AM)
|
lucky
HI-TECH team member
   
Reged: Oct 06 2003
Posts: 1054
Loc: Brisbane, Australia
|
|
Quote:
I made some tests to see how good is the optimization of the code.... and what I found is really shocking - the compiler just produces perfect assembler code. I meant - if somebody is hesitating to switch to HiTech compiler, it's really no place to worry - it works not worse then assembler programmer with 20 years experience (sounds sad, huh?)
The HOLTEK compiler was the first of our compilers to get a new code generator that we've been working on. We're now doing the same for PICC-18 and PICC.
Have you tried using printf yet? The compiler examines all calls to printf and generates a version of printf that only contains the code required to process the format strings that you have used.
Quote:
Inside the the file the definitions (#if.. #endif) are like in C and the the includings are made with #include, that's not acceptable from the macro assembler.
What you say is correct, however if you add the -P option to the command line, the compiler will pre-process the file and make it acceptable for the assembler. I think there is a comment inside of ashtk.h which says this.
-------------------- Matt Luckman
HI-TECH Software
|
Luben Hristov
   
Reged: Oct 26 2003
Posts: 24
Loc: UK
|
|
Where exactly I have to put the -P option in HT_IDE, or I have to use BAT compiling.
Best regards Luben Hristov
|
lucky
HI-TECH team member
   
Reged: Oct 06 2003
Posts: 1054
Loc: Brisbane, Australia
|
|
Quote:
Where exactly I have to put the -P option in HT_IDE, or I have to use BAT compiling.
I'm not that familiar with Holtek's IDE, but from what I can see it doesn't look like they have a facility to manually add additional options. I'll find out if they can add this in a future version. In the mean-time, you may have to pre-process it yourself from the command line.
-------------------- Matt Luckman
HI-TECH Software
|
Luben Hristov
   
Reged: Oct 26 2003
Posts: 24
Loc: UK
|
|
Quote:
I'm not that familiar with Holtek's IDE, but from what I can see it doesn't look like they have a facility to manually add additional options. I'll find out if they can add this in a future version. In the mean-time, you may have to pre-process it yourself from the command line.
That means that in HT_IDE there is no sense to include #include "ashtk.h" .... it will never work! Actually HOLTEK is so simple like uP that it's a quastion of several minutes to write such include files for your purposes.
Best regards
Luben Hristov
Edited by Luben Hristov (Mon May 16 2005 04:12 AM)
|