12 October 2021, 20:51 | #1 |
Registered User
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
|
Calling LoadSeg() from Bootblock?
Hi all,
I'm hoping you can answer what is probably a simple yes or no question for me. Is it possible to call LoadSeg from within the Bootblock? I'm having fun trying to even open the dos.library from within the bootblock, but I just wanted to know even when I do manage to do that is it simply a case of calling LoadSeg on my executable program? The end game here is to simply save ram and load my game straight away without the system having to open Workbench and startup sequence stuff. Any help is really appreciated. Cheers, Graeme |
12 October 2021, 21:28 | #2 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
|
Short answer: no
|
12 October 2021, 21:30 | #3 |
Registered User
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
|
|
12 October 2021, 21:37 | #4 |
Engineer
Join Date: Oct 2018
Location: Shadow realm
Posts: 165
|
LoadSeg() is a dos.library function.
http://amigadev.elowar.com/read/ADCD.../node0279.html However, when the bootblock runs, dos is still not initialized. A bootblock's job is to tell the kickstart's strap module what to run next, by returning a pointer. Then strap frees the memory the bootblock uses, and jumps to that pointer (remember this, as you seem to care about available memory!). Generally, that's a pointer to dos.library's Init routine (a fixed offset in the structure FindResident() returns). If you were to init dos.library from your bootblock (via exec's InitResident()), dos would literally take over, so your bootblock code wouldn't run anymore, and on top of that, the bootblock would never be freed from memory. Thus, there's two general approaches to take here: - Load the executable you want to run by yourself, without dos.library's help. This is what you want, but you have to take care that your game's startup/exit code will not misbehave if you run it from AmigaOS, think RAM: or HDD. - Take over the system completely from your game. This is inconvenient, as you can't use exec for allocations (because you can't free dos.library's memory). It also means AmigaOS might not be usable anymore (crash) if you attempted to use it, so you shouldn't. Now your game can't "exit" but by reboot/poweroff. You'll find games generally use either approach. The "without dos.library help" will mean in practice that you either write your own "trackloader", use trackdisk.device (preferable!) or use some code with a compatible license written by somebody else for comfortably loading from floppies. Some might even be able to understand standard filesystems. You can still launch programs as tasks using exec's AddTask(), but you need to prepare them in memory yourself. Note that if your game is self-contained in a single file, there's definitely tools out there that will prepare a floppy image for you that just loads and runs your game without ever opening dos.library. Last edited by admiral; 12 October 2021 at 21:53. Reason: hdd |
12 October 2021, 21:52 | #5 |
Registered User
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
|
Thanks admiral - that is useful info.
|
12 October 2021, 21:55 | #6 |
Engineer
Join Date: Oct 2018
Location: Shadow realm
Posts: 165
|
|
12 October 2021, 22:17 | #7 |
Registered User
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 55
Posts: 1,957
|
Perhaps if your exe file will be not very complicated, you can create easy and short LoadSeg routine and place this routine in game bootblock.
Im not 100% sure, but if i remember right some old Amiga HD systems used external LoadSeg routine (supplied by Commodore) for loading HD drivers. No dos.library accesses. |
13 October 2021, 01:28 | #8 | |
Registered User
Join Date: Mar 2018
Location: Hastings, New Zealand
Posts: 2,544
|
Quote:
Unless you want to kick out the operating system and take over the whole machine I suggest you use it as intended. This will make your program more compatible and user-friendly. |
|
13 October 2021, 15:20 | #10 |
Going nowhere
Join Date: Oct 2001
Location: United Kingdom
Age: 50
Posts: 8,986
|
Simply allocate memory in bootblock, then use track disk which is already active to load code, if needs be you can then use a relocate routine, and away you go.
If you wanted to absolutely have all memory available to you, every last byte, then taking over system and utilising a hardware banging sector loader is the other way forward. |
13 October 2021, 16:47 | #11 | |
Registered User
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
|
Quote:
|
|
13 October 2021, 16:50 | #12 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,161
|
One possibility would be to format the disk as DOS, use a trackloader (like Rob Northen) to read the executable file in memory and execute it with a minimalist loadseg/relocate routine. There are several available.
And leave your exe runnable from hard disk. Run with a give argument (ex: HD) to read files using trackloader or DOS. Include trackloader in your exe but use it only in the case you booted from floppy. Simpler: don't use the bootblock but let the OS load your exe, but depending on an argument (same idea as above) use the OS or trackloader to load. supercars2 has IFD directives to read from MFM track or OS for instance. This was for dev stages and was disabled in production but you can make it dynamic. |
13 October 2021, 16:53 | #13 | |
Going nowhere
Join Date: Oct 2001
Location: United Kingdom
Age: 50
Posts: 8,986
|
Quote:
If you so wanted to, you could write a bespoke hard drive installer for your game, hiding the AmigaDOS executable on the disk. But in all honesty, a whdload version would come any way. |
|
13 October 2021, 20:49 | #14 |
Engineer
Join Date: Oct 2018
Location: Shadow realm
Posts: 165
|
|
13 October 2021, 21:23 | #15 |
Going nowhere
Join Date: Oct 2001
Location: United Kingdom
Age: 50
Posts: 8,986
|
|
13 October 2021, 21:40 | #16 |
Engineer
Join Date: Oct 2018
Location: Shadow realm
Posts: 165
|
|
13 October 2021, 23:13 | #17 | |
Going nowhere
Join Date: Oct 2001
Location: United Kingdom
Age: 50
Posts: 8,986
|
Quote:
Its whatever Graeme wants it to be, its not on him to guess what others would do with the disk, and he isn't obliged to worry about it either. |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
PowerPacker LoadSeg Shell Decruncher | brian_p | support.Apps | 9 | 14 April 2019 19:49 |
Calling it a day... | killergorilla | project.Killergorilla's WHD packs | 57 | 28 March 2011 06:48 |
Calling All Contributors! | fiath | project.SPS (was CAPS) | 9 | 28 October 2010 12:22 |
LoadSeg / Relocate to fixed address? | a4k-oerx | Coders. General | 7 | 24 November 2008 17:35 |
loadseg help | BippyM | Coders. General | 4 | 16 April 2007 13:35 |
|
|