04 November 2023, 14:54 | #1 |
Registered User
Join Date: Apr 2019
Location: UK
Posts: 268
|
Bootblock load address
I know that when a disk boots, the bootblock "sectors are read into the system at an arbitrary position", but what position is this in practice? Is it a known range for an unexpanded A500 or one with half meg slow ram?
I get the impression that a common pattern in the bootblock of classic non-DOS games is to DoIO the next block of code to a hard-coded chip ram address then jmp into it. I suppose there is always a chance that the read will stomp the bootblock so the coder would have to hope for the best. I've seen this pattern which seems safe: PEA <entry point> : JMP DoIO to ensure the bootblock code is finished with. Would coders sometimes JSR DoIO : JMP <entry point> and hope the JMP didn't get stomped, or did they know "safe ranges"? Thanks for any insight. |
04 November 2023, 15:13 | #2 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,553
|
Usually new memory blocks are allocated from lower to higher addresses. So the probability that high memory regions are in use is quite low during the boot phase (for example >
$70000for a 512K A500). But not impossible. A good coder uses AllocAbs()to confirm that the prefered region is available. Last edited by phx; 04 November 2023 at 19:21. Reason: s/now/not/ |
04 November 2023, 16:31 | #3 |
Going nowhere
Join Date: Oct 2001
Location: United Kingdom
Age: 50
Posts: 9,020
|
Bootblock is usually in quite low memory, for instance on an A500 with 512k chip and 512k slow, the bootblock can be loaded as low as $1558, on other Amigas between that address and $59e8.
So usually on a clean booted system or just reset system, people have usually loaded code from the bootblock to something like $40000 or higher for safety, you could of course try and allocate that space, but typically, that memory is clean and free. Then once loaded to that address and jumping to the code at say $40000, I usually then transfer my code back down to low memory and run from there. |
04 November 2023, 17:37 | #4 |
Registered User
Join Date: Apr 2019
Location: UK
Posts: 268
|
Thanks very much.
|
05 November 2023, 10:25 | #5 |
Registered User
Join Date: Apr 2019
Location: UK
Posts: 268
|
Thanks for this tip. I guess this is to reduce chip memory fragmentation and give a nice contiguous block to work with.
|
05 November 2023, 16:54 | #6 |
ex. demoscener "Bigmama"
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,646
|
Another thing to consider is where the stack(s) are located when loading to absolute adresses from the bb.
|
05 November 2023, 17:24 | #7 | |
Going nowhere
Join Date: Oct 2001
Location: United Kingdom
Age: 50
Posts: 9,020
|
Quote:
User Stack is low in memory, near to where the bootblock is loaded. So long as you load from $40000 or higher, then disable interrupts, relocate your code and set the stacks as you like, its never an issue. |
|
05 November 2023, 20:14 | #8 |
Zone Friend
Join Date: Mar 2004
Location: Middle Earth
Age: 40
Posts: 2,130
|
I'm guessing the OS checks to see how much CHIP ram is available and loads it at some random location in CHIP compared to MSDOS which has a fixed memory address of $7C00?
|
05 November 2023, 20:34 | #9 | |
Registered User
Join Date: Feb 2017
Location: Denmark
Posts: 1,239
|
Quote:
(And for DOS IIRC you can't rely on whether you're started at 0x0:7c00, 0x7c0:0 etc if you want to be compatible with all BIOSes ) |
|
05 November 2023, 20:43 | #10 |
Going nowhere
Join Date: Oct 2001
Location: United Kingdom
Age: 50
Posts: 9,020
|
Bootblock allocation is done in system friendly way but bootblock is ALWAYS located in chip mem and as low as possible, simply because its one of the first things in the memory allocation list.
|
05 November 2023, 22:42 | #11 | |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,501
|
Quote:
From KS2.0+, bootblock code can be in any type of ram, and usually in fast-ram if available. EDIT: not that anything actually changes, the vast majority of those who use the bootblock to take control of the system expect that their code must also work on machines with KS1.x (the OCS releases) or with chip-ram only (base A500+/A600/A1200..). Last edited by ross; 05 November 2023 at 23:50. |
|
06 November 2023, 01:16 | #12 | |
Going nowhere
Join Date: Oct 2001
Location: United Kingdom
Age: 50
Posts: 9,020
|
Quote:
Doesn't make any real world difference as it still means bootblock will likely never be touched accidentally as its never near the safe area on a clean boot, but thats a new one for me! |
|
06 November 2023, 03:52 | #13 |
Registered User
Join Date: Jun 2016
Location: europe
Posts: 1,068
|
Bootblock location depends on device driver's preferred memory type. That used to be chip memory for trackdisk device back in KS1.3 (the reason might be blitter assisted MFM decoding) but at some point, as Ross pointed out, it was changed to public memory.
|
06 November 2023, 11:00 | #14 | |
ex. demoscener "Bigmama"
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,646
|
Quote:
That's true, with the exception that if you need to support A1000 with 256k chip, a lower address is better. |
|
06 November 2023, 21:03 | #15 | |
Going nowhere
Join Date: Oct 2001
Location: United Kingdom
Age: 50
Posts: 9,020
|
Quote:
Lower than $40000 and you're inviting problems. |
|
06 November 2023, 22:16 | #16 |
Registered User
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 56
Posts: 2,054
|
From my memory kick 1.2 or 1.1 set stack at $40000, not at $80000, even for Amigas with 0.5MB chip RAM.
|
06 November 2023, 22:57 | #17 |
Going nowhere
Join Date: Oct 2001
Location: United Kingdom
Age: 50
Posts: 9,020
|
|
08 November 2023, 10:05 | #18 |
Registered User
Join Date: Apr 2019
Location: UK
Posts: 268
|
Thanks very much for all the information.
|
05 January 2024, 01:43 | #19 | |
Engineer
Join Date: Oct 2018
Location: Shadow realm
Posts: 167
|
Quote:
Then you get to tell the system where to jump (generally dos.library init routine but can be anything you want), and the memory the bootblock used is already freed at that point. |
|
05 January 2024, 01:56 | #20 |
Going nowhere
Join Date: Oct 2001
Location: United Kingdom
Age: 50
Posts: 9,020
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
IP address and Winuae | White | support.WinUAE | 44 | 30 March 2023 11:56 |
Does anyone know the email address for this site? | xboxown | support.Other | 5 | 22 December 2021 02:09 |
Address register expected | Nightfox | Coders. Asm / Hardware | 4 | 12 August 2016 11:51 |
NAT address | -Rob- | support.Other | 7 | 07 April 2008 00:06 |
|
|