![]() |
Forum Index : Microcontroller and PC projects : Introducing: GUI Editor for the PicoMiteVGA
![]() ![]() ![]() ![]() |
|||||
Author | Message | ||||
Amnesie Guru ![]() Joined: 30/06/2020 Location: GermanyPosts: 666 |
As it seems there is a bigger problem - I mean in general. phil99 even your suggested example program with the envelope generator does not work at all. No dim "already declared" error of course, but it is only printing this: Print "This is envelope generator.bas" Print "This is envelope generator.bas" Print "This is envelope generator.bas" Print "This is envelope generator.bas" Print "This is envelope generator.bas" nothing other... I tried my own simple Chain program (not the gui program) and did some debugging with print statements it seems that I NEVER EVER leave the main program but if the interpreter sees the CHAIN it only jumps to the start of the main program. Then I thought ok, let's don't put those files on B: drive and do everything exactly like phil99, so I copy it do drive "A:", same! Doesn't work. Another problem (maybe normal?) I wasn't able to CTRL+C - can't abort the program, I must do a hard reset of the device... My guess is that there is something very wrong in general?! I can't be that dumb ![]() ? MM.INFO(Path) gives me: NONE Greetings Daniel Edited 2025-07-11 03:32 by Amnesie |
||||
Peter63 Regular Member ![]() Joined: 28/07/2017 Location: SwedenPosts: 92 |
If this not work (see last post on page 2), i'am lost in space... 1. LIBRARY DELETE 2. LOAD "saveRoutine.bas" 3. LIBRARY SAVE /Peter63 |
||||
Amnesie Guru ![]() Joined: 30/06/2020 Location: GermanyPosts: 666 |
Peter63, thanks for this idea, but I deleted the library way before my CHAIN testing - because I was aware that this could lead to conflicts! The good thing is: I am NOT to stupid. The problem wasn't me, it was a bug in the firmware (I guess, please don't hit me Peter (Mather)!) I was using the PicoMiteVGA firmware release candidate 24 (?) if I remember correctly. I thought, I can't be that dumb, it MUST work. And it does! I updated my firmware to the lastest release and now it works.... Argh! Was this chain problem a known error in the release candidates?!?! Whatever.. now it works! Remember Daniel.... Aaaaalways use the latest firmware. ![]() EDIT:Ha!! I tried "? MM.INFO(PATH) again and now it doesn't show "NONE" but the correct drive! So it is confirmed, that there was something wrong with the release candidate firmware. At least it is very likely. Greetings Daniel Edited 2025-07-11 03:54 by Amnesie |
||||
Peter63 Regular Member ![]() Joined: 28/07/2017 Location: SwedenPosts: 92 |
Forget what I wrote when I talked about LIBRARY DELETE, you're talking about CHAIN, I'm sorry... /Peter63 |
||||
Amnesie Guru ![]() Joined: 30/06/2020 Location: GermanyPosts: 666 |
Ok, now I've played a bit with Chaining and in my case it isn't working without huge workarounds. As said, in general it now works. But there still is the "already declared" problem with the global variables. I tried ON ERROR SKIP [nn], which works fine, but is annoying to count all the variables which I want to skip ([nn]). Then I tried it with an If-Statement which is set by the saving routine Pseudocode: If skip=0 Then Option Explicit Dim integer Dim ... EndIf With this I run into the problem that some variables seems to be "undefined" when back from CHAINed program and have huge values like 12334256234635, which gives an Error. It all seems for me that this is doable, but with huge workarounds in cornercases. Of course there is still the option, that I am just to stupid to integrate it somewhat "clever". For now I follow the Library approach, since it is just working and really ease. And everyone can restore a Library (if they already use one). And since the Library isn't needed for the saved result / the final GUI, it can be deleted afterwards. But thank you Mick for the idea with Chaining, I learned something with this! If anybody really wants me to integrat it, please test and modify it yourself with my given files. If it works for you, I could adapt it ![]() Greetings Daniel Edited 2025-07-11 04:41 by Amnesie |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7934 |
This looks rather like one for matherp. AFAIK CHAIN works providing you don't CHAIN from a subroutine. You shouldn't see "variable already defined" sorts of errors unless you are attempting to redefine them. Merely using existing variables created in the main program should work. I haven't got anything set up at the moment that I can test with. I'll see if I can find something tomorrow. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10305 |
If you are using chain you need to declare all the variables in one place and then use something to know whether they have been declared or not. e.g. 'main program if mm.cmdline$<>"chainedback" then declarevariables ..... chain "nextprog" end sub declarevariables ..... end sub 'nextprog do something chain "main","chainedback" end |
||||
Amnesie Guru ![]() Joined: 30/06/2020 Location: GermanyPosts: 666 |
Thanks Peter, I'll give that a new try! ![]() Greetings Daniel |
||||
Amnesie Guru ![]() Joined: 30/06/2020 Location: GermanyPosts: 666 |
Hi Peter, I've tried it with your example and the problem persists. But first of all: In general your example works. But not with my program or my implementation of it, although I did it exactly the same. I tried the most basic example with just a few lines of code like yours - works fine. But not with my program. Even debugging everything with print commands doesn't help either. My observations: I am going in the chained program, all fine, I am going back to the main, all fine, there is no re-declaration of the variables and therefore no error, all fine, BUT then (in the main program) suddenly: ![]() ![]() Is this a CHAIN problem? I did all kind of variable checking with debugging PRINT statements. If I comment the whole line out, the problem occurs on the next line.. and so on. It is always this kind of ERROR but (if commented out) another huge number. Have you any suggestions? I attached the exact two files: gui_editor1.zip And I am not CHAINing from an sub, just from the main loop: 'MAIN LOOP START ############################################################### Do If saveClicked=1 Then 'save to file Chain "saveRoutine1" 'go to the saveRoutine.bas CLS userInterface() 'go back to user interface drawWindow() 'and draw the window again... EndIf Chaining back isn't from an sub either... So I am clueless. This time I am using the latest firmware Release Version 6.00.03 ![]() Greetings Daniel Edited 2025-07-11 21:22 by Amnesie |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10305 |
What do you get if you use MATH V_PRINT c1() before the RBOX? Is c1 float or integer? does it make a difference? OPTIONS: are you using 848 or 800? If you are please try replicating using 640, 1024, or 1280 Edited 2025-07-11 23:19 by matherp |
||||
Amnesie Guru ![]() Joined: 30/06/2020 Location: GermanyPosts: 666 |
Hi Peter, thanks for you help! c1() is integer: ![]() I tested it with Math V_Print @ this postition, is it correct? ![]() This gives me in resolution 848: ![]() And in resolution 640: ![]() I really hope that you have a clue what the problem could be. As said, in general chaining works, but not with my program, even though I implemented it exactly like your (and my) working test example... Hm. Problem is, I don't have an idea what this Error even means. EDIT: By staring at it, I think I have an idea what all this means. You've made me printing the array before the error occurs and this is showing huge numbers. I don't understand why the last of the 16 numbers are "0"... They are representing the colour palette, which is : ' read in colour's to c1(col) Restore colourPal: For col=1 To 16:Read c1(col):Next and: colourPal: Data RGB(black),RGB(blue),RGB(myrtle),RGB(cobalt) Data RGB(midgreen),RGB(cerulean),RGB(green),RGB(cyan) Data RGB(red),RGB(magenta),RGB(rust),RGB(fuchsia) Data RGB(brown),RGB(lilac),RGB(yellow),RGB(white) EDIT Nr. 2: Ok, now I think I understand the problem myself: When going back from chaining to the main program, the variables from the "saveRoutine1.bas" are preserved this time and therefore the interpreter doesn't know how to deal with the colours in array c1(). Could this be? Or are the variables from the main program preserved at all times? Greetings Daniel Edited 2025-07-12 00:01 by Amnesie |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10305 |
You need to use MATH V_PRINT to work out when c1 get corrupted. Is ever correct? Can you update the simple test program to include c1 and see if it survives in that simple scenario. We need to work out what is causing C1 to get overwritten. The fact is happens both at 848 and 640 is good as it means it isn't an issue with the 848 pinching heap. |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7934 |
I've just tested a simple chaining program on a 2040 and that seems to be generally ok but... If I dimension an array in the main program then chain, the chained program setting values in the array, it is empty on return from the chain. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10305 |
Code? |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7934 |
Print "this is the main program" If MM.CMDLINE$<>"chainret" Then Dim d(5) Dim a%=3 Dim b!=3.1415926 Dim c$="Hello World!" EndIf Print a%,b!,c$ For i = 0 To 5:Print d(i);: Next Print "" If MM.CMDLINE$<>"chainret" Then Chain "a:/p2.bas" EndIf Print a%,b!,c$ For i = 0 To 5: Print d(i);: Next Print "the end" Print "this program is chained" For i = 0 To 100 Print i;" "; Pause 10 Next Print "" a% = 99 b! = 0.001 c$ = "Smurf" d(0) = 1 d(1) = 2 d(3) = 3 d(2) = 9 Chain "a:/p1.bas","chainret" Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10305 |
Definitely a bug - works perfectly if you enable PSRAM (if you can). I think it may be a limitation in LittleFS when I try an write a large memory area which I will need to code round. UPDATE It is a bug in LittleFS - breaking the write into 1024 byte blocks it now works Edited 2025-07-12 01:43 by matherp |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7934 |
Excellent news! Nice one, Peter. :) Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10305 |
See 6.00.03 thread for update binaries |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7934 |
I'm not sure that this is fully working. I've just loaded this new version and run the above programs on it. Although the individual values cange in the CHAINed program as expected, the array gets zeroed. I didn't expect that to happen. I've also tried setting it to various values in the CHAINed program but with no change, it seems to be that the CHAIN isn't passing the array. Print "this is the main program" If MM.CMDLINE$<>"chainret" Then Print "prepared array:" Dim d(5)=(1,2,3,4,5,6) For i = 0 To 5:Print d(i);: Next Print "" 'If MM.CMDLINE$<>"chainret" Then Print "passing array:" Chain "a:/q2.bas" EndIf Print "returned array:" For i = 0 To 5: Print d(i);: Next Print "" Print "the end" Print "this program is chained" For i=1 To 6 d(6-i) = i Next Chain "a:/q1.bas","chainret" Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
Amnesie Guru ![]() Joined: 30/06/2020 Location: GermanyPosts: 666 |
Update: This version now works with CHAINing and therefore no Library usage is needed. If you used the previous versions with Library, make sure you deleted the Library first before using the new version of the Gui-Editor. gui_editor.zip Greetings Daniel |
||||
![]() ![]() ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |