Announcement

Collapse
No announcement yet.

Problem with file_Exec

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with file_Exec

    [email protected]

    I have a problem executing a program from uSD via file_Exec.

    When I compile the program an run it from flash all works fine. If I compile it as 4XE and execute it from an other program stored in the Flash then sometimes it runs and often it fails to run. It looks like a memory problem.

    Theprogram parses a catalog file stored on uSD and displays the information from that file together with an image from an imagelist.

    What could be the problem?  

    The file for the uSD you can download from http://www.astrohome.info/Data/Problem.rar.

    My program for testing  is

    HTML Code:
    #platform "uOLED-32028-P1"
    
    /************************************************
    * Filename: Menue.4dg
    * Created: 2008/11/19
    * Author:  Thomas Westerhoff
    * Description: MEssierkatalog für SkyDrive 1.0
    **************************************************/
    #inherit "4DGL_16bitColours.fnc" 
    
    
    
    func main()   
      
        gfx_Cls();   
        file_Exec("MESSIER.4XE",0);
    
        repeat 
        until (1==0);                                 
    
    endfunc   
    I use the latest PmmC 1.07 and Workshop 2.4.

  • #2


    This is a good opportunity to point out that you guys at 4D have
    the usual sense of "run" versus "exec" reversed. Please refer
    to the manpages in just about any Unix environment, where you'll
    find that exec(...) generally implies replacing the current instance
    of a running program with the new one. I would suggest that the
    sense of these may very well want to be changed to avoid confusion.

    _H*


    In 4DGL, (and many other languages besides Unix so it seems) 'exec' implies that a file/program is 'executed' like a function, and can return with a result. The term 'run' has been around since the dark ages, and means literally to supply all resources to a new program and 'run it'.
    Regards Dave

    Comment


    • #3


      Hi Thomas,
      Without seeing the code for the file you are executing, I'm not sure what the problem could be. If you do not return all memory and close all files before returning, it wont work. Being a tiny operating system , no resource lists are kept by the os to look after things like this so it is completely the programmers responsibility. If you can make a cut-down section of the problem area and post it too, we may be able to help.
      Regards,
      Dave

      Comment


      • #4

        Hi Meldavia.

        If you do not return all memory and close all files before returning, it wont work.
        The problem is not the return of the file. the program doesn't start correctly from the uSD. In the main program (see above) there is no memory allocation or file opening. 

        If I compile the program MESSIER.4dg and download it as MESSIER.4XE to the Display then it runs once. It I then disconnect the display from the power and reconnect it so that the small programm in the flash runs the MESSIER.4XE from the uSD, it doesn't work. It looks like the information stored in the catalog file MESSIER.KAT isn't readed correct. therefore you will get cryptic strings on the display.  

        Here is the program code.

        Code:
        #platform "uOLED-32028-P1"
        
        /************************************************
        * Filename: Messier.4dg
        * Created: 2008/11/19
        * Author:  Thomas Westerhoff
        * Description: MEssierkatalog für SkyDrive 1.0
        **************************************************/
        
        #inherit "4DGL_16bitColours.fnc"  
        
        //Spezielle Zeichen
        #DATA
        byte bmpDegree 0x01, 0x08, 0x18, 0x24, 0x34, 0x18, 0x00, 0x00, 0x00, 0x00 // "Z" as byte data
        #END
        
        
         
        
            var BasImg,KatImg;
            var ex;
            var ex2;
            var p;                  // buffer pointer   
            var i,m,j,n,k,h,c;   
            var key; 
            var combuf[2];          //Puffer für die serielle Kommunikation
            var katbuf[130];        //Puffer für eine Katalogzeile
            var BildNum;
            var F;
            var iFile;
            var hFile;
            var rec[150];
            var mysub[30];
            var gamma;
            var KatNum[5];   //Katalognummer
            var digit;
            var ObjInfo[20];         // array for infos
            var ObjInfo0[5];        //Dummy
            var ObjInfo1[5];        //Nummer
            var ObjInfo2[20];        //Name
            var ObjInfo3[10];        //RA
            var ObjInfo4[10];        //DE
            var ObjInfo5[20];        //Objekttyp
            var ObjInfo6[10];        //Sternbild
            var ObjInfo7[10];        //fotogra Helligkeit M-p
            var ObjInfo8[10];        //visuelle Helligkeit M-v
            var ObjInfo9[10];        //DIMx
            var ObjInfo10[10];       //DIMY
            var ObjInfo11[10];       //Flächenhelligkeit M-fl
            var ObjInfo12[10];
            var ObjInfo13[10];
            var ObjInfo14[10];
            var ObjInfo15[10];
            var ObjInfo16[10];
            var ObjInfo17[10];
            var InfoFile[500];
            var Filename[20];
            var recno;   //aktuelle Recornummer des Katalogs 
        
           
           var Katsize[2];         //Gesamte Filegröße des Katalogs
        
        // User consts
        #constant FILE_RECL 128
          
        //#constant ALL 0xFFFF        // image control constant   
        #CONST
            FALSE 0
            TRUE 1
            NULL 0
            LOW 0               // Int32 array index for low byte
            HIGH 1              // Int32 array index for low byte
        
            BUTTONCOLOR DARKSLATEBLUE
            SLIDERMAX        200
           //Hier die Tastencodes
            KEY0 48
            KEY1 49
            KEY2 50 
            KEY3 51
            KEY4 52
            KEY5 53
            KEY6 54
            KEY7 55
            KEY8 56
            KEY9 57
            KEYInfo 65
            KEYB 66
            KEYC 67
            KEYD 68
        
            KEYOK 13    
            KEYSHIFT 42
            KEYRAUT 35
            KEYUP 18
            KEYDOWN 19
            KEYRIGHT 20
            KEYLEFT 17
            KEYF1 27
            KEYF2 28
        
            GAMMA_TOPBOT_R	0x0070
         GAMMA_TOPBOT_G	0x0071
         GAMMA_TOPBOT_B	0x0072
         GAMMA_R12	    0x0073
         GAMMA_R34	    0x0074
         GAMMA_G12	    0x0075
         GAMMA_G34	    0x0076
         GAMMA_B12	    0x0077
         GAMMA_B34	    0x0078
            GAMMAREG        0x0043
        
        #END  
        
        
        
        
        
        //*******************************************************************************
        //
        //   Basisfunktionen, die in alles Dateien vorhanden sein müssen
        //
        //*******************************************************************************
        
        //Helligkeitseinstellungen
        
        //==================================================================================================
        // Contrast/Brightness setting for 2.4" AMOLED Modules
        // For Code Space saving choose only 3 settings out of the possible 9 below: High/Medium/Low
        //==================================================================================================
        func gammaInit24()
        
         // 250 nits Brightness
         display_SetReg(0x0080, 1);	display_SetReg(GAMMA_TOPBOT_R, 0x2400);	display_SetReg(GAMMA_TOPBOT_G, 0x2800);	display_SetReg(GAMMA_TOPBOT_B, 0x2F80);
         display_SetReg(GAMMA_R12, 0x1511);  display_SetReg(GAMMA_R34, 0x1C05);
         display_SetReg(GAMMA_G12, 0x1A15);  display_SetReg(GAMMA_G34, 0x1A14);
         display_SetReg(GAMMA_B12, 0x1C18);	display_SetReg(GAMMA_B34, 0x2213);
        
         // 200 nits Brightness
         display_SetReg(0x0080, 2);	display_SetReg(GAMMA_TOPBOT_R, 0x1F00);	display_SetReg(GAMMA_TOPBOT_G, 0x2380);	display_SetReg(GAMMA_TOPBOT_B, 0x2A80);
         display_SetReg(GAMMA_R12, 0x1511);	display_SetReg(GAMMA_R34, 0x1C11);
         display_SetReg(GAMMA_G12, 0x1B15);	display_SetReg(GAMMA_G34, 0x1A15);
         display_SetReg(GAMMA_B12, 0x1C18);	display_SetReg(GAMMA_B34, 0x2115);
        
        
         // 150 nits Brightness
         display_SetReg(0x0080, 3); 	display_SetReg(GAMMA_TOPBOT_R, 0x1A80);	display_SetReg(GAMMA_TOPBOT_G, 0x1F00);	display_SetReg(GAMMA_TOPBOT_B, 0x2580);
         display_SetReg(GAMMA_R12, 0x1410);	display_SetReg(GAMMA_R34, 0x1D11);
         display_SetReg(GAMMA_G12, 0x1C14);	display_SetReg(GAMMA_G34, 0x1B15);
         display_SetReg(GAMMA_B12, 0x1C18);	display_SetReg(GAMMA_B34, 0x2315);
        
        
         // 100 nits Brightness
         display_SetReg(0x0080, 4); 	display_SetReg(GAMMA_TOPBOT_R, 0x1480);	display_SetReg(GAMMA_TOPBOT_G, 0x1880);	display_SetReg(GAMMA_TOPBOT_B, 0x1F00);
         display_SetReg(GAMMA_R12, 0x1210);	display_SetReg(GAMMA_R34, 0x1D12);
         display_SetReg(GAMMA_G12, 0x1D14);	display_SetReg(GAMMA_G34, 0x1B16);
         display_SetReg(GAMMA_B12, 0x1B17);	display_SetReg(GAMMA_B34, 0x2317);
        
         // 50 nits Brightness
         display_SetReg(0x0080, 5); 	display_SetReg(GAMMA_TOPBOT_R, 0x0B80);	display_SetReg(GAMMA_TOPBOT_G, 0x1000);	display_SetReg(GAMMA_TOPBOT_B, 0x1600);
         display_SetReg(GAMMA_R12, 0x0C0F);	display_SetReg(GAMMA_R34, 0x1E13);
         display_SetReg(GAMMA_G12, 0x2014);	display_SetReg(GAMMA_G34, 0x1A17);
         display_SetReg(GAMMA_B12, 0x1A17);	display_SetReg(GAMMA_B34, 0x2417);
        
         // Nightview  Brightness
         display_SetReg(0x0080, 6); 	display_SetReg(GAMMA_TOPBOT_R, 0x0402);	display_SetReg(GAMMA_TOPBOT_G, 0x0402);	display_SetReg(GAMMA_TOPBOT_B, 0x0402);
         display_SetReg(GAMMA_R12, 0x0000);	display_SetReg(GAMMA_R34, 0x171F);
         display_SetReg(GAMMA_G12, 0x0000);	display_SetReg(GAMMA_G34, 0x081A);
         display_SetReg(GAMMA_B12, 0x0000);	display_SetReg(GAMMA_B34, 0x081A);
        endfunc
        
        
        
        
        
        
        
        
        
        
        
        
        
        //**************************************************************************************************
        //Stringfunktionen
        //**************************************************************************************************
        
        func StrToInt(var str)
        var int;
        var p;   
           p:=str_Ptr(str);
           str_GetW(&p,&int); 
           return(int);
        endfunc
        
        
        func LeftTrim(var wpstr)
        
        var lth, bpstrs, bpstrd, fnd, idx;
        
            bpstrs := str_Ptr(wpstr); // Raise string pointer for source string pointer
            bpstrd := bpstrs; // Take copy for destination string pointer
            lth := str_Length(wpstr); // Get length of string
        
            // Move source pointer to first non-space character
            fnd := 0;
            while(str_GetByte(bpstrs + fnd++) == ' ');
        
            // If space found then shift the remaining bytes left to overwrite the spaces
            if(fnd > 0)
                bpstrs := bpstrs + fnd - 1;
                idx := 0;
                repeat
                    str_PutByte(bpstrd + idx, str_GetByte(bpstrs + idx));
                until(++idx >= lth);
            endif
        endfunc
        
        
        // Non overlapping byte memory copy
        func ByteCopy(var bpsrc, var bpdst, var bytes)
          var i;
          i := 0;
          repeat
            str_PutByte(bpdst + i, str_GetByte(bpsrc + i));
          until(++i >= bytes);
        endfunc
        
        
        //  Extract next delimited string
        //  bpstr = Byte pointer to user string being extracted from
        //  wpsub = Word pointer to location where user sub string is to be placed
        //  delim = character to use as a delimiter
        //
        func GetNextSub(var wpstr, var wpsub, var delim)
            var delimpos;
        
            if((delimpos := str_Find(&amp;wpstr, &amp;delim<<1)) != 0)
                delimpos := (delimpos - wpstr + 1 ); // Adjust char position (v1.05 PmmC str_Find() workround)
                ByteCopy(wpstr, wpsub<<1, delimpos - 1);
                //mem_Copy(wpstr>>1, wpsub, delimpos - 1);           // Copy string to user sub-string
                str_PutByte(wpsub<<1 + delimpos - 1, 0x00);     // Write null terminator
                wpstr := wpstr + delimpos;
            else
                wpstr := 0;
            endif
        
            return(wpstr);
        endfunc
        
        
        
        
        
        
        
        
        //Funtion zum laden der Basisimages
        func LoadBasisImages()
            BasImg := file_LoadImageControl("Basimg.dat", "basimg.gci", 1);  // build the image control, returning a pointer to the structure allocation   
            if (!BasImg)   
                putstr("Fehler: Kann Basisbilder nicht laden...\n");   
            endif  
        endfunc
        
        //Hier wird der Katalog und die Bilddatei dazu geöffnet
        func LoadKatalog()
        var divider;
        var FHI;
        var FLO;
        
            //Bilder
            img_SetPosition( BasImg, 3, 105, 145); 
            img_Show( BasImg,3);
            
           //Den eigentlichen Katalog
        
            F := file_Open("MESSIER.KAT", 'r');  //und den zugehörigen Katalog
            file_Size(F,&amp;FHI,&amp;FLO);
        endfunc
        
        
        
        
        func ShowKatImage( var idx)
         if(file_Exists("MESSIER.IMG"))                         //check if file exists
           iFile:= file_Open("MESSIER.IMG", 'r');               //Open File for reading
           file_Index(iFile,0,20006,idx+1);
           file_Image(130,160,iFile) ;
           file_Close(iFile) ;
         else
           iFile:= file_Open("no_pic.gci", 'r');               //Open File for reading
           file_Image(130,160,iFile) ;
           file_Close(iFile) ;
         endif
        endfunc
        
        
        
        
        func ShowObjName()
            txt_Set(FONT_SIZE, FONT4);
            txt_MoveCursor(3,1);
            txt_Set(TEXT_COLOUR,RED);
            print("Messier ", [STR] ObjInfo1,"\n"); 
            txt_MoveCursor(6,2);
            txt_Set(TEXT_COLOUR,WHITE);
            txt_Set(FONT_SIZE, FONT3);
            print("                     ","\n"); 
            txt_MoveCursor(6,2);
            print([STR] ObjInfo2,"\n"); 
            print("__________________________ \n\n"); 
        
        endfunc
        
        func PrintKatInfo()
            txt_Set(FONT_SIZE, FONT3);
            txt_MoveCursor(9,1);
            txt_Set(TEXT_COLOUR,WHITE);
            txt_Set(TEXT_COLOUR,WHITE);
            txt_Set(TEXT_COLOUR,WHITE);print("RA :  ");txt_Set(TEXT_COLOUR,YELLOW);print([STR] ObjInfo3,"\n");
            txt_Set(TEXT_COLOUR,WHITE);print("DE : ");txt_Set(TEXT_COLOUR,YELLOW);print([STR] ObjInfo4,"\n");
            //Hiernoch das Gradzeichen
        
            gfx_Bitmap(bmpDegree, 71, 121, YELLOW);
        
            txt_Set(FONT_SIZE, FONT2);
            txt_MoveCursor(18,1);
            txt_Set(TEXT_COLOUR,WHITE); print("Typ: ");txt_Set(TEXT_COLOUR,LIME);print([STR] ObjInfo5,"\n");
            txt_Set(TEXT_COLOUR,WHITE); print("Sternb: ");txt_Set(TEXT_COLOUR,LIME);print([STR] ObjInfo6,"\n\n\n\n\n");
            txt_Set(TEXT_COLOUR,WHITE); print("M-phot: ");txt_Set(TEXT_COLOUR,LIME);print([STR] ObjInfo7,"m\n");
            txt_Set(TEXT_COLOUR,WHITE); print("M-vis : ");txt_Set(TEXT_COLOUR,LIME);print([STR] ObjInfo8,"m\n");
            txt_Set(TEXT_COLOUR,WHITE); print("M fl. : ");txt_Set(TEXT_COLOUR,LIME);print([STR] ObjInfo11,"m\n");
            txt_Set(TEXT_COLOUR,WHITE); print("Dim 1 : ");txt_Set(TEXT_COLOUR,LIME);print([STR] ObjInfo9,"\n");
            txt_Set(TEXT_COLOUR,WHITE); print("Dim 2 : ");txt_Set(TEXT_COLOUR,LIME);print([STR] ObjInfo10,"\n");
        
        
        endfunc
        
        
        func SaveScreen()
         hFile := file_Open("Screen1.img", 'w');           // open a file where we wish to save image
            file_ScreenCapture(30,100,181,81, hFile);      // save an area
            file_Close(hFile);                             // now close the file
        endfunc
        
        func LoadScreen()
         hFile := file_Open("Screen1.img", 'r');                 // open a file where we wish to save image
            file_Image(30,100, hFile);                            // display the image
            file_Close(hFile);
            file_Erase("Screen1.img");
        endfunc
        
        
        //funtion liest ein Zeichen nach dem ':'. Die ist die Taste die gedrückt wurde
        func readcom()
        var ch;
            repeat   
             if (sys_GetTimer(TIMER5)==0) 
               ShowKatImage(BildNum);  
               PrintKatInfo();  
               sys_SetTimer(TIMER5,65535);          
            endif;
            until((com_Count()==1));
          
            c := com_Count();                           // use the count to extract the buffer   
            while(c--)   
              ch := serin();  
            wend 
            com_Init(combuf, 2, ':' );  //Com Buffer initialisieren
            return ch;  
        endfunc
        
        func readcom1()
        var ch;
            repeat   
            until((com_Count()==1));
          
            c := com_Count();                           // use the count to extract the buffer   
            while(c--)   
              ch := serin();  
            wend 
            com_Init(combuf, 2, ':' );  //Com Buffer initialisieren
            return ch;  
        endfunc
        
        
        //funtion liest aus der Katalogdatei den entsprechende Eintrag und zeigt die Infos an
        func readKatalog()
        var bpnext; 
        var ind;
        var p;
        var a;
        
            file_Rewind(F);
            txt_Set(FONT_SIZE,FONT3);
            file_Index(F,0,FILE_RECL,recno+1);
        
          //Hier den Datensatz lesen und zerschneiden
            file_GetS(rec,130,F);
            ind := 0;
        
            // Point to string to extract sub-strings from
            bpnext := str_Ptr(rec);
            repeat
                if((bpnext:=GetNextSub(bpnext, mysub, ';')) != 0)
                    LeftTrim(mysub):
                   // print("Objektinfo",[DEC] ind,"=",[STR] mysub,"\n");
                    to(ObjInfo[ind]); print([STR] mysub);
                    ind++;
                endif
            until(bpnext == 0);
          
            p:=str_Ptr(ObjInfo1);
            str_GetW( &amp;p, &amp;BildNum);
            gfx_Cls;
            
          
            txt_MoveCursor(19,1);
            ShowObjName();
            sys_SetTimer(TIMER5, 200);
        endfunc
        
        
        func ShowBaseBtn()
        var handle;
            handle:= file_Open("HDEmp_0.gci", 'r');               //Open File for reading 
            file_Image(0,0,handle) ;
            file_Close(handle) ;
        
          // gfx_MoveTo(1,1); gfx_Set(2, BUTTONCOLOR);gfx_BoxTo(240,40);
           txt_Set(TEXT_OPACITY,TRANSPARENT);
           txt_Set(FONT_SIZE, FONT1);
           txt_Set(TEXT_COLOUR,WHITE);
           txt_MoveCursor(1,1);
           print("Waehlen Sie ein Objekt mit den Cursor-\n",
                 "tasten hoch und runter. OK uebernimmt \n",
                 "das Objekt");
           txt_Set(TEXT_OPACITY,OPAQUE);
           handle := file_Open("ABBRUCH.GCI",'r') ;
           file_Image(1,290,handle) ;
           file_Close(handle);
           handle := file_Open("SUCHEN.GCI",'r') ;
           file_Image(121,290,handle) ;
           file_Close(handle);
        endfunc
        
        
        
        //******************************************************************************
        //
        //  Funktionen  für die Katalogsuche
        //
        //******************************************************************************
        
        func ShowSearchValue()
            txt_Set(FONT_SIZE,FONT4);
            txt_Set(TEXT_COLOUR,WHITE);
            txt_Set(TEXT_OPACITY,OPAQUE);
            txt_MoveCursor(8,6);
            print("          ");
            //nun den Cursor
            txt_MoveCursor(8,6+digit);
            print("_");
            
            txt_Set(TEXT_OPACITY,TRANSPARENT);
            txt_MoveCursor(8,6);
            print([STR] KatNum);
            txt_Set(TEXT_OPACITY,OPAQUE);
        
        endfunc
        
        
        func ShowSearchWin()
        var handle;
            handle:= file_Open("SuDlg_1.gci", 'r');               //Open File for reading 
            file_Image(30,100,handle) ;
            file_Close(handle) ;
        
            handle := file_Open("Backsp.GCI",'r') ;
            file_Image(1,290,handle) ;
            file_Close(handle);
         
        endfunc
        
        func SearchKatalog(var num)
        var bpnext; 
        var ind;
        var p;
        var a;
        
            file_Rewind(F);
            txt_Set(FONT_SIZE,FONT3);
            file_Index(F,0,FILE_RECL,recno);
        
            //Hier den Datensatz lesen und zerschneiden
            file_GetS(rec,130,F);
            ind := 0;
        
            // Point to string to extract sub-strings from
            bpnext := str_Ptr(rec);
            repeat
                if((bpnext:=GetNextSub(bpnext, mysub, ';')) != 0)
                    LeftTrim(mysub):
                    to(ObjInfo[ind]); print([STR] mysub);
                    ind++;
                endif
            until(bpnext == 0);
          
        
        endfunc
        
        
        
        
        
        //*******************************************************************************
        //
        //   Katalogsuche
        //
        //*****************************************************************************
        
        func DoSearch()   
        var strP2;
            key:=0;   
            ex2:=0;      //wenn 1 dann exit aus der Hauptschleife  
            digit:=0;
            
            strP2:=str_Ptr(KatNum);
            to(KatNum); print("\0\0\0\0\0\0\0\0\0\0\0");
        
            ShowSearchWin();
            ShowSearchValue();
           
            repeat 
             key:=readcom1();
             
             //Cursortasten
        
             if (key ==KEYLEFT) 
               if(digit>0) digit--;
               ShowSearchValue();
             endif;
        
             if (key ==KEYRIGHT) 
               if(digit<4) digit++;
               ShowSearchValue();
             endif;
        
              if ((key>=KEY0) &amp;&amp; (key<=KEY9))  
                str_PutByte(strP2 + digit, key);
                if(digit<4) digit++; 
               ShowSearchValue();
              endif; 
        
             if (key ==KEYF1) 
               if (digit>0) str_PutByte(strP2 + digit-1, 0x00);
               if(digit>0) digit--;
               ShowSearchValue();
             endif; 
        
        
        
             //ok Gedrückt
             if (key ==KEYOK) 
               ex2:=1;  
             endif; 
        
        
            until (ex2 == 1);              // bis Enter oder Escape gedrückt   
            LoadScreen();
        endfunc   
        
        
        
        
        //infodatei anzeigen
        
        func DisplayInfofile()
        var szL;
        var szH;
        
         to(Filename);print("M",[STR] ObjInfo1,".nfo");    //saves the filename to array   "M1.nfo"
         print([STR] Filename);                            //Debug print the filename 
         if(file_Exists(Filename))                         //check if file exists
           iFile:= file_Open(Filename, 'r');               //Open File for reading
           file_Size(iFile, &amp;szH, &amp;szL);                    //get Filesize
           file_Read(InfoFile, szL, iFile);                // Read the file fo buffer
        
           txt_Set(FONT_SIZE,FONT1);                       //Set font
           txt_Set(TEXT_COLOUR,WHITE);
           gfx_Cls();                                   
           txt_MoveCursor(1,1);                            //got top left corner 
           print([STR] InfoFile);                          //Print the buffer to screen
           k:=-1;                                          
           repeat
             k:=readcom();                                 //repeat until any key pressed  
           until (k!=-1);
         gfx_Set(BACKGROUND_COLOUR,BLACK);
         gfx_Cls();
         endif
        endfunc
        
        
        
        
        
        
        
        
        
        
        //*******************************************************************************
        //
        //   Hauptschleife
        //
        //*****************************************************************************
        
        func main()   
               
            gfx_Cls();  
            print("Datei Messier.4xe"); 
            txt_Set(FONT_SIZE, FONT2);   
            txt_Set(TEXT_OPACITY, OPAQUE); 
            txt_Set(TEXT_COLOUR, 0x07E0);
            gamma:=3;
            gammaInit24(); display_SetReg(GAMMAREG,gamma);
        
            //Arrays initialisieren
            ObjInfo[0]:= &amp;ObjInfo0[5];  
            ObjInfo[1]:= &amp;ObjInfo1[5];
            ObjInfo[2]:= &amp;ObjInfo2[20];
            ObjInfo[3]:= &amp;ObjInfo3[10];
            ObjInfo[4]:= &amp;ObjInfo4[10];
            ObjInfo[5]:= &amp;ObjInfo5[20];
            ObjInfo[6]:= &amp;ObjInfo6[10];
            ObjInfo[7]:= &amp;ObjInfo7[10];
            ObjInfo[8]:= &amp;ObjInfo8[10];
            ObjInfo[9]:= &amp;ObjInfo9[10];
            ObjInfo[10]:= &amp;ObjInfo10[10];
            ObjInfo[11]:= &amp;ObjInfo11[10];
            ObjInfo[12]:= &amp;ObjInfo12[10];
            ObjInfo[13]:= &amp;ObjInfo13[10];
            ObjInfo[15]:= &amp;ObjInfo14[10];
            ObjInfo[15]:= &amp;ObjInfo15[10];
            ObjInfo[16]:= &amp;ObjInfo16[10];
            ObjInfo[17]:= &amp;ObjInfo17[10];
        
            //Records für Filezugriff setzen
         //   I32Set(_i32frec, 0x0000, 0x0001);   // Current record number: 0x00000000
         //   I32Set(_i32fmax, 0x0000, 0x0000);   // Last record number:    0  
         //   I32Set(_i32fmin, 0x0000, 0x0001);   // Min record number:    1  
        
        
            com_Init(combuf, 2, ':' );  //Com Buffer initialisieren
        
            ex:=0;      //wenn 1 dann exit aus der Hauptschleife  
          
          
            if (!file_Mount()) print("File error ",file_Error());   
            
           // pause(2000);
            LoadBasisImages();                              //Standardbilder laden 
            LoadKatalog();
            
        
            gfx_Cls();
            
        
        
        
            ShowBaseBtn();
            readKatalog();
            ShowKatImage(1); 
            recno:=1;      //erster datensatz des Katalogs
            repeat 
        
             key:=readcom();
             
             //Cursortasten
             if (key ==KEYDOWN) 
               recno++;
               readKatalog();
             endif;
        
             if (key ==KEYUP) 
               if (recno > 0) recno--;
               readKatalog();
             endif;
        
        
             //Helligkeitseinstellungen
             if (key ==KEYC) 
               if (gamma<5) gamma++;
               display_SetReg(GAMMAREG,gamma);
             endif;
        
             if (key ==KEYD) 
               if (gamma>0) gamma--;
               display_SetReg(GAMMAREG,gamma);
             endif;
        
        
             //ok Gedrückt
             if (key ==KEYOK) 
               to(COM0);print(":G_",[STR] ObjInfo3,";",[STR] ObjInfo4,";","Messier ",[STR] ObjInfo1);
               ex:=1;  
             endif; 
        
             //Suche gedrückt
             if (key ==KEYF2) 
               SaveScreen();
               DoSearch();    //Katalogsuche
               ShowBaseBtn();
               readKatalog();
             endif; 
        
             if (key ==KEYInfo) 
               DisplayInfofile();      
               ShowBaseBtn();
               readKatalog();
             endif;
            
             if (key ==KEYF1) 
               gfx_Cls();    
               ex:=1; 
             endif; 
          
            until (ex == 1);                                    // bis Enter oder Escape gedrückt   
            
          
        endfunc   

        Comment


        • #5


          any informations yet?

          is my program too complex to run as a sub-program?

          Comment


          • #6


            Will it be fixed with PmmC 1.08?

            Comment


            • #7


              Hi Thomas, 1.08 has just been released and should fix your problem, please try it and let us know.
              http://www.websitetoolbox.com/tool/post/4d/vpost?id=3403024
              Regards,
              Dave

              Comment


              • #8


                file_Exec runs with my simple test program as 4XE without parameters but it does not return when the started program terminates.

                file_Run also works with my simple test program posted above and the program in flash restarts after the program terminates.

                file_Run also works in my large project, file_Exec does not. Maybe there are some errors with parameters in my source code. I dont like that C pointer stuff and so I'm not so familiar with that. I prefer real programming languages. ;-)

                Is there a working example available for both program parts available to see how to deal with the parameters? 

                Comment


                • #9


                  Some new findings about it?

                  Comment

                  Working...
                  X