12 September 2018, 12:39 | #1 |
research
Join Date: May 2018
Location: Germany
Posts: 21
|
Detect dos.library/RT_INIT 'done' in BootBlock
Hi,
I'm trying to get used to m68k assembler and developed a "Hello World!" boot block in assembler. It creates a MemList for a task that uses the intuition.library to display a window with a boolean gadget with text... Seems to work fine with all the Amiga Forever 7.2 ROMs. ...but, my task is running while the dos.library init code is running. Now I'm trying to start the Workbench with dos.library/CreateProc(exec.library/FindResident("workbench.task") + sizeof(Resident)) (the undocumented LoadWB 1.x style, that is also working with 2.x and 3.x ROMs that include the Workbench) when the user clicks the boolean gadget instead of the close gadget. This works as long as the click/call is made after the Initial CLI has been opened. If one manages to click too early, this will raise an alert - which seems to be caused by using a half-initialized dos.library. I already tried to wait until the "exec.task" can no longer be found (dos.library/RT_INIT seems to call exec.library/RemTask(NULL) at the end). But this also does not work / still seems to be too early. 1) Is there a safe way to detect if dos.library is 'ready' after RT_INIT? 2) Is there another way to run the code at the 'right' time? --- Update 1 --- After some research and testing, I found a quite 'reliable' workaround for 2.x/3.x ROMs. The Initial CLI process calls exec.library/InitCode() for the 'AFTERDOS' modules after the dos.library fields are more or less initialized, and before the preferences are read and the ":S/startup-sequence" is used as input. One of this modules is the "ramlib" module, which creates a process with the same name, that runs forever in a message loop. Therefore, waiting for a "ramlib" task allows to 'sync' to the dos.library initialization. However, a) AROS has no "ramlib" module b) 1.x "ramlib" module does not start a "ramlib" process c) it's still a bad idea to start the Workbench while the Initial CLI executes the startup-sequence (the user might have copied the Workbench disk files into the disk image) --- Update 2 --- Source code updated. Fixed non-scratchable registers save/restore (I got the MOVEM order wrong). --- Many thanks in advance for any hints and comments, Nico Last edited by NicoDE; 18 September 2018 at 09:47. Reason: fixed non-scratchable registers save/restore |
12 September 2018, 12:48 | #2 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,322
|
What happens if you wait until a call to OpenLibrary("dos.library") succeeds ?
|
12 September 2018, 13:07 | #3 | |
research
Join Date: May 2018
Location: Germany
Posts: 21
|
Quote:
I also tried using dos.library/Delay from the task (I'm not sure if this is allowed in a task), and it freezes the task. That's the reason why I assume that the dos.library is the root of the problem and not the 'workbench.task'... I have not enough experience with the Amiga development (yet ) and don't know how to debug/trace the problem in WinUAE. Last edited by NicoDE; 12 September 2018 at 13:14. |
|
12 September 2018, 13:17 | #4 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,322
|
Have you tried to detect the presence of the initial CLI ?
|
12 September 2018, 13:36 | #5 |
research
Join Date: May 2018
Location: Germany
Posts: 21
|
I'll give it a try tonight - but I guess that the dos.library/RT_INIT code calls start(NULL) to run the initial CLI, and that the CLI initialization code is initializing the internal dos.library structures (and therefore it might still be too early, if I only check for the presence of any CLI task in the public dos.library fields).
If there is no 'safe' way, I still could develop a LoadWB replacement and include it in the disk image (seems to be the most compatible way to go). |
12 September 2018, 13:43 | #6 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,322
|
Why not just use loadwb ? What's the constraint that forces you to put your code in the bootblock rather than in the startup-sequence ?
|
12 September 2018, 13:51 | #7 | |
research
Join Date: May 2018
Location: Germany
Posts: 21
|
Quote:
It would have been nice to have all the code in the boot block, but the more I think about it, it makes more sense to develop my own LoadWB (to avoid copyright issues). The basic idea is to provide a disk image that says Hello from the boot block and includes the CLI/WB application on the disk to say Hello from the running DOS (it's easier for the user if the Workbench is running and he/she can just open the disk icon to run the HelloAmi program). Still, any background information is welcome |
|
12 September 2018, 13:59 | #8 |
Semi-Retired
Join Date: Mar 2012
Location: Leiden / The Netherlands
Posts: 1,993
|
Wasn't it common practice to do FindResident("dos.library") to check for an initialized dos.library? Something vague rings a bell.
|
12 September 2018, 19:52 | #9 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,502
|
This seems to be tricky problem. For some reason dos seems to do AddLibrary("me") very early, before it is fully initialized.
This is what boot blocks do, FindResident("dos.library") starts dos.library (if it has not been started yet) which probably is not what you want to do while dos library is still getting initialized. |
13 September 2018, 10:46 | #10 |
ex. demoscener "Bigmama"
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,624
|
|
13 September 2018, 14:33 | #11 | |
Registered User
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 55
Posts: 1,957
|
Quote:
http://wt.exotica.org.uk/whdload.html |
|
13 September 2018, 20:29 | #12 | |
Registered User
Join Date: May 2017
Location: Munich/Bavaria
Posts: 2,294
|
Quote:
http://aminet.net/package/dev/misc/ExtFuncProc "Allows execution of any library function from simple tasks even if these functions require a process environment." |
|
14 September 2018, 17:19 | #13 | |||
research
Join Date: May 2018
Location: Germany
Posts: 21
|
Quote:
Quote:
Quote:
--- After some research and testing, I found a quite 'reliable' workaround for 2.x/3.x ROMs. The Initial CLI process calls exec.library/InitCode() for the 'AFTERDOS' modules after the dos.library fields are more or less initialized, and before the preferences are read and the ":S/startup-sequence" is used as input. One of this modules is the "ramlib" module, which creates a process with the same name, that runs forever in a message loop. Therefore, waiting for a "ramlib" task allows to 'sync' to the dos.library initialization. However, a) AROS has no "ramlib" module b) 1.x "ramlib" module does not start a "ramlib" process c) it's still a bad idea to start the Workbench while the Initial CLI executes the startup-sequence (the user might have copied the Workbench disk files into the disk image) So I'll abandon the idea of running the Workbench from the boot block, and will develop my own LoadWB. I updated the attached source code in the initial post. Last edited by NicoDE; 17 September 2018 at 17:57. |
|||
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Open-source dos.library | Don_Adan | Coders. System | 273 | 02 September 2020 00:42 |
Looking for a utility disk with great bootblock music (DOS format) | BastyCDGS | request.Apps | 1 | 21 January 2016 03:17 |
execute function from dos.library | Foul | Coders. Asm / Hardware | 5 | 08 August 2012 17:56 |
dos.library Open() hangs | MrD | Coders. Asm / Hardware | 15 | 24 July 2012 19:55 |
Dos.library question. | Thorham | Coders. General | 2 | 11 January 2011 21:03 |
|
|