New release is out; with some new features and fixes!

https://github.com/CE-Programming/toolchain/releases/latest

The latest function is os_GetStringInput(), which can get an input string from the user from the OS much like the basic Input and Prompt commands Smile
If you are curious about C and want to try learning it, this update was made for you!

The toolchain has been completely revamped and now uses jacobly's fasmg-ez80 tools to perform the assembling and linking stages that were once handled by the old ZDS tools. What this means:

    You no longer need to specify shared (L=) for libraries in the makefile, they are automatically detected and added.
    You do not need to change the debug flag in the makefile, simply use 'make debug'
    A better map file is produced, and in debug mode a debug file is produced for later source-level debugging in CEmu
    The movement away from closed-source third-party tools has begun, to be replaces by FOSS, which will make llvm integration even easier in the future.
    The library format is easier to use and adapt/add to.
    A few library bugs have been fixed, such as gfx_FillTriangle().


You can also use the standard stdio.h commands for interfacing with files! This includes functions such as fopen(), fputs(), fread(), etc. This leverages the shared fileioc library to make porting applications even easier.

Download links are below, happy coding!

https://github.com/CE-Programming/toolchain/releases/latest
https://github.com/CE-Programming/libraries/releases/latest

Many thanks to jacobly who contributed a significant portion in making this possible.
Hello, I was wondering, is there some alternative to the GetCalc( command in C? I am making a multiplayer game in C, but I cant find anything on linking calculators. Thanks!
After a lot of digging in Mateo's GitHub profile, I found the C USB documentation. You can view the whole documentation page here. I hope this helped! Smile
FizzyApple12 wrote:
Hello, I was wondering, is there some alternative to the GetCalc( command in C? I am making a multiplayer game in C, but I cant find anything on linking calculators. Thanks!

There is currently no linking support in C.
There is now a new release of the toolchain which includes many fixes and improvements. A new example demonstrates displaying fullscreen images from an appvar with ease. Enjoy, and have fun!

https://github.com/CE-Programming/toolchain/releases/latest
https://github.com/CE-Programming/libraries/releases/latest
I have a problem with the toolchain make, I typed make into the terminal and it didn't work

Code:
Wills-MacbookPro:hello_world WillWang$ make
makefile:15: /include/.makefile: No such file or directory
make: *** No rule to make target `/include/.makefile'.  Stop.

I think that I did add the environment variable but it didn't work.
I am confused by the steps, can someone help me?
Your environment variables don't seem to be set up properly. See: https://github.com/CE-Programming/toolchain/wiki/Installing-on-Linux-or-macOS.

You probably want to add a line like export CEDEV=~/CEdev && export PATH=~/CEdev/bin:$PATH (adjust the paths if your CEdev folder is elsewhere) to your ~/.bash_profile file and then restart the shell.
Runer112 wrote:
Your environment variables don't seem to be set up properly. See: https://github.com/CE-Programming/toolchain/wiki/Installing-on-Linux-or-macOS.

You probably want to add a line like export CEDEV=~/CEdev && export PATH=~/CEdev/bin:$PATH (adjust the paths if your CEdev folder is elsewhere) to your ~/.bash_profile file and then restart the shell.


I did things you said:

Code:
Wills-MacbookPro:hello_world WillWang$ export CEDEV=/Users/WillWang/CEdev && export PATH=/Users/WillWang/CEdev/binL$PATH

and then I tried make, but it said:

Code:
Wills-MacbookPro:hello_world WillWang$ make
make: winepath: Command not found
C CE SDK Version 7.5
usage: mkdir [-pv] [-m mode] directory ...
make: *** [dirs] Error 64

I have wine install and it is running
Looks like wine is not installed properly. How did you install it? Intstalling with homebrew seems to be the consensus best way to install wine on a Mac.
Runer112 wrote:
Looks like wine is not installed properly. How did you install it? Intstalling with homebrew seems to be the consensus best way to install wine on a Mac.


I installed it but I didn't use home-brew, does that matter?
How you install it shouldn't matter, as long as it gets installed correctly. I'm not convinced that it is installed correctly, though.

And if you attempt to reinstall it, remember to restart the shell to bring in the updated environment variables.
Brew is by far the best way to properly install anything on mac. Any luck?
Toolchain update and library update is here! Be sure to download the latest libraries and development toolchain; many things have been changed and added, including new library functions and bug fixes! Thanks to Runer, jacobly, Adriweb, and P_T for their continued work. Enjoy!

Toolchain: https://github.com/CE-Programming/toolchain/releases/latest
Libraries: https://github.com/CE-Programming/libraries/releases/latest
Changelog: https://github.com/CE-Programming/toolchain/blob/master/changelog.md
New toolchain release fixes some building bugs on windows and comes with an updated installer executable:

https://github.com/CE-Programming/toolchain/releases/latest

Enjoy!
*New* installer executable, nice work team!
I don't know if it is my code's problem or the toolchain has a bug, it shows that weird symbol, when I exit the program there is no ram clear, it appears as soon as I run the program. (I am pretty new to toolchain)

Code:
////////////////////////////////////////
// CFACTOR 1.0
// Author: Waaangyi
// License: None
// Description: Factor family version 6
////////////////////////////////////////

/* Keep these headers */
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <tice.h>

/* Standard headers */
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

/* Other available headers: stdarg.h, setjmp.h, assert.h, ctype.h, float.h, iso646.h, limits.h, errno.h */

/* Put function prototypes here */
void printText(const char *text, uint8_t xpos, uint8_t ypos);
void printTextSmall(const char *text, uint8_t xpos, uint8_t ypos);

/* Put all your code here */
void main(void)
{
    char a[10];
    char b[10];
    char c[10];
    uint8_t current_size = 0;
    const uint8_t delay_time=23;
    uint8_t times = 1;
    const char cleanup[26] = "                          ";
    bool first_input = true;
    const uint8_t max_size = 8;
    sk_key_t key = sk_Prgm;
    os_ClrHome();
    printText("THE FASTEST VERSION EVER!",0,0);
    printText("FINDER 2.0",0,1);
    printText("VERSION 6",0,2);
    printText("9 DIGIT MAX",0,3);
    printText("FORM:AX^2+BX+C",0,4);
key_input:
    first_input = true;
    printText(cleanup,0,6);
    printText(cleanup,0,8);
    if (times==1)
        printText("A:",0,5);
    if (times==2)
        printText("B:",0,5);
    if (times==3)
        printText("C:",0,5);
    while(key!=sk_Enter || current_size==0)
    {
        key = os_GetCSC();
        if (key==sk_1)
        {
            if (first_input)
            {
                if(times == 1)
                    strcpy(a,"1");
                if(times == 2)
                    strcpy(b,"1");
                if(times == 3)
                    strcpy(c,"1");
                first_input = false;
                current_size++;
            }
            else
            {
                if(max_size>=current_size)
                {
                    current_size++;
                    if(times == 1)
                        strcat(a,"1");
                    if(times == 2)
                        strcat(b,"1");
                    if(times == 3)
                        strcat(c,"1");
                }
            }
            if(times == 1)
                printText(a,0,6);
            if(times == 2)
                printText(b,0,6);
            if(times == 3)
                printText(c,0,6);
            delay(delay_time);
        }
        if (key==sk_2)
        {
            if (first_input)
            {
                if(times == 1)
                    strcpy(a,"2");
                if(times == 2)
                    strcpy(b,"2");
                if(times == 3)
                    strcpy(c,"2");
                first_input = false;
                current_size++;
            }
            else
            {
                if(max_size>=current_size)
                {
                    current_size++;
                    if(times == 1)
                        strcat(a,"2");
                    if(times == 2)
                        strcat(b,"2");
                    if(times == 3)
                        strcat(c,"2");
                }
            }
            if(times == 1)
                printText(a,0,6);
            if(times == 2)
                printText(b,0,6);
            if(times == 3)
                printText(c,0,6);
            delay(delay_time);
        }
        if (key==sk_3)
        {
            if (first_input)
            {
                if(times == 1)
                    strcpy(a,"3");
                if(times == 2)
                    strcpy(b,"3");
                if(times == 3)
                    strcpy(c,"3");
                first_input = false;
                current_size++;
            }
            else
            {
                if(max_size>=current_size)
                {
                    current_size++;
                    if(times == 1)
                        strcat(a,"3");
                    if(times == 2)
                        strcat(b,"3");
                    if(times == 3)
                        strcat(c,"3");
                }
            }
            if(times == 1)
                printText(a,0,6);
            if(times == 2)
                printText(b,0,6);
            if(times == 3)
                printText(c,0,6);
            delay(delay_time);
        }
        if (key==sk_4)
        {
            if (first_input)
            {
                if(times == 1)
                    strcpy(a,"4");
                if(times == 2)
                    strcpy(b,"4");
                if(times == 3)
                    strcpy(c,"4");
                first_input = false;
                current_size++;
            }
            else
            {
                if(max_size>=current_size)
                {
                    current_size++;
                    if(times == 1)
                        strcat(a,"4");
                    if(times == 2)
                        strcat(b,"4");
                    if(times == 3)
                        strcat(c,"4");
                }
            }
            if(times == 1)
                printText(a,0,6);
            if(times == 2)
                printText(b,0,6);
            if(times == 3)
                printText(c,0,6);
            delay(delay_time);
        }
        if (key==sk_5)
        {
            if (first_input)
            {
                if(times == 1)
                    strcpy(a,"5");
                if(times == 2)
                    strcpy(b,"5");
                if(times == 3)
                    strcpy(c,"5");
                first_input = false;
                current_size++;
            }
            else
            {
                if(max_size>=current_size)
                {
                    current_size++;
                    if(times == 1)
                        strcat(a,"5");
                    if(times == 2)
                        strcat(b,"5");
                    if(times == 3)
                        strcat(c,"5");
                }
            }
            if(times == 1)
                printText(a,0,6);
            if(times == 2)
                printText(b,0,6);
            if(times == 3)
                printText(c,0,6);
            delay(delay_time);
        }
        if (key==sk_6)
        {
            if (first_input)
            {
                if(times == 1)
                    strcpy(a,"6");
                if(times == 2)
                    strcpy(b,"6");
                if(times == 3)
                    strcpy(c,"6");
                first_input = false;
                current_size++;
            }
            else
            {
                if(max_size>=current_size)
                {
                    current_size++;
                    if(times == 1)
                        strcat(a,"6");
                    if(times == 2)
                        strcat(b,"6");
                    if(times == 3)
                        strcat(c,"6");
                }
            }
            if(times == 1)
                printText(a,0,6);
            if(times == 2)
                printText(b,0,6);
            if(times == 3)
                printText(c,0,6);
            delay(delay_time);
        }
        if (key==sk_7)
        {
            if (first_input)
            {
                if(times == 1)
                    strcpy(a,"7");
                if(times == 2)
                    strcpy(b,"7");
                if(times == 3)
                    strcpy(c,"7");
                first_input = false;
                current_size++;
            }
            else
            {
                if(max_size>=current_size)
                {
                    current_size++;
                    if(times == 1)
                        strcat(a,"7");
                    if(times == 2)
                        strcat(b,"7");
                    if(times == 3)
                        strcat(c,"7");
                }
            }
            if(times == 1)
                printText(a,0,6);
            if(times == 2)
                printText(b,0,6);
            if(times == 3)
                printText(c,0,6);
            delay(delay_time);
        }
        if (key==sk_8)
        {
            if (first_input)
            {
                if(times == 1)
                    strcpy(a,"8");
                if(times == 2)
                    strcpy(b,"8");
                if(times == 3)
                    strcpy(c,"8");
                first_input = false;
                current_size++;
            }
            else
            {
                if(max_size>=current_size)
                {
                    current_size++;
                    if(times == 1)
                        strcat(a,"8");
                    if(times == 2)
                        strcat(b,"8");
                    if(times == 3)
                        strcat(c,"8");
                }
            }
            if(times == 1)
                printText(a,0,6);
            if(times == 2)
                printText(b,0,6);
            if(times == 3)
                printText(c,0,6);
            delay(delay_time);
        }
        if (key==sk_9)
        {
            if (first_input)
            {
                if(times == 1)
                    strcpy(a,"9");
                if(times == 2)
                    strcpy(b,"9");
                if(times == 3)
                    strcpy(c,"9");
                first_input = false;
                current_size++;
            }
            else
            {
                if(max_size>=current_size)
                {
                    current_size++;
                    if(times == 1)
                        strcat(a,"9");
                    if(times == 2)
                        strcat(b,"9");
                    if(times == 3)
                        strcat(c,"9");
                }
            }
            if(times == 1)
                printText(a,0,6);
            if(times == 2)
                printText(b,0,6);
            if(times == 3)
                printText(c,0,6);
            delay(delay_time);
        }
        if (key==sk_0)
        {
            if (first_input)
            {
                if(times == 1)
                    strcpy(a,"0");
                if(times == 2)
                    strcpy(b,"0");
                if(times == 3)
                    strcpy(c,"0");
                first_input = false;
                current_size++;
            }
            else
            {
                if(max_size>=current_size)
                {
                    current_size++;
                    if(times == 1)
                        strcat(a,"0");
                    if(times == 2)
                        strcat(b,"0");
                    if(times == 3)
                        strcat(c,"0");
                }
            }
            if(times == 1)
                printText(a,0,6);
            if(times == 2)
                printText(b,0,6);
            if(times == 3)
                printText(c,0,6);
            delay(delay_time);
        }
    }
    current_size = 0;
    if (times!=3)
    {
        times++;
        goto key_input;
    }
    while(!os_GetCSC());
}

/* Draw text on the homescreen at the given X/Y location */
void printText(const char *text, uint8_t xpos, uint8_t ypos)
{
    os_SetCursorPos(ypos, xpos);
    os_PutStrFull(text);
}

/* Draw small text at the given X/Y location */
void printTextSmall(const char *text, uint8_t xpos, uint8_t ypos)
{
    os_FontSelect(0); // sets small font (1 == big, see docs)
    os_FontDrawText(text, xpos, ypos);
}


New toolchain and library release with some nice bug fixes! Very Happy

C Development SDK: https://github.com/CE-Programming/toolchain/releases
C Standard Libraries: https://github.com/CE-Programming/libraries/releases
Waaangyi wrote:
I don't know if it is my code's problem or the toolchain has a bug, it shows that weird symbol, when I exit the program there is no ram clear, it appears as soon as I run the program. (I am pretty new to toolchain)

Code:
////////////////////////////////////////
// CFACTOR 1.0
// Author: Waaangyi
// License: None
// Description: Factor family version 6
////////////////////////////////////////

/* Keep these headers */
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <tice.h>

/* Standard headers */
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

/* Other available headers: stdarg.h, setjmp.h, assert.h, ctype.h, float.h, iso646.h, limits.h, errno.h */

/* Put function prototypes here */
void printText(const char *text, uint8_t xpos, uint8_t ypos);
void printTextSmall(const char *text, uint8_t xpos, uint8_t ypos);

/* Put all your code here */
void main(void)
{
    char a[10];
    char b[10];
    char c[10];
    uint8_t current_size = 0;
    const uint8_t delay_time=23;
    uint8_t times = 1;
    const char cleanup[26] = "                          ";
    bool first_input = true;
    const uint8_t max_size = 8;
    sk_key_t key = sk_Prgm;
    os_ClrHome();
    printText("THE FASTEST VERSION EVER!",0,0);
    printText("FINDER 2.0",0,1);
    printText("VERSION 6",0,2);
    printText("9 DIGIT MAX",0,3);
    printText("FORM:AX^2+BX+C",0,4);
key_input:
    first_input = true;
    printText(cleanup,0,6);
    printText(cleanup,0,8);
    if (times==1)
        printText("A:",0,5);
    if (times==2)
        printText("B:",0,5);
    if (times==3)
        printText("C:",0,5);
    while(key!=sk_Enter || current_size==0)
    {
        key = os_GetCSC();
        if (key==sk_1)
        {
            if (first_input)
            {
                if(times == 1)
                    strcpy(a,"1");
                if(times == 2)
                    strcpy(b,"1");
                if(times == 3)
                    strcpy(c,"1");
                first_input = false;
                current_size++;
            }
            else
            {
                if(max_size>=current_size)
                {
                    current_size++;
                    if(times == 1)
                        strcat(a,"1");
                    if(times == 2)
                        strcat(b,"1");
                    if(times == 3)
                        strcat(c,"1");
                }
            }
            if(times == 1)
                printText(a,0,6);
            if(times == 2)
                printText(b,0,6);
            if(times == 3)
                printText(c,0,6);
            delay(delay_time);
        }
        if (key==sk_2)
        {
            if (first_input)
            {
                if(times == 1)
                    strcpy(a,"2");
                if(times == 2)
                    strcpy(b,"2");
                if(times == 3)
                    strcpy(c,"2");
                first_input = false;
                current_size++;
            }
            else
            {
                if(max_size>=current_size)
                {
                    current_size++;
                    if(times == 1)
                        strcat(a,"2");
                    if(times == 2)
                        strcat(b,"2");
                    if(times == 3)
                        strcat(c,"2");
                }
            }
            if(times == 1)
                printText(a,0,6);
            if(times == 2)
                printText(b,0,6);
            if(times == 3)
                printText(c,0,6);
            delay(delay_time);
        }
        if (key==sk_3)
        {
            if (first_input)
            {
                if(times == 1)
                    strcpy(a,"3");
                if(times == 2)
                    strcpy(b,"3");
                if(times == 3)
                    strcpy(c,"3");
                first_input = false;
                current_size++;
            }
            else
            {
                if(max_size>=current_size)
                {
                    current_size++;
                    if(times == 1)
                        strcat(a,"3");
                    if(times == 2)
                        strcat(b,"3");
                    if(times == 3)
                        strcat(c,"3");
                }
            }
            if(times == 1)
                printText(a,0,6);
            if(times == 2)
                printText(b,0,6);
            if(times == 3)
                printText(c,0,6);
            delay(delay_time);
        }
        if (key==sk_4)
        {
            if (first_input)
            {
                if(times == 1)
                    strcpy(a,"4");
                if(times == 2)
                    strcpy(b,"4");
                if(times == 3)
                    strcpy(c,"4");
                first_input = false;
                current_size++;
            }
            else
            {
                if(max_size>=current_size)
                {
                    current_size++;
                    if(times == 1)
                        strcat(a,"4");
                    if(times == 2)
                        strcat(b,"4");
                    if(times == 3)
                        strcat(c,"4");
                }
            }
            if(times == 1)
                printText(a,0,6);
            if(times == 2)
                printText(b,0,6);
            if(times == 3)
                printText(c,0,6);
            delay(delay_time);
        }
        if (key==sk_5)
        {
            if (first_input)
            {
                if(times == 1)
                    strcpy(a,"5");
                if(times == 2)
                    strcpy(b,"5");
                if(times == 3)
                    strcpy(c,"5");
                first_input = false;
                current_size++;
            }
            else
            {
                if(max_size>=current_size)
                {
                    current_size++;
                    if(times == 1)
                        strcat(a,"5");
                    if(times == 2)
                        strcat(b,"5");
                    if(times == 3)
                        strcat(c,"5");
                }
            }
            if(times == 1)
                printText(a,0,6);
            if(times == 2)
                printText(b,0,6);
            if(times == 3)
                printText(c,0,6);
            delay(delay_time);
        }
        if (key==sk_6)
        {
            if (first_input)
            {
                if(times == 1)
                    strcpy(a,"6");
                if(times == 2)
                    strcpy(b,"6");
                if(times == 3)
                    strcpy(c,"6");
                first_input = false;
                current_size++;
            }
            else
            {
                if(max_size>=current_size)
                {
                    current_size++;
                    if(times == 1)
                        strcat(a,"6");
                    if(times == 2)
                        strcat(b,"6");
                    if(times == 3)
                        strcat(c,"6");
                }
            }
            if(times == 1)
                printText(a,0,6);
            if(times == 2)
                printText(b,0,6);
            if(times == 3)
                printText(c,0,6);
            delay(delay_time);
        }
        if (key==sk_7)
        {
            if (first_input)
            {
                if(times == 1)
                    strcpy(a,"7");
                if(times == 2)
                    strcpy(b,"7");
                if(times == 3)
                    strcpy(c,"7");
                first_input = false;
                current_size++;
            }
            else
            {
                if(max_size>=current_size)
                {
                    current_size++;
                    if(times == 1)
                        strcat(a,"7");
                    if(times == 2)
                        strcat(b,"7");
                    if(times == 3)
                        strcat(c,"7");
                }
            }
            if(times == 1)
                printText(a,0,6);
            if(times == 2)
                printText(b,0,6);
            if(times == 3)
                printText(c,0,6);
            delay(delay_time);
        }
        if (key==sk_8)
        {
            if (first_input)
            {
                if(times == 1)
                    strcpy(a,"8");
                if(times == 2)
                    strcpy(b,"8");
                if(times == 3)
                    strcpy(c,"8");
                first_input = false;
                current_size++;
            }
            else
            {
                if(max_size>=current_size)
                {
                    current_size++;
                    if(times == 1)
                        strcat(a,"8");
                    if(times == 2)
                        strcat(b,"8");
                    if(times == 3)
                        strcat(c,"8");
                }
            }
            if(times == 1)
                printText(a,0,6);
            if(times == 2)
                printText(b,0,6);
            if(times == 3)
                printText(c,0,6);
            delay(delay_time);
        }
        if (key==sk_9)
        {
            if (first_input)
            {
                if(times == 1)
                    strcpy(a,"9");
                if(times == 2)
                    strcpy(b,"9");
                if(times == 3)
                    strcpy(c,"9");
                first_input = false;
                current_size++;
            }
            else
            {
                if(max_size>=current_size)
                {
                    current_size++;
                    if(times == 1)
                        strcat(a,"9");
                    if(times == 2)
                        strcat(b,"9");
                    if(times == 3)
                        strcat(c,"9");
                }
            }
            if(times == 1)
                printText(a,0,6);
            if(times == 2)
                printText(b,0,6);
            if(times == 3)
                printText(c,0,6);
            delay(delay_time);
        }
        if (key==sk_0)
        {
            if (first_input)
            {
                if(times == 1)
                    strcpy(a,"0");
                if(times == 2)
                    strcpy(b,"0");
                if(times == 3)
                    strcpy(c,"0");
                first_input = false;
                current_size++;
            }
            else
            {
                if(max_size>=current_size)
                {
                    current_size++;
                    if(times == 1)
                        strcat(a,"0");
                    if(times == 2)
                        strcat(b,"0");
                    if(times == 3)
                        strcat(c,"0");
                }
            }
            if(times == 1)
                printText(a,0,6);
            if(times == 2)
                printText(b,0,6);
            if(times == 3)
                printText(c,0,6);
            delay(delay_time);
        }
    }
    current_size = 0;
    if (times!=3)
    {
        times++;
        goto key_input;
    }
    while(!os_GetCSC());
}

/* Draw text on the homescreen at the given X/Y location */
void printText(const char *text, uint8_t xpos, uint8_t ypos)
{
    os_SetCursorPos(ypos, xpos);
    os_PutStrFull(text);
}

/* Draw small text at the given X/Y location */
void printTextSmall(const char *text, uint8_t xpos, uint8_t ypos)
{
    os_FontSelect(0); // sets small font (1 == big, see docs)
    os_FontDrawText(text, xpos, ypos);
}




I haven't had time to look at your code in depth, but my first guess would be that your strings aren't null-terminated. Almost always, strings in C should end with '\0', AKA the "null terminator" character which indicates the end of the string. Without that character, functions that use the string will read past the end of the character array and produce garbage.
String literals are automatically null-terminated in C.
  
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
» Goto page Previous  1, 2, 3 ... , 15, 16, 17  Next
» View previous topic :: View next topic  
Page 16 of 17
» 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