English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. Blitz Basic

 
 
Thread Tools
Old 11 December 2016, 09:32   #1
tolkien
AmigaMan

tolkien's Avatar
 
Join Date: Oct 2012
Location: Castro Urdiales/Spain
Posts: 627
Amiblitz2 OS calls

Hello.
Reading the manual I see Amiblitz can use some os libraries internally.
I have tried to use Execute_() without result. Seems that call is ignored. I have all.res included in compiler options.
Do I need to include anything more?

I have done a quick test in C to understand how execute() works and is really easy but I do something wrong in ab.
tolkien is offline  
Old 12 December 2016, 13:08   #2
Daedalus
Registered User

Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 4,865
Hmmm, it should just work fine, I use it all the time in my code. Can you give us the exact line you use to run the command? If there's a problem with the command it should return false, but it doesn't return any return code from the command. If you use Execute_ as a statement instead of a function, you can't tell whether it ran the command or not. Bear in mind that any text output from the command you execute should be redirected somewhere - it won't go to Blitz's default output window. Also, if you're using a string variable for the command, you need to pass a pointer to the string, not the string itself.

For example:
Code:
mycommand.s = "Dir SYS: ALL >RAM:Test.txt"
succ.l = Execute_(&mycommand, 0, 0)
That *should* work, giving you a text file in RAM: containing the directory listing from your sys: partition.

However, since you're using AmiBlitz and not Blitz 2, you can also use the included includes, which provide nice wrappers around most of the OS libraries. For example, dos.include.bb2 contains the dos_RunCLI{} and dos_RunWB{} functions, one of which might help you out.

Finally, if there isn't a special reason you're using AmiBlitz 2, I'd suggest switching to AmiBlitz 3 as there are many improvements

Last edited by Daedalus; 12 December 2016 at 13:13.
Daedalus is offline  
Old 12 December 2016, 20:12   #3
tolkien
AmigaMan

tolkien's Avatar
 
Join Date: Oct 2012
Location: Castro Urdiales/Spain
Posts: 627
Hi!

Damn!!! I was trying to pass the string directly Execute_("commands...", 0, 0) or Execute_(command, 0, 0) without &.
I'm used to use pointers in C but I'm new in Blitz and didn't think about it.
Now also works dos_run_wb{} perfectly.
I think I will have to try the code in BlitzBasic2 cos is not so FPU depent. Thats the reason I dont use AB3. It needs FPU for everything!

Thanks so much Deadalus!
tolkien is offline  
Old 13 December 2016, 09:52   #4
Daedalus
Registered User

Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 4,865
No problem Yeah, the system calls need to be treated the same way in Blitz as in C - if they need a pointer in C, they need a pointer in Blitz. AmiBlitz also includes commands for returning a temporary string buffer pointer that's useful for calls like this (Null() in older versions, GetGlobalStrAddr() in the latest), but in Blitz 2.1 you need to use the address of an existing string.

Just bear in mind that AmiBlitz 2 also requires an FPU for some things. I don't know exactly where in the history that requirement came in, but it was early after it became AmiBlitz. I tend to just use AmiBlitz 3 for newer stuff and Blitz Basic 2.1 for older stuff - AmiBlitz 2 falls between those two stools so to speak.

Last edited by Daedalus; 13 December 2016 at 09:58.
Daedalus is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
App to intercept calls to df0 Mounty request.Apps 24 15 August 2014 14:49
is this possible and how. in amiblitz2,and blitz 2. JPQ Coders. General 5 14 March 2014 12:02
Any way to make ROM calls visible? pintcat support.Apps 7 26 July 2012 16:41
PC WORLD calls sensible soccer the best soccer games of all times! pbareges Retrogaming General Discussion 11 28 June 2010 09:25
Amiblitz2 code and amiga 500 ??? Tony Landais Coders. General 1 27 December 2007 19:03

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 01:25.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Page generated in 0.06358 seconds with 13 queries