No announcement yet.

How to use #MODE RUNFLASH in other flashbanks (always downloading to flashbank 0)

  • Filter
  • Time
  • Show
Clear All
new posts

  • How to use #MODE RUNFLASH in other flashbanks (always downloading to flashbank 0)


    I want to have two different programs in two different flashbanks, so my idea is to use flash_Run to do so. I currently use flash_Exec for some functions but it is growing too much.

    The problem is that the program is too big (32000 bytes for flash and 16k for ram) and if i put it in FB0 with #MODE RUNFLASH it goes well. I try to do the same with FB2 changing in ViSi the destination flashbank but it goes straight to Flashbank 0, then if i write #MODE FLASHBANK_2 it says "The program is too large to run from RAM, try running anyway? RAM is 48k of 32k.

    How can I successfully write my two program in two different flashbank?

  • #2
    Hello there,

    To write to a specific FlashBank, you can choose the bank in the 'Project' tab in Workshop4. After loading the programs onto their each bank you should be able to use flash_Run with no issues.

    Click image for larger version

Name:	Screenshot 2021-03-11 154128.png
Views:	36
Size:	23.2 KB
ID:	75186



    • #3
      I tried this and it does not work, it goes to the FlashBank0 anyway. If you put your mouse on top of the flashbanks it says it only affects the filename generated when destination is uSD.Click image for larger version

Name:	error_fb.PNG
Views:	28
Size:	23.1 KB
ID:	75188
      I found the way here: but I have not tested it. I am faking a main loop with a while and flash_Exec now because runFlash restarts the processor and if I can not use global variables in other flashbanks it's not of real use... Any idea?


      • #4
        For ViSi programs the destination flashbank is set my


        or whatever.

        The destination should be set to Flash and this should remove the warning message.

        Flash_Run runs a program in another bank, it cannot return as the processor restarts to run the program in that bank

        Flash_Exec calls another bank and parameters and variables can be passed and returned.

        You cannot have global variables in called banks as these would need to be 'allocated' at the time the main program starts, and since the main program has no idea what banks might or might not be called, or any details about those banks this is not possible.

        You can effectively create global variables in your main program and pass their addresses to the called banks. Look at File, Samples, Diablo Designer, FlashCalled and FlashExec