English Amiga Board


Go Back   English Amiga Board > Coders > Coders. System

 
 
Thread Tools
Old 12 September 2018, 12:39   #1
NicoDE
research
 
NicoDE's Avatar
 
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
Attached Files
File Type: s HelloRom.s (12.9 KB, 114 views)

Last edited by NicoDE; 18 September 2018 at 09:47. Reason: fixed non-scratchable registers save/restore
NicoDE is offline  
Old 12 September 2018, 12:48   #2
meynaf
son of 68k
 
meynaf's Avatar
 
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 ?
meynaf is offline  
Old 12 September 2018, 13:07   #3
NicoDE
research
 
NicoDE's Avatar
 
Join Date: May 2018
Location: Germany
Posts: 21
Quote:
Originally Posted by meynaf View Post
What happens if you wait until a call to OpenLibrary("dos.library") succeeds ?
Already tried it (sorry, forgot to mention it). Still results in an alert if CreateProc is called right after opening the dos.library sucessfully.

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.
NicoDE is offline  
Old 12 September 2018, 13:17   #4
meynaf
son of 68k
 
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,322
Have you tried to detect the presence of the initial CLI ?
meynaf is offline  
Old 12 September 2018, 13:36   #5
NicoDE
research
 
NicoDE's Avatar
 
Join Date: May 2018
Location: Germany
Posts: 21
Quote:
Originally Posted by meynaf View Post
Have you tried to detect the presence of the initial CLI ?
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).
NicoDE is offline  
Old 12 September 2018, 13:43   #6
meynaf
son of 68k
 
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,322
Quote:
Originally Posted by NicoDE View Post
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).
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 ?
meynaf is offline  
Old 12 September 2018, 13:51   #7
NicoDE
research
 
NicoDE's Avatar
 
Join Date: May 2018
Location: Germany
Posts: 21
Quote:
Originally Posted by meynaf View Post
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 ?
I'm just trying to get used to the way how the Amiga ROM and DOS work
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
NicoDE is offline  
Old 12 September 2018, 13:59   #8
Hedeon
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.
Hedeon is offline  
Old 12 September 2018, 19:52   #9
Toni Wilen
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.

Quote:
Originally Posted by Hedeon View Post
Wasn't it common practice to do FindResident("dos.library") to check for an initialized dos.library? Something vague rings a bell.
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.
Toni Wilen is online now  
Old 13 September 2018, 10:46   #10
hooverphonique
ex. demoscener "Bigmama"
 
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,624
Quote:
Originally Posted by NicoDE View Post
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.
If memory serves me right, in general you can't do dos-stuff from a task, it has to be a full process.
hooverphonique is offline  
Old 13 September 2018, 14:33   #11
Don_Adan
Registered User
 
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 55
Posts: 1,957
Quote:
Originally Posted by Hedeon View Post
Wasn't it common practice to do FindResident("dos.library") to check for an initialized dos.library? Something vague rings a bell.
Yes, this is perhaps good way. If i remember right OnePlayControlProgram from Arcadia Systems is good example for correctly initialisation dos.library for similar case.

http://wt.exotica.org.uk/whdload.html
Don_Adan is offline  
Old 13 September 2018, 20:29   #12
Gorf
Registered User
 
Gorf's Avatar
 
Join Date: May 2017
Location: Munich/Bavaria
Posts: 2,294
Quote:
Originally Posted by hooverphonique View Post
If memory serves me right, in general you can't do dos-stuff from a task, it has to be a full process.
There is a workaround:

http://aminet.net/package/dev/misc/ExtFuncProc

"Allows execution of any library function from
simple tasks even if these functions require a process environment."
Gorf is offline  
Old 14 September 2018, 17:19   #13
NicoDE
research
 
NicoDE's Avatar
 
Join Date: May 2018
Location: Germany
Posts: 21
Quote:
Originally Posted by Hedeon View Post
Wasn't it common practice to do FindResident("dos.library") to check for an initialized dos.library? Something vague rings a bell.
I'm doing this right in the beginning (when the dos.library is not yet initialized).

Quote:
Originally Posted by Don_Adan View Post
Yes, this is perhaps good way. If i remember right OnePlayControlProgram from Arcadia Systems is good example for correctly initialisation dos.library for similar case.

http://wt.exotica.org.uk/whdload.html
I never used WHDLoad and don't know how to get any information out of the two binary files

Quote:
Originally Posted by Gorf View Post
There is a workaround:

http://aminet.net/package/dev/misc/ExtFuncProc

"Allows execution of any library function from
simple tasks even if these functions require a process environment."
Thanks, I'll have a look at it.

---

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.
NicoDE 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
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

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 06:59.

Top

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