Does using DOS/Exit work?
  • Butterfly
    Butterfly
    munk
    Posts: 94 from 2006/3/27
    Hello!

    I would like to continue using programs that utilize arp.library .-) That works for programs that only use the FileRequester. However, unfortunately programs using ArpExit "hang". That function builds a code fragment on the stack to close DOS and from there(!) it calls DOS/Exit. The code fragment on the stack *is* executed as I could verify with my old monam2. But it seems Dos/Exit doesn't terminate the program. Should that work or is that function not implemented?
  • »31.03.06 - 09:09
    Profile
  • MorphOS Developer
    Piru
    Posts: 576 from 2003/2/24
    From: finland, the l...
    The thing is that dos/Exit() is not implemented at all. It is documented to be used by BCPL only (and BCPL is not supported in MorphOS).

    Here's a relevant part of the dos autodoc:
    Quote:

    Exit() is currently for use with programs written as if they
    were BCPL programs. This function is not normally useful for
    other purposes.

    In general, therefore, please DO NOT CALL THIS FUNCTION!



    However, since it apparently seems to have some other uses, I'll look into implementing this for future MorphOS release. If you really MUST have this for 1.4.5 too, I could hack some small patch that adds it. Stay tuned.
  • »31.03.06 - 12:18
    Profile
  • MorphOS Developer
    Piru
    Posts: 576 from 2003/2/24
    From: finland, the l...
    Quote:

    Quick'n'dirty dos.library Exit() patch for MorphOS.
    Written by Harry "Piru" Sintonen <sintonen@iki.fi>.

    Execute with 'run <>nil: exitpatch'. You can place this command to
    user-startup.

    There is no way to exit the patch, and it will happily install multiple
    times. The patch will only try to patch dos.library version 50.x.

    99.9% of users don't need this patch. It only helps with apps that
    insist on using age old and obsolete Exit() dos.library function.

    - Piru


    Download it from: exitpatch.lha
  • »31.03.06 - 12:53
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    Posts: 157 from 2003/3/3
    Hmm.. And some people talk about MorphOS not been developed 8-D
    http://somequicknotes.blogspot.com/index.html
  • »31.03.06 - 14:52
    Profile
  • Butterfly
    Butterfly
    munk
    Posts: 94 from 2006/3/27
    Quote:

    Piru wrote:
    The thing is that dos/Exit() is not implemented at all. It is documented to be used by BCPL only (and BCPL is not supported in MorphOS).

    That does explain the seen behaviour. Funny that ARP (the AmigaDOS Replacement Project) used a BCPL function ;-)

    Quote:

    Here's a relevant part of the dos autodoc:
    Quote:

    In general, therefore, please DO NOT CALL THIS FUNCTION!


    I didn't know that passage but then I never looked it up anyway.

    Quote:

    However, since it apparently seems to have some other uses, I'll look into implementing this for future MorphOS release. If you really MUST have this for 1.4.5 too, I could hack some small patch that adds it. Stay tuned.

    As mentioned earlier arp.library/ArpExit uses it. I don't know if that qualifies as "other uses".

    Quote:

    Piru wrote:
    Quote:

    Quick'n'dirty dos.library Exit() patch for MorphOS.


    I am impressed! I didn't expect such a fast response. IMHO your patch looks fine. I have to admit that I thought about similiar code myself. Maybe its better to replace the Exit() call within arp.library with your patch code. That should work as well on all systems. What do you think? Apperently nobody missed Dos/Exit function so far.

    And one technical question about your patch: Does clearing cli_Module works as well? Then run won't be needed.
  • »31.03.06 - 15:54
    Profile
  • MorphOS Developer
    Piru
    Posts: 576 from 2003/2/24
    From: finland, the l...
    Quote:

    Maybe its better to replace the Exit() call within arp.library with your patch code. That should work as well on all systems. What do you think?

    Would work assuming you can somehow fit the code in there.

    Quote:

    And one technical question about your patch: Does clearing cli_Module works as well? Then run won't be needed.

    It does work. I was in a hurry so I wouldn't bother with such details. ;-)
  • »31.03.06 - 18:13
    Profile
  • MorphOS Developer
    Piru
    Posts: 576 from 2003/2/24
    From: finland, the l...
    Updated the program a bit:

    Quote:

    Quick'n'dirty dos.library Exit() patch for MorphOS.
    Written by Harry "Piru" Sintonen <sintonen@iki.fi>.

    Either start exitpatch from s:user-startup or drag it to WBStartup
    drawer. There is no need to run exitpatch.

    There is no way to exit the patch. This patch will only patch
    dos.library version 50.x.

    99.9% of users don't need this patch. It only helps with apps that
    insist on using age old and obsolete Exit() dos.library function.

    version history
    ===============

    1.0 initial version.
    1.1 added $VER tag, no need to run anymore, won't install multiple
    times anymore, added custom startup-code.
    1.2 yeah well, missing __abox__ is bad, aswell as leaving testcode
    in the src.

    - Piru



    Download it from: exitpatch.lha

    [ Edited by Piru on 2006/3/31 20:09 ]
  • »31.03.06 - 18:58
    Profile
  • Butterfly
    Butterfly
    munk
    Posts: 94 from 2006/3/27
    Quote:

    Piru wrote:
    Quote:

    Maybe its better to replace the Exit() call within arp.library with your patch code. That should work as well on all systems. What do you think?

    Would work assuming you can somehow fit the code in there.

    I can since years ago I "rewrote" arp.library to make it V37+ and 68060 compatible. Thus I can easily correct ArpExit. I should have done that in the first place since the original code always looked questionable.

    Quote:

    Quote:

    Does clearing cli_Module works as well? Then run won't be needed.

    It does work. I was in a hurry so I wouldn't bother with such details. ;-)

    Thanks for confirming that. Meanwhile I already tried It myself. I took the liberty to modify your program myself. It was the first time I "wrote" and build a MOS program. I always wanted to know how to write a MOS program without startupcode. I am really surprised how easy it is. Its very similiar to AmigaOS/68k.

    Quote:

    Updated the program a bit:
    Quote:

    missing __abox__ is bad


    Sorry to ask the obvious (I am a MorphOS newbie :): what is the difference between __amigappc__ and __abox__? When I modified exitpatch 1.0 I added both symbols to be on the safe side ;-)
  • »03.04.06 - 08:59
    Profile
  • MorphOS Developer
    CISC
    Posts: 619 from 2005/8/27
    From: the land with ...
    Quote:

    what is the difference between __amigappc__ and __abox__?


    __amigappc__ used to be the old identifier, which at some point in time (shortly after 0.4 iirc?) was deprecated in favor of __abox__, at the same time other stuff also changed names, like libamiga/stubs.a etc, this was mostly a political statement based on certain turmoil that was quite prominent at the time (and still somewhat even today)...

    ..in short; today you should just use __abox__...


    - CISC
  • »03.04.06 - 12:17
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    DoctorMorbius_FP
    Posts: 315 from 2004/2/14
    From: Naples - Italy
    @ munk

    Are you Gunther Nikl, the author of at least 20 fine utilities stored in Aminet?

    Welcome to our community, you will see that it is very friendly and full of people ready to (remember and) appreciate a good programmer like you.

    And you are even the unknown author of Aminet:util/libs/arp40_2.lha [arp.library 40.2 (7-Feb-1993)]?

    Wow! That was essential for me at the time for A4000 compatibility and because some ARP commands were not yet available as DOS commands at the time.

    Can you make available a copy of the emended arp.library if you really create it? There is still use for it within WinUAE...

    [ Edited by DoctorMorbius_FP on 2006/4/3 18:00 ]
    Powered by PegasosII-G4, MacMini, PowerMac MDD.
  • »03.04.06 - 17:50
    Profile Visit Website
  • Butterfly
    Butterfly
    munk
    Posts: 94 from 2006/3/27
    Quote:

    DoctorMorbius_FP wrote:
    @ munk
    Are you Gunther Nikl, the author of at least 20 fine utilities stored in Aminet?

    Yes, thats me but I never counted my AmiNet uploads ;-)

    Quote:

    And you are even the unknown author of Aminet:util/libs/arp40_2.lha [arp.library 40.2 (7-Feb-1993)]?

    Wow! That was essential for me at the time for A4000 compatibility and because some ARP commands were not yet available as DOS commands at the time.

    No, that one isn't from me. At that time I used a 68030 and there the original arp.library worked fine. When I upgraded to an 68060 arp.library didn't work any more, thus I fixed it myself. Later I learned that this could have been fixed by the 68060.libray and AFAICT the C= 68040.library has a fix for this arp.library problem.

    Quote:

    Can you make available a copy of the emended arp.library if you really create it? There is still use for it within WinUAE...

    Seems I should upload it to AmiNet but I don't know when that will be.
  • »04.04.06 - 08:48
    Profile
  • Butterfly
    Butterfly
    munk
    Posts: 94 from 2006/3/27
    Quote:

    CISC wrote:
    __amigappc__ used to be the old identifier, which at some point in time (shortly after 0.4 iirc?) was deprecated in favor of __abox__, at the same time other stuff also changed names, like libamiga/stubs.a etc

    That explains why old GCC diffs (like the ones available on Martin Bloms site) reference libamiga.a and libamigastubs.a. I just noticed that VBCC/MOS does have a libamiga.a .-)

    Quote:

    ..in short; today you should just use __abox__...

    Thanks for these valuable information. It looks like you should switch mpega_libmad to use __abox__ then ;-)
  • »04.04.06 - 08:56
    Profile
  • MorphOS Developer
    CISC
    Posts: 619 from 2005/8/27
    From: the land with ...
    Quote:

    It looks like you should switch mpega_libmad to use __abox__ then ;-)


    Heh, indeed... ;)

    ..a minor heads-up is worth noting here though, be careful when stripping binaries, some old versions of strip (like the old 68k hosted one, or maybe even Blom's?) might not preserve __abox__, additionally the ld in the current SDK doesn't either if you strip during linking, so don't do that. ;)


    - CISC

    [ Edited by CISC on 2006/4/4 9:50 ]
  • »04.04.06 - 09:43
    Profile
  • Butterfly
    Butterfly
    munk
    Posts: 94 from 2006/3/27
    Quote:

    CISC wrote:
    ..a minor heads-up is worth noting here though, be careful when stripping binaries, some old versions of strip (like the old 68k hosted one, or maybe even Blom's?) might not preserve __abox__, additionally the ld in the current SDK doesn't either if you strip during linking, so don't do that. ;)

    Thanks for the heads-up. Yes, the MorphOS binutils patches from Martin Bloms site don't preserve __abox__. Most available binaries are probably based on the patches from his site. I already noticed these problems and fixed them for my builds, thus using -s when linking does work here :-)

    I noticed another binutils bug: the morphos ld sorts flavours _before_ arguments are examined. I fixed that but now I have problems with -noixemul and -mbaserel32 (the wrong libc.a is used). Ah I see it - its a clash between multilib and flavours. It seems removing "-fl libb[32]" from LINK_SPEC does fix that. I wonder if MOS GCC shouldn't drop MULTILIB and use the m68k-amigaos way of multilib-ing. However, that works only for libgcc.a. Thus its probably not an option...
  • »04.04.06 - 10:51
    Profile
  • MorphOS Developer
    CISC
    Posts: 619 from 2005/8/27
    From: the land with ...
    As long as you get the order right it's not really a problem, however you should generally avoid using ld directly when linking...

    ..anyway, we're getting awfully off-topic here now. ;)


    - CISC
  • »04.04.06 - 11:38
    Profile
  • Butterfly
    Butterfly
    munk
    Posts: 94 from 2006/3/27
    Quote:

    CISC wrote:
    As long as you get the order right it's not really a problem, however you should generally avoid using ld directly when linking...

    I always use the proper frontends unless I am hacking the tools :)

    Quote:

    ..anyway, we're getting awfully off-topic here now. ;)

    Right. Whats a better place for such topics?
  • »04.04.06 - 15:36
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    DoctorMorbius_FP
    Posts: 315 from 2004/2/14
    From: Naples - Italy
    @ munk

    Thanks for your kind reply.

    (Try the Aminet full text search engine by Chris Hodges, putting your name in it. You will see all your contributions as well as all the archives where you are mentioned. It's a long list.)

    (I used Xoper very much...)
    Powered by PegasosII-G4, MacMini, PowerMac MDD.
  • »04.04.06 - 15:51
    Profile Visit Website
  • MorphOS Developer
    CISC
    Posts: 619 from 2005/8/27
    From: the land with ...
    Quote:

    Right. Whats a better place for such topics?


    Just a new thread would do, though usually MDC is the preferred place...


    - CISC
  • »04.04.06 - 17:34
    Profile
  • Butterfly
    Butterfly
    munk
    Posts: 94 from 2006/3/27
    Quote:

    DoctorMorbius_FP wrote:
    (Try Aminet full text search engine by Chris Hodges, putting your name in it.

    It list everything where my name is in, thus its a bit misleading.

    Quote:

    (I used Xoper very much...)

    It works on MorphOS and currently I am using it quite frequently :)
  • »05.04.06 - 10:24
    Profile
  • Butterfly
    Butterfly
    munk
    Posts: 94 from 2006/3/27
    Quote:

    CISC wrote:
    [Just a new thread would do, though usually MDC is the preferred place...

    I am not (yet) subscribed there, this I would prefer this forum.
  • »05.04.06 - 11:00
    Profile