13

I am trying to run JrComm 1.02a on my Amiga 1000. When I launch the software by double clicking the workbench icon, i get an alert telling me I need the 'explode.library V4+'. I have placed this library in my LIBS: folder but JrComm still won't launch. Interestingly, if I open a shell and launch JrComm from the command line, it will work fine. After that initial run, I can double click the icon and JrComm will continue to launch just fine. I suspect the library remains in memory after the first run - so I figured I could just 'pre-load' the library during my startup-sequence.

So, can an Amiga library be pre-loaded and if so, what command/syntax/reagents are required for this spell?

In case it matters, the system is an A1000 kicked with KS1.3 from floppy and Workbench 1.3.2. I have a 2Mb Starboard with the StarDrive module installed and connected to a ZuluSCSI as my hard drive. The StarDrive did not support auto-boot, so I boot from a floppy that mounts the HD and then re-assigns all the important folders to the HD (just like it was 1987 woot!). The only weird bit is I install Workbench to the hard drive in a sub-folder named "Workbench". That means SYS: is assigned to DH0:Workbench and not simply DH0: - which holds true for all assignments. For example, the LIBS: folder resolves to DH0:Workbench/libs (not DH0:libs). Maybe that's why JrComm doesn't find the library, although (for me) it doesn't explain why it works from the command prompt.

7
  • 5
    You can always write a short piece of code that loads the library with OpenLibrary and exits.
    – tofro
    Commented Jun 17, 2023 at 20:49
  • 1
    Yes, I thought of that too. But doesn't it feel like it should be an already-solved-problem? I can't possibly be the first person to ever want to try doing this.
    – Geo...
    Commented Jun 17, 2023 at 23:08
  • 4
    What is strange is that the application program doesn't load the library itself. IIRC it is essentially a No-Op success if the library is already open. (ie, not a double-load)
    – RichF
    Commented Jun 18, 2023 at 0:30
  • What I would do first is start a script from the Workbench and have that print the LIBS: mapping. Apparently, that is wrong
    – tofro
    Commented Jun 18, 2023 at 8:18
  • 1
    tofro, I just double checked the assigns and they are all correct, my libs: folder is where it should be.
    – Geo...
    Commented Jun 18, 2023 at 11:05

4 Answers 4

13

explode.library is a library used by TurboImploder packer.

My guess (best effort since the file you're using is unknown/not shared at this point) is that the main executable is packed with TurboImploder, but a buggy release or something.

From a programming point of view, starting from workbench must be explicitly supported (you have to get & reply to workbench messages or the app will lock up), so you can do completely different things when starting from cli or workbench (loading or just checking if a library is resident is possible).

I would use xfddecrunch from xfdmaster package to unpack the executable (or get another installation of the software which uses original disks, which aren't using TurboImploder at all) and the problems would go away.

I even cracked a game once (Nightshift) using that technique: the disk protection was hidden in an altered version of decrunching code, that I bypassed by decrunching the executable definitely with xfddecrunch!

4
  • That is great info about TurboImploder - the copy of JrComm is from my A3000 and dates back to whatever I was running circa 1991-ish. I used 'Imploder' a lot back then, so it's possible I compressed it or I downloaded it already compressed. The same file launches fine on my A3000 under 2.x or 3.x roms. Anyway, I like the idea of decrunching it to see if that impacts or solves the problem. If all else fails, I will re-download from somewhere and see what happens.
    – Geo...
    Commented Jun 18, 2023 at 14:49
  • a .adf of the program can be found here: planetemu.net/rom/commodore-amiga-applications/… and it's not packed Commented Jun 18, 2023 at 15:05
  • 3
    I feel a bit daft for not thinking to try this straight off, but I took the packed executable back to my A3000, ran Imploder and 'de-imploded' it. Took the (now larger) file back to the A1000 and it works like a charm. So clearly that was the problem. I would like to mark this as the answer because it helped me solve my underlying problem. But to be fair, it doesn't really answer the actual question about manually loading a library. So I'm going to leave it open for a bit and see what develops. BUT, thank-you very much for the kick in the right direction!
    – Geo...
    Commented Jun 18, 2023 at 20:53
  • maybe if you share the packed file I can help you more / answer the question. Commented Jun 18, 2023 at 21:00
6

To answer the literal question in the title, yes, it's possible to manually load an Amiga library into memory. All you need to do is write a small program that calls the OpenLibrary function (passing the library name and the desired minimum version as arguments). And I do mean small — if written in assembly, I'd guesstimate the resulting executable to be a few hundred bytes long, if even that. (In C, you'll have some overhead that'll probably push it into kilobytes.)

If your program doesn't make a corresponding CloseLibrary call (which a normal program using a library always should do!), then the "open count" of the library (lib_OpenCnt in the Library structure) will remain incremented, locking the library permanently in memory (at least unless and until some other program makes an extra CloseLibrary call for it, or is extra naughty and directly decrements the open count). If you do close the library, AmigaOS may expunge it from memory (as if RemLibrary was called), although IIRC the OS will normally only do that to free memory if an attempted memory allocation (AllocMem or similar) would otherwise fail.

FWIW, it's also technically possible to directly construct a Library structure and its associated function table in memory (either fully manually or with the help of MakeLibrary) and then call AddLibrary to add it to the list of loaded libraries. That way it's possible to load a library that doesn't exists on the disk at all, if that's something you'd like to do for some reason. (That's also basically how the OS itself initializes its built-in ROM libraries on startup.)

Ps. Yes, I'm aware that the exec.library "autodocs" that I linked to above are missing some general details about how Amiga libraries work that the user is just assumed to already know. Most of that missing detail can be found in the introduction to the Amiga Libraries Manual, specifically in the section on "Libraries of Functions", which also includes example code for opening (and using and closing) a library in C and in assembly. Any decent introductory book on Amiga software development (at least one that isn't 100% game-focused) should also cover this stuff at least briefly.

2

To pre-load a library on Amiga during the startup-sequence, you can use the LoadResident command. Here's how you can modify your startup-sequence to pre-load the 'explode.library' on boot:

Open your favorite text editor or use the Amiga Shell to edit the startup-sequence file.

Locate the line where the assignments for LIBS: and other important folders are made. It should look similar to this:

C:Assign LIBS: DH0:Workbench/libs
Add the following line after the assignment of LIBS:, but before any programs are executed:
C:LoadResident LIBS:explode.library
This command will load the 'explode.library' into memory, making it available for any program that requires it.

Save the modified startup-sequence file.

Restart your Amiga 1000.

After following these steps, the 'explode.library' should be pre-loaded during the boot process, and JrComm should be able to find it when launched from the Workbench icon.

The reason JrComm works fine when launched from the command line is that the library is loaded into memory by the shell. Once the library is in memory, subsequent launches of JrComm from the Workbench icon also work because the library is already available.

By pre-loading the library during the startup-sequence, you ensure that it is always loaded when the system starts up, avoiding the need to launch JrComm from the command line first.

1
  • 3
    Your answer makes it sound as if LoadResident were an in-built AmigaDOS command - which it isn't. I do agree the command does what you describe, but you should also mention where to find it.
    – tofro
    Commented Jun 19, 2023 at 13:10
0

The ARP replacement shell commands had loadlib between them as far as I remember. Will try to find a reference later.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .