Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: cmd line #9

Open
polluks opened this issue Jun 3, 2020 · 2 comments
Open

Feature Request: cmd line #9

polluks opened this issue Jun 3, 2020 · 2 comments

Comments

@polluks
Copy link

polluks commented Jun 3, 2020

How about officially supporting ProDOS 2.5 command line parameters in cc65?

@bobbimanners
Copy link
Owner

I have some command line parsing code which works in sortdir.c. It is conditionally compiled out at the moment because it is only useful for programs which are small enough to load from BASIC.SYSTEM (ie: fit from 0x2000 to 0x9600 if it is a SYSTEM file). However you can swipe the code if you like, or we can re-do it in ASM if that is better for cc65.

#define MAXNUMARGS 10

int argc;
char *argv[MAXNUMARGS];

void parseargs() {
    char *p;
    char i = 0, s = 0, prev = ' ';
    argc = 1;
    for (p = (char*)0x200; p <= (char*)0x27f; ++p) {
        *p &= 0x7f;
        if ((*p == 0) || (*p == 0x0d)) {
            argv[argc - 1] = buf + s;
            break;
        }
        if (*p == ' ') {
            if (prev != ' ') {
                buf[i++] = '\0';
                argv[argc - 1] = buf + s;
                s = i;
                ++argc;
            }
        } else {
            buf[i++] = *p;
        }
        prev = *p;
    }
}

#endif

@polluks
Copy link
Author

polluks commented Jun 3, 2020

@bobbimanners Thanks, I think we have to wait for the release of 2.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants