Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 12:35 25 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : MERGE command question

Author Message
BobDevries

Senior Member

Joined: 08/06/2011
Location: Australia
Posts: 266
Posted: 01:30am 24 Feb 2012
Copy link to clipboard 
Print this post

Hi all,

QUESTION: Is the MERGE command suitable for use inside a programme?

I have tried to do this, and it seems that while the merge does take place; that is, the requested file is added to the end of the programme space, the programme doesn't run beyond that command, or, the MERGE puts the programme pointer at the end of the BASIC programme in memory, which then quits silently.


MERGE "ISLEGAL.SUB":REM name of subroutine on SD card

for x=1 to 10
print x;
next x


Comments?

Regards,
Bob Devries
Dalby, QLD, Australia
 
BobDevries

Senior Member

Joined: 08/06/2011
Location: Australia
Posts: 266
Posted: 01:32am 24 Feb 2012
Copy link to clipboard 
Print this post

hehe,

I guess what I'm asking is: Is this a BUG or a FEATURE?

Regards,
Bob Devries
Dalby, QLD, Australia
 
djuqa

Guru

Joined: 23/11/2011
Location: Australia
Posts: 447
Posted: 01:44am 24 Feb 2012
Copy link to clipboard 
Print this post

feature
MERGE is designed to create a runnable / usable program from snippets / short programs. (especially useful for Defined subroutines)

Merge is not designed to be a RUNTIME command.Edited by djuqa 2012-02-25
VK4MU MicroController Units

 
James_From_Canb

Senior Member

Joined: 19/06/2011
Location: Australia
Posts: 265
Posted: 07:18am 01 Mar 2012
Copy link to clipboard 
Print this post

I've edited this post to take out an example of the Merge not working as I expected.

After a bit more experimentation I agree that MERGE is not designed to be included in the code and executed. If you run the program multiple times, it adds multiple copies of the merge code at the end of the user code. If you run it once, it adds the merge code once, but just returns to the command prompt. That means it won't execute properly the first time. You could run it a second time and use a flag to check whether the library has already been merged, but running a program twice is not intuitive for users.

If the merge is designed to work from the command prompt the user will have to know which libraries to add before running the program. Subroutines could be worse as there are likely to be more of them if they're not in a library.

Given that there is no batch file support, does anyone have any suggestions on how the libraries/subroutines can be loaded without input by the users?

Thanks

JamesEdited by James_From_Canb 2012-03-02
My mind is aglow with whirling, transient nodes of thought careening through a cosmic vapor of invention.

Hedley Lamarr, Blazing Saddles (1974)
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024