BBC BASIC for Windows
« The BB4W exe environment? »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 10:11pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: The BB4W exe environment?  (Read 581 times)
19Grumpah42
Junior Member
ImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 57
xx The BB4W exe environment?
« Thread started on: Jan 5th, 2010, 04:23am »

Does the run time interpreter (is that the correct word?) in a BB4W .exe able to read normal (tokenised, optionally crunched) .BBC files? I note that it will read them if they are INSTALLed in MAIN (but only if they contain only DEF FN_ or PROC_). Could one CHAIN or RUN them from a BB4W .exe (assuming they are in the right place, of course), just as one can from the source .BBC file in the IDE?

I tried, but it doesn't seem to want to work, and the error message seemed inappropriate (could not find file or directory). I could find nothing in the manual about this possibility.

Just a simple thought. I was thinking it might be interesting to e.g. time some modules (a) in the IDE, (b) as .EXE versions, and (c) as (optionally crunched etc.) but uncompiled versions in the RTE of a host .EXE tongue

--Grahame
User IP Logged

C-2-Q 3GB, C-2-Duo 2GB, both GeForce 9500 GT, WinXP sp3. Two Linux Ubuntu boxes (rock solid, lean and mean, but they won't run BB4W!).
admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: The BB4W exe environment?
« Reply #1 on: Jan 5th, 2010, 08:58am »

Quote:
Could one CHAIN or RUN them from a BB4W .exe (assuming they are in the right place, of course), just as one can from the source .BBC file in the IDE?

Of course. Anything you can do when running in the IDE you can also do in a 'compiled' EXE.

It's rare to want to use CHAIN in a modern program (it stems from the old days when it was the only way to modularise a program to get it to fit in limited memory) but using CALL filename$ as a means of running code in a 'submodule' is absolutely fine.

Quote:
I tried, but it doesn't seem to want to work, and the error message seemed inappropriate (could not find file or directory).

More than likely the filename or the path was wrong then! You will probably want to place the CALLed (or CHAINed, if you must!) file in the same directory as the program from which it is called, so in that case you'd want to prefix the filename with @dir$.

Richard.
User IP Logged

19Grumpah42
Junior Member
ImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 57
xx Re: The BB4W exe environment?
« Reply #2 on: Jan 13th, 2010, 03:46am »

Thanks for the reply, so it's encouraging to know that it should work to CALL a .bbc from an IDE or an .exe

Not clear to me why I'm still having a hard time, though. Naturally, I had placed copies of the CALLed programme in both the source .bbc and \exe folders, and I have also tried embedding it (as "Add@dir$") at compile time for the CALLing .exe, so it could overwrite the one I had already placed there.

This is the CALLing .BBC which works fine (as does the called .BBC) in the IDE, but fails with a file find error when compiled...
:
PRINT"CALLing GEP_multiwin_colours.bbc"
PRINT "<spacebar> to start"
d%=GET
:
F$="GEP_multiwin_colours.bbc" :REM File not found as CHAIN/CALL
PRINT "About to CALL ";@dir$;F$
CALL @dir$+F$
END
:

This is the actual directory on this PC, which should be @dir$ to the .exe

P:\BBC_BASIC\EXAMPLES\GEP\exe\GEP_multiwin_colours.bbc (note word not wrapped here).

Can you see anything wrong with that (?), I'm mystified. (Did I mention, I use no line numbers and I do not abbreviate names in the compiler, for this purpose).

--G
User IP Logged

C-2-Q 3GB, C-2-Duo 2GB, both GeForce 9500 GT, WinXP sp3. Two Linux Ubuntu boxes (rock solid, lean and mean, but they won't run BB4W!).
admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: The BB4W exe environment?
« Reply #3 on: Jan 13th, 2010, 08:56am »

Quote:
Naturally, I had placed copies of the CALLed programme in both the source .bbc and \exe folders

That's not right, and I wonder if it's related to your difficulty. The CALLed program needs to be placed (by you) only in the same directory as the program from which it is CALLEd, not also in the \exe folder. If you subsequently execute your compiled program in the \exe folder then a copy of the CALLed program will be automatically put there, but you don't need to do so yourself.

Debugging this sort of problem should be straightforward. Even a 'compiled' BBC BASIC program has an 'immediate mode' available (for example that's where the END statement goes, and also where an untrapped error gets reported) so all you need to arrange is that your 'File or path not found' error isn't trapped. Then you can enter immediate commands to trace the fault.

For example you can type PRINT @dir$ to confirm that the directory is what you thought it was, then you can do OSCLI "dir """+@dir$+"""" to list all the .BBC files in that directory (which should include your CALLed file). You can even execute the CALL statement yourself, in immediate mode. The cause of the problem should be 'immediately' evident!

Before long you'll develop this skill yourself. Ease of debugging is one of the great advantages of BBC BASIC being interpreted, and having an immediate mode.

Richard.
« Last Edit: Jan 13th, 2010, 08:58am by admin » User IP Logged

19Grumpah42
Junior Member
ImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 57
xx Re: The BB4W exe environment?
« Reply #4 on: Jan 14th, 2010, 06:55am »


Thanks for the continuing assistance. It did not take me long to pick up those particular skills -- although I do appreciate the encouragement -- because I had already done that. The .bbc file is there, the .exe will just not CALL it.

I do not know how to take a copy of the .exe screen so I can paste it into a message post for you to see for yourself, that way it would not be necessary for you to waste your time speculating on possible hallucinations. Can you suggest a good way for me to send you an error report that you will recognise and be able to critique/diagnose?

I don't see that there should be any difference between me putting a .bbc file in the \exe folder, and having it put there by the .exe because I chose to embed it as an @dir$ file. Please advise.

I have taken copies of both the CALLing test_CALL_BBC.exe and the CALLed example GEP_multiwin_colours.bbc, which were in P:\BBC_BASIC\EXAMPLES\GEP\exe, and I have pasted them in the root of C:\ (lest you feel that my system configuration is "abnormal".) The .exe will still *not* CALLthe .bbc I have then taken the source of the CALLing .exe (i.e. test_CALL_BBC.bbc, located at P:\BBC_BASIC\EXAMPLES\GEP ) and copied that into the temporary C:\ location alongside the two files mentioned above. The test_CALL_BBC.bbc *does* correctly CALL the .bbc which the .exe will not.

So it seems almost indisputable to me that it is not strictly correct for you to have said "Of course. Anything you can do when running in the IDE you can also do in a 'compiled' EXE." because in this case I cannot. Is this a personal prejudice (?) I doubt it.

Any further ideas, anybody? It might be very helpful if someone else could just try to CALL a valid .bbc from an .exe file, all it should take is one line in the otherwise empty caller .....

CALL @dir$+"my_test_programme.bbc"

--Grahame
User IP Logged

C-2-Q 3GB, C-2-Duo 2GB, both GeForce 9500 GT, WinXP sp3. Two Linux Ubuntu boxes (rock solid, lean and mean, but they won't run BB4W!).
admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: The BB4W exe environment?
« Reply #5 on: Jan 14th, 2010, 09:47am »

Quote:
I do not know how to take a copy of the .exe screen so I can paste it into a message post for you to see for yourself

As a graphics image it's Alt+PrintScreen and as a text file it's Ctrl+Tab (so long as you're using a monospaced font):

http://www.bbcbasic.co.uk/bbcwin/manual/bbcwin3.html#capturing

Quote:
I don't see that there should be any difference between me putting a .bbc file in the \exe folder, and having it put there by the .exe because I chose to embed it as an @dir$ file. Please advise.

It's not that there is a difference, exactly, but my concern was that if you thought it was necessary to copy the BBC file into the \exe folder manually it indicated a misunderstanding. Since you would always want to embed the file (or achieve the equivalent functionality using an installer) it ought never to be necessary to copy it manually.

Quote:
So it seems almost indisputable to me that it is not strictly correct for you to have said "Of course. Anything you can do when running in the IDE you can also do in a 'compiled' EXE."

When you execute your program from the IDE you are actually using exactly the same interpreter (and run-time environment) that you use when you run it as an executable (assuming none of the crunch options was enabled). That's the critical point about BBC BASIC which I think you're missing: the 'compiler' simply combines the interpreter and your BASIC program into an EXE file. Once that file is run there basically is no difference in what is running in memory between the two cases. That's why I can so confidently say that any program that runs under the IDE can run when compiled, since the end result is the same.

Of course that's not to say that you couldn't contrive to write a program that ran only under the IDE. You could for example write it in such a way that it tested for the presence of the IDE window, or checked the size of its own executable, or any of a myriad other ways. But it's very hard to imagine how you might do that accidentally!

Quote:
It might be very helpful if someone else could just try to CALL a valid .bbc from an .exe file

This is what I did:

CALLTEST.BBC
Code:
      CALL @dir$+"BONG" 

BONG.BBC
Code:
      ENVELOPE 1,1,0,0,0,0,0,0,126,0,0,-1,126,126
      SOUND 1,1,100,1 

Compiled CALLTEST.BBC to CALLTEST.EXE. On running, it makes a 'bong' sound.

Richard.
« Last Edit: Jan 14th, 2010, 10:04am by admin » User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls