English Amiga Board


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

 
 
Thread Tools
Old 15 September 2019, 13:57   #1
Nightshft
Registered User
 
Nightshft's Avatar
 
Join Date: Mar 2018
Location: Austria
Posts: 617
CloseWorkbench_

Hi everyone,
since a week I'm checking out Blitzbasic2 - which is new for me and it's quite cool.

Two sourcecodes I found do this at the very beginning (directly after WBStartup):
Code:
For i=1 To 100:CloseWorkBench_:Next
Which of course means, you can't go back to workbench at "end".

Why are they doing this - to free chipram for the program?
The screen also is flashing for some seconds.
Nightshft is offline  
Old 15 September 2019, 16:15   #2
Daedalus
Registered User
 
Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
Yep, it's usually done to save on chip RAM - if there's a colourful Workbench screen open it could be using a significant amount of chip RAM. I don't know why they call it 100 times though, I would expect a more elegant approach to be to call it as a function and act on the response (it returns true if it was successful).

You should be able to go back to Workbench at the end if you do a corresponding OpenWorkBench_() at the end of the program, before you quit.
Daedalus is offline  
Old 15 September 2019, 16:45   #3
Nightshft
Registered User
 
Nightshft's Avatar
 
Join Date: Mar 2018
Location: Austria
Posts: 617
For now I've commented it out, and returning to WB works fine. But this is on a WinUae profile with lots of ram. Will take a look at the chipram with and without. Thanks Daedalus!
Nightshft is offline  
Old 18 September 2019, 20:43   #4
Nightshft
Registered User
 
Nightshft's Avatar
 
Join Date: Mar 2018
Location: Austria
Posts: 617
Quote:
Originally Posted by Daedalus View Post
...
You should be able to go back to Workbench at the end if you do a corresponding OpenWorkBench_() at the end of the program...
So in Blitz you can use all the system library functions, by adding an "_"?

I found this big list at the autodocs. I'm curious what the most used / useful system calls are?


PS: I plan to check out how much chipram closeWorkbench() frees, and if the return value can be used reliably to open it again or not. And I will be counting how many of these 100 calls it needs to close! Lol
Nightshft is offline  
Old 19 September 2019, 09:48   #5
Daedalus
Registered User
 
Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
Quote:
Originally Posted by Nightshft View Post
So in Blitz you can use all the system library functions, by adding an "_"?
Well, you can use the ones that have had keywords created for them. The Blitz manual lists the default ones, specifically exec.library, dos.library, graphics.library, intuition.library and diskfont.library, so all of the calls in the Autodocs for those libraries (IIRC up to release 3.0) are useable. Bear in mind however that the OS calls aren't generally as simple to use as Blitz commands, with most requiring pointers to objects in memory instead of Blitz object numbers.

Quote:
I found this big list at the autodocs. I'm curious what the most used / useful system calls are?
As above, the libraries mentioned are all useful, and you can add other libraries to Blitz by using the tools included with Blitz and providing the .fd file for the library. This will give you the library's calls with an underscore appended as a new Blitz library that you can add to the command set.

Quote:
PS: I plan to check out how much chipram closeWorkbench() frees, and if the return value can be used reliably to open it again or not.
It's a technique used frequently by programs that need an extra bit of memory, like paint programs etc. The actual amount freed depends on the resolution and number of colours used for the Workbench screen, so it will be more or less significant depending on your setup.
Daedalus is offline  
 


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

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 18:42.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.09590 seconds with 14 queries