sdcard picomite: sync with upstream

This commit is contained in:
Yatao Li
2025-06-15 21:31:45 +08:00
parent f305e6def6
commit eb3b15e188
37 changed files with 3695 additions and 449 deletions

View File

@@ -955,13 +955,13 @@ int printWrappedText(const char *text, int screenWidth, int listcnt, int all) {
void cmd_help(void){
getargs(&cmdline,1,(unsigned char *)",");
if(!ExistsFile("A:/help.txt"))error("A:/help.txt not found");
if(!ExistsFile("B:/help.txt"))error("B:/help.txt not found");
if(!argc){
MMPrintString("Enter help and the name of the command or function\r\nUse * for multicharacter wildcard or ? for single character wildcard\r\n");
} else {
int fnbr = FindFreeFileNbr();
char *buff=GetTempMemory(STRINGSIZE);
BasicFileOpen("A:/help.txt",fnbr, FA_READ);
BasicFileOpen("B:/help.txt",fnbr, FA_READ);
int ListCnt = CurrentY/(FontTable[gui_font >> 4][1] * (gui_font & 0b1111)) + 2;
char *p=(char *)getCstring(argv[0]);
bool end=false;
@@ -1251,9 +1251,20 @@ retest_an_if:
// and it is just a number, so get it and find the line
nextstmt = findline(getinteger(argv[4]), true);
else {
// there is a statement after the ELSE clause so just point to it (the byte after the ELSE token)
/* // there is a statement after the ELSE clause so just point to it (the byte after the ELSE token)
for(p = cmdline; *p && *p != ss[1]; p++); // search for the token
nextstmt = p + 1; // and point to the byte after
*/
// IF <condition> THEN <statement1> ELSE <statement2>
// Find and read the THEN function token.
for(p = cmdline; *p && *p != ss[0]; p++){}
// Skip the command that <statement1> must start with.
p++;
skipspace(p);
p += sizeof(CommandToken);
// Find and read the ELSE function token.
for(; *p && *p != ss[1]; p++);
nextstmt = p+1; // The statement after the ELSE token.
}
} else {
// no ELSE on a single line IF statement, so just continue with the next statement
@@ -1608,7 +1619,7 @@ void MIPS16 do_chain(unsigned char *cmdline){
SaveContext();
ClearVars(0,false);
InitHeap(false);
if (*filename && !FileLoadProgram(buf, true)) return;
if (*buf && !FileLoadProgram(buf, true)) return;
ClearRuntime(false);
PrepareProgram(true);
RestoreContext(false);
@@ -2108,7 +2119,8 @@ void MIPS16 __not_in_flash_func(cmd_do)(void) {
unsigned char *p, *tp, *evalp;
if(cmdtoken==cmdWHILE)error("Unknown command");
// if it is a DO loop find the WHILE token and (if found) get a pointer to its expression
while(*cmdline && *cmdline != tokenWHILE) cmdline++;
while(*cmdline && *cmdline != tokenWHILE && *cmdline != tokenUNTIL) cmdline++;
if(*cmdline == tokenUNTIL)error("Syntax");
if(*cmdline == tokenWHILE) {
evalp = ++cmdline;
}
@@ -3638,7 +3650,7 @@ void execute(char* mycmd) {
}
else {
unsigned char* p = inpbuf;
char* q;
// char* q;
// char fn[STRINGSIZE] = { 0 };
unsigned short tkn=GetCommandValue((unsigned char *)"RUN");
tknbuf[0] = (tkn & 0x7f ) + C_BASETOKEN;
@@ -3646,10 +3658,10 @@ void execute(char* mycmd) {
p[0] = (tkn & 0x7f ) + C_BASETOKEN;
p[1] = (tkn >> 7) + C_BASETOKEN; //tokens can be 14-bit
memmove(&p[2], &p[4], strlen((char *)p) - 4);
if ((q = strchr((char *)p, ':'))) {
/* if ((q = strchr((char *)p, ':'))) {
q--;
*q = '0';
}
}*/
p[strlen((char*)p) - 2] = 0;
// MMPrintString(fn); PRet();
// CloseAudio(1);