|
Post by scalion on May 24, 2018 11:36:05 GMT 1
Hello friends, I have a real big problem. In a procedure who have long parameter variable and long local variable i can't swap local var with param var... and the values change !!! If the variable is static there's no problem, strange isnt'it?
And that's generate an acces-violation error AFTER the proc finished.. omg why !! I avoid this problem by a simple intermediary variable for swapping or static var but i would like to know where this error comes from and I did not find it. Can someone help me ?
TestSwap Rand(1000), Rand(1000) Proc TestSwap(A%, B%) Local Long C, D ' If i replace local C,D by static C,D there's no error. Local String report
C = Rand(1000) D = Rand(1000)
report = "non-mixte swaping :"#13#10"Before : A=" & A & " B=" & B & " C=" & C & " D=" & D Swap A, B Swap C, D report = report & #13#10"After : A=" & A & " B=" & B & " C=" & C & " D=" & D
report = report & #13#10#13#10"swaping local with param : "#13#10"Before : A=" & A & " B=" & B & " C=" & C & " D=" & D Swap A, C Swap B, D report = report & #13#10"After : A=" & A & " B=" & B & " C=" & C & " D=" & D
Message report
EndProc
|
|
|
Post by scalion on Jun 2, 2018 10:36:43 GMT 1
Thank's for your reply, Yes that's work fine with variant, but i need a byval function. In fact i just want to know what's do gfa in internal. i tested with disasm then i look : 06910C76: scall SWAP4 06910C7C: call dpt -76[ebp] 06910C7F: lea eax,24[ebp] 06910C82: push eax 06910C83: add eax,-24 <----- not work 06910C86: push eax 06910C87: scall SWAP4 06910C8D: call dpt -76[ebp] Ther's an error... that's not add we need but lea. The cause is the gfabasic optimisation of multiple swap not working when local var mixed with param. But the way to turn around this pb is simple : using static var, or if need a global. Thank you, et passez une bonne journée cher compatriote
|
|
|
Post by dragonjim on Jun 9, 2018 13:57:38 GMT 1
Bonjour scalion,
This is an interesting error and I like your workaround of using Static instead of Local. My suspicions that this is a compiler rather than OCX library error has been confirmed which means that it will not be fixed in the near future, and so I shall amend the help file accordingly.
|
|
|
Post by scalion on Jun 9, 2018 20:50:18 GMT 1
Hi Dragonjim,
Do you know who is the actual develloper of GFA-Basic ? And Where can I find the GFA-Basic source code in the best case ? Good night and have good week.
|
|
|
Post by dragonjim on Jun 13, 2018 12:55:42 GMT 1
Bonjour scalion, The answer to your first question is here. However, it is always better to address issues and questions to this forum. The answer to your second question is that there is no freely available, annotated copy of the source code. You can use a disassembler but these files are rather large...
|
|
|
Post by scalion on Jun 13, 2018 21:03:02 GMT 1
Frank Ostrowki was a real genius, writing his programs directly in assembler. I found the sources of GFABasic atari, I will end up getting the GfaBasic32 i hope...
Thank's for the link.
|
|
|
Post by Roger Cabo on Nov 1, 2020 18:31:17 GMT 1
You can use Naked then it works well. But you should read what naked does.
TestSwap(1, 10)
Proc TestSwap(A%, B%) Naked
Local C%, D% Local report$
C = 30 D = 40
report = report & "swaping local with param : "#13#10"Before : A=" & A & " B=" & B & " C=" & C & " D=" & D Swap B, D report = report & #13#10"After : A=" & A & " B=" & B & " C=" & C & " D=" & D
MsgBox report
EndProc
|
|