- [TI84+CE] C Compiler
- 27 May 2015 07:26:59 am
- Last edited by MateoConLechuga on 09 May 2016 04:08:47 pm; edited 4 times in total
NOTE: THIS POST IS OUTDATED. PLEASE SEE THIS LINK FOR COMPILER INSTALLATION
So, yesterday DrDnar mentioned getting a C compiler up and running for the new CE edition, so that's what I went and did. Now, there are quite a few things to keep in mind when getting things up and running, but I will go through them all in order to make your life a little easier. Of course; this still means that routines need to be written in assembly or C in order to do graphics or anything useful, which will probably be part of my next project. So, here are the steps you need to set up a C IDE for the TI84+CE.
First, grab the Zilog Developer Studio II, available here: (It is free, although you do have to register and things; they send you a link to download once you do that.)
http://store.zilog.com/index.php?option=com_ixxocart&Itemid=1&p=product&id=29&parent=5
Now, once you have everything installed in the directory of your liking, run ZDS2Ide.exe (for me it is in C:\Program Files (x86)\ZiLOG\ZDSII_eZ80Acclaim!_5.2.0\bin) Or you can search for it if need be.
Here is a full-fledged tutorial for what I know now.
First, open the IDE and select "New Project..." from the [FILE] tab.
Next, configure it to these options:
Press [CONTINUE], and then deselect the Startup item.
After that, select development item 2 (It doesn't really matter)
Skip past setting the ROM and RAM address, and just press [FINISH].
There you go. Now; go to [FILE]->"New File..."
Save said file inside of your project folder
Now, change the compiling mode to "Release":
The next step is to click on [PROJECT]->"Add Files..." and add that file to the current project:
Now go to [PROJECT]->"Settings..." or press [ALT-7]. Under the Linker menu, in "Objects and Libraries", make it look like this:
Next, go to the "Output" submenu. Check to make sure that the path is what you want it to be: (Also disable IEEE mode)
Now, under the "Commands" submenu, Choose "All RAM", and select the "Additional Directives" Checkbox. Click on the "Edit..." button, and input the following: EDIT: Fixed some things, copy text below
Copyable Text:
Code:
Almost there! Now; under the "General" menu in the settings window,
just make sure it has the right output location:
Select "Clean" from the [BUILD] Tab:
And you are done! Now, to write actual programs, use this button and start of code:
Copyable text:
Code:
Of course; a crt0.o or something would be especially useful, as it would get rid of all those pragma's
Download the CE.h file here:
http://myimages.wdfiles.com/local--files/start/CE.h
If you press that button and everything works just dandy; then you are ready to begin programming in C. Good luck!
Now, the next step is to go into the Release directory and locate the .hex file that was created. This is in Intel Hex format, so I made a program that goes from Intel Hex to 8xp, exactly like the old convHex except I don't get paid for it. Simply drag and drop the hex file on here; or run it from the command line. It will then create the calculator program that you can send via TI-Connect and such. Here's what it looked liked when I dragged and dropped things:
ConvHex: http://myimages.wikidot.com/local--files/start/ConvHEX.exe
--After Drop--
NOTES:
The USE_OS_CRT define basically just tells the compiler whether or not to use the included C runtime library in the OS. Otherwise, it will append the routines to your program. Note that it will only include functions used, not the whole thing. Useful if you want fast RAM execution, or a smaller program size. Not all routines have been found as of yet though; but luckily there are quite a few to make a substantial difference.
I will make a better tutorial on how to really do things when I figure out everything myself.
Here's what the main C code looks like:
Code:
And thus; I hail this as the first CE community program written in C. Where shall we go next? I think something like the Arduino syntax could be very useful, or something along those lines.
Aslo, here's a list of the size of things:
Code:
So, yesterday DrDnar mentioned getting a C compiler up and running for the new CE edition, so that's what I went and did. Now, there are quite a few things to keep in mind when getting things up and running, but I will go through them all in order to make your life a little easier. Of course; this still means that routines need to be written in assembly or C in order to do graphics or anything useful, which will probably be part of my next project. So, here are the steps you need to set up a C IDE for the TI84+CE.
First, grab the Zilog Developer Studio II, available here: (It is free, although you do have to register and things; they send you a link to download once you do that.)
http://store.zilog.com/index.php?option=com_ixxocart&Itemid=1&p=product&id=29&parent=5
Now, once you have everything installed in the directory of your liking, run ZDS2Ide.exe (for me it is in C:\Program Files (x86)\ZiLOG\ZDSII_eZ80Acclaim!_5.2.0\bin) Or you can search for it if need be.
Here is a full-fledged tutorial for what I know now.
First, open the IDE and select "New Project..." from the [FILE] tab.
Next, configure it to these options:
Press [CONTINUE], and then deselect the Startup item.
After that, select development item 2 (It doesn't really matter)
Skip past setting the ROM and RAM address, and just press [FINISH].
There you go. Now; go to [FILE]->"New File..."
Save said file inside of your project folder
Now, change the compiling mode to "Release":
The next step is to click on [PROJECT]->"Add Files..." and add that file to the current project:
Now go to [PROJECT]->"Settings..." or press [ALT-7]. Under the Linker menu, in "Objects and Libraries", make it look like this:
Next, go to the "Output" submenu. Check to make sure that the path is what you want it to be: (Also disable IEEE mode)
Now, under the "Commands" submenu, Choose "All RAM", and select the "Additional Directives" Checkbox. Click on the "Edit..." button, and input the following: EDIT: Fixed some things, copy text below
Copyable Text:
Code:
RANGE ROM $000000 : $7FFFFF
RANGE RAM $D00000 : $D3FFFF
RANGE MEMORY $D1A87F : $D3FFFF
CHANGE CODE IS RAM
CHANGE TEXT IS RAM
CHANGE DATA IS RAM
CHANGE BSS IS RAM
CHANGE STRSECT IS RAM
LOCATE CODE AT $D1A87F
LOCATE DATA AT TOP OF CODE+1
LOCATE TEXT AT TOP OF DATA+1
LOCATE STRSECT AT TOP OF TEXT+1
LOCATE BSS AT TOP OF STRSECT+1
/* Segment order */
ORDER CODE,DATA,TEXT,STRSECT,BSS
/* Going to use SaveSScreen as a place to store for malloc() and things */
DEFINE __heaptop = $D13FD8
DEFINE __heapbot = $D0EA1F
DEFINE __stack = $D1A87E
DEFINE __copy_code_to_ram = 0
Almost there! Now; under the "General" menu in the settings window,
just make sure it has the right output location:
Select "Clean" from the [BUILD] Tab:
And you are done! Now, to write actual programs, use this button and start of code:
Copyable text:
Code:
#define USING_OS_CRT
#include "CE.h"
#pragma asm "DB %EF"
#pragma asm "DB %7B"
#pragma asm "CALL _main"
#pragma asm "ret"
void main() {
}
Of course; a crt0.o or something would be especially useful, as it would get rid of all those pragma's
Download the CE.h file here:
http://myimages.wdfiles.com/local--files/start/CE.h
If you press that button and everything works just dandy; then you are ready to begin programming in C. Good luck!
Now, the next step is to go into the Release directory and locate the .hex file that was created. This is in Intel Hex format, so I made a program that goes from Intel Hex to 8xp, exactly like the old convHex except I don't get paid for it. Simply drag and drop the hex file on here; or run it from the command line. It will then create the calculator program that you can send via TI-Connect and such. Here's what it looked liked when I dragged and dropped things:
ConvHex: http://myimages.wikidot.com/local--files/start/ConvHEX.exe
--After Drop--
NOTES:
The USE_OS_CRT define basically just tells the compiler whether or not to use the included C runtime library in the OS. Otherwise, it will append the routines to your program. Note that it will only include functions used, not the whole thing. Useful if you want fast RAM execution, or a smaller program size. Not all routines have been found as of yet though; but luckily there are quite a few to make a substantial difference.
I will make a better tutorial on how to really do things when I figure out everything myself.
Here's what the main C code looks like:
Code:
const static char hello[] = "HELLO WORLD!";
const static char welcome[] = "WELCOME TO THE WORLD OF C!";
void main() {
char Apples[] ="Apples.";
char Orange[] ="Orange.";
uint8 i;
cleanUp(); // Do a little screen cleanup
print(hello, 0, 0);
for(i=1; i<5; i++) { // Print the string 4 times
print(welcome, 0, i);
}
strcpy(Apples, Orange);
print(Apples, 0, i); // Should print "Orange."
print(Orange, 0, i+1); // Should also print "Orange."
getKey();
cleanUp();
}
And thus; I hail this as the first CE community program written in C. Where shall we go next? I think something like the Arduino syntax could be very useful, or something along those lines.
Aslo, here's a list of the size of things:
Code:
char: 8 bits
short int: 16 bits
int: 24 bits
long: 32 bits
float: 32 bits
double: 32 bits