Announcement

Collapse
No announcement yet.

Global variables for Flashbanks

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

  • Global variables for Flashbanks

    Hello,

    I have been having trouble migrating a part of my code to a new flashbank. I have very different parts in my program that run almost independently, mode 0 and mode 1. Therefore as i ran out of space (32717 bytes out of 32750) in FB0 my idea is to migrate the mode 1 to a different flashbank. This mode 1 has its own global variables that I would like to use in flashbank2.

    Global variables are allocated when a program starts, but functions called in banks never 'start' so there is no opportunity to allocate them with the required persistence.

    To use global variables in a bank pass a pointer to them from the main bank. Either use normal global memory from Bank 0, or use mem_Alloc'd memory. define it as an array and have indexes named and defined in an inherited file.
    I found this in the forum but I do not understand how. Could I have global variables shared with all the Flashbanks? Can I have Global variables for my different flashbanks and if needed share them through flash_exec?

    Using flash_Exec(2,arglist) can pass and "receive" my variables to the flashbanks.

    var params[2];
    params[0]:=1;
    params[1]:=hndl;
    txt_MoveCursor(1,1);

    flash_Exec(2,params) ;
    then I enter to FB2 inheriting the variables in the params to the main, if I call a function from the main passing some of this variables it can be used but if want that function to call another function, use these variables and change the values how can I do it? They are not visible for this last function right? Using global variables this would be solved...

    I am not sure i explained myself properly.

  • #2
    Good day,

    The global variables in your subprogram cannot be shared with other subprograms. I would suggest passing values to subprograms. You can use the flash_Exec() function to pass the values.

    Click image for larger version

Name:	asg.png
Views:	26
Size:	2.3 KB
ID:	75204

    You can go to this link for your reference Visi: Passing arguments to child programs

    I modified the sample project in the link above for your reference.

    I hope this helps.

    Best regards

    Comment

    Working...
    X