[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: An idea that might go nowhere - ProDOS + CC65 = :>?
I'm starting to write a basic CLI but as some things are easier done in
asm and some in C I'm having to write in mix when writing in straight ASM
would definitely be better.
This is the code I came up with (keeping in mind that "cmdlin" is 0x0200
and "cmdnam" is 0x0280) to try to convert a C string, "buf", to the
necessary format, which I have not yet tried to do anything with yet. (I
have some BLOAD code lying around - haven't integrated it yet.)
for (t=0; t<256; t++) cmdlin[t]=0;
cmdlin[0]=0xB2; /* REM */
if (strchr(buf,' '))
{
char *a;
a=strchr(buf,' ');
for (t=0; a[t]; t++) cmdlin[t+1]=a[t];
*a=0;
}
if (*buf=='/')
strcpy(cmdnam+1,buf);
else
{
getcwd(cmdnam+1,127);
if(cmdnam[strlen(cmdnam+1)]!='/') strcat(cmdnam+1,"/");
strcat(cmdnam+1,buf);
}
*cmdnam=strlen(cmdnam+1);
I suppose if I had stuff to do this in ASM that would be most of what I'd
need for the transient part of a shell, with 3D0 pointing to some code
that would clear stuff out and return to the shell. C...really isn't the
tool for the job...but I'm...not sure I could do it in asm :/
-uso.