vebveb wrote:
I don't know if the prizm has a printf function. If it doesn't, I will give you the printf function I wrote for fx9860.

Already been implemented in libfxcg, though all but the most common specifiers haven't been implemented yet.

Code:

int cursx = 1;
int cursy = 1;

int printf(const char *format,...) 
{
     char buffer [1000];
     unsigned char one [2]= { 0 , 0};
     int n=6;
     int i;
     n = vsprintf((char*)buffer,(const char*)format,(char*)((va_list)&(format) + sizeof(format)));

     for (i=0;i<n;i++) {
     locate(cursx,cursy);
     if(buffer[i] == '\n')  {cursy++;}
     else if (buffer[i] == '\r') {cursx=1;}
    else {
     one[0] = (unsigned char)buffer[i];
     PrintC(one);
     cursx++;
    }
     if (cursx >21) {cursx = 1; cursy++;}
     if (cursy >8) {cursy = 8;vertical_scroll(VRAM[0],-8); ML_rectangle(0,63-8,127,63,0,WHITE,WHITE);}
     }
     ML_display_vram(VRAM[0]);
    return n;
}


Edit: In the file you give, Tari, everything is coded form scratch. On fx9860, there exists a sprintf function and a vsprintf function, then it is easier to code printf. Why do not take an already coded sprintf function? It is crossplatform. Maybe you can take it from gcc sources.
vebveb wrote:
Edit: In the file you give, Tari, everything is coded form scratch. On fx9860, there exists a sprintf function and a vsprintf function, then it is easier to code printf. Why do not take an already coded sprintf function? It is crossplatform. Maybe you can take it from gcc sources.
GCC exposes printf as a builtin, but that depends on it being in libc, so there's nothing useful coming out of libc. It would be possible to borrow an implementation from something else, but at this point I can't really be bothered to do so, since we already have a version tuned to our system.
The printf source is exposed in the glibc sources. In their implementation, sprintf, printf, ... use the function vfprintf, and the "%f" "%g" "%e" options are managed by the function printf_fp.

I don't know if we can take this source code, but if we can, it would be greit to add the implementation of "%f" "%g" "%e" to printf in libfxcg. We'll need these options for LuaFX.
I have cross-posted this on UCF Wink

If this can be pulled off, it should really increase the amount of programs available to prizm. I love the idea of cross-compatability.

What else would be cool is a LuaFX interpreter for the TI-8x series...
flyingfisch wrote:
I have cross-posted this on UCF Wink

If this can be pulled off, it should really increase the amount of programs available to prizm. I love the idea of cross-compatability.

What else would be cool is a LuaFX interpreter for the TI-8x series...
What is there to cross-post, exactly? Anyway, I've been working on putting this together for the last few days, and I am getting close to having enough Prizm-specific libc components built to get this working on-calc.
KermMartian wrote:
flyingfisch wrote:
I have cross-posted this on UCF Wink
...

What is there to cross-post, exactly?
...


The fact that you are looking for someone to help you. Also, it makes a thread on UCF where more news can be posted in the future.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 2 of 2
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement