27 February 2020, 06:12 | #21 | ||
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,216
|
Quote:
Quote:
That depends on the program. The average application program does not require to generate BPTRs, though there are some cases where it becomes necessary, e.g. when creating a "lock list" for the command directory list of the "CommandLineInterface" structure, which is a BPTR-linked list. |
||
27 February 2020, 06:21 | #22 | ||
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,216
|
Quote:
Quote:
I do not know how much "__align" of SAS/C really guarantees. It may require that the stack is, on entrance, long word aligned, which may not be true in general if your code is called as part of some other function. Many Os-internal functions use therefore a macro solution: Code:
#define D_S(type,name) char a_##name[sizeof(type)+3]; \ type *name = (type *)((ULONG)(a_##name+3) & ~3UL) D_S(struct FileInfoBlock,link_fib); |
||
27 February 2020, 09:32 | #23 | |
Registered User
Join Date: Sep 2019
Location: Essen/Germany
Age: 55
Posts: 463
|
Quote:
When calling Examine() you also have to provide a FileInfoBlock and according to Amiga Intern (Data Becker) it should also be longword aligned. |
|
27 February 2020, 10:07 | #24 | |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,216
|
Quote:
The quesiton was "where do I need to create a BPTR", which is different from "where do I need to align structures". So, to recapitulate: - Structures you pass into the dos.library have to be longword aligned. Not only struct FileInfoBlock, but pretty much everything. File names are an exception because they are converted to BSTRs anyhow. - You *typically* do not need to create BPTRs yourself, rather handle them as opaque pointers. You only need to when writing handlers, mounting handlers or for some shell functions. - Last but not least: Get a better book as reference. "Amiga Intern" is, well, half-baked, half correct information, badly copied from the RKRM and the AmigaDos manual. Get first source material, not "Data Becker" made up information. |
|
27 February 2020, 10:12 | #25 |
ex. demoscener "Bigmama"
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,624
|
I think you're on the right track - and if that's the case it only works because the compiler can keep track of what happens with the stack pointer all the way through the code, and is also the reason a similar construct would be unreliable to implement for an assembler, since the user can do anything they like with the stack pointer.
|
27 February 2020, 10:18 | #26 | |
Registered User
Join Date: Sep 2019
Location: Essen/Germany
Age: 55
Posts: 463
|
Quote:
Any recommendations? I also have the RKRM but I find it much harder to read, because it's not as compact and the index is also not really helpfull. I also looked up the online docs, but they are also rather sparse. I remember Ralph Brown's DOS Interrupt List, which was REALLY detailed and could be compiled into different formats for easy browsing. I was wondering if something like this exists for Amiga as well. Maybe wishfull thinking, but a windows help file would be cool. |
|
27 February 2020, 10:25 | #27 |
Registered User
Join Date: Jun 2015
Location: Germany
Posts: 1,918
|
I very much liked this book: https://gitlab.com/amigasourcecodepr...ll-auf-hundert
While the title doesn't really indicate it, it is just as much about OS coding on the Amiga as about assembly language. |
27 February 2020, 17:11 | #28 |
Registered User
Join Date: Sep 2019
Location: Essen/Germany
Age: 55
Posts: 463
|
This looks pretty good! To bad it's hard to find as a real book. I ordered another one and hope that this is also good: https://www.amazon.de/gp/product/089...?ie=UTF8&psc=1
I'm not so fond of the "Amiga Intern" anyway. On the C64 it was the best book you could get, but for the Amiga it feels just like a rushed translated copy of the RKRM. I will keep looking for this "Null auf Hundert", maybe I can find it somewhere. Having the PDF is not the same as a real book on your desk. |
27 February 2020, 17:50 | #29 |
Registered User
Join Date: Jun 2015
Location: Germany
Posts: 1,918
|
I'm not going to part with mine...
|
27 February 2020, 18:19 | #30 |
Registered User
Join Date: Sep 2019
Location: Essen/Germany
Age: 55
Posts: 463
|
And here I was, hoping you don't need it anymore...
|
27 February 2020, 18:47 | #31 | |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,216
|
Quote:
I would also recommend the Guru Book, if you can find a copy. As far as the dos.library is concerned, it is a much better source than the official documentation from Bantam Books. "Intern 2" from Databecker was more or less a German translation of the RKRM Devices and RKRM Libraries, but are now totally outdated as they have not been updated beyond 1.3 - and typical for DataBecker - contain some false information and misunderstandings by its editors. |
|
27 February 2020, 21:31 | #32 |
Registered User
Join Date: Sep 2019
Location: Essen/Germany
Age: 55
Posts: 463
|
Yet another book, which is hard to come by. Well, at least I know what I will looking for now.
|
28 February 2020, 12:59 | #33 |
Registered User
Join Date: Oct 2018
Location: Worcester, UK
Posts: 31
|
You could have a look at this one - it is in English but available in print!
https://www.amazon.de/dp/1690195150/ Cheers! |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Data/instruction alignment for 68020..060 | phx | Coders. Asm / Hardware | 16 | 17 February 2020 20:22 |
vasm and word alignment | Den | Coders. Asm / Hardware | 9 | 07 February 2014 11:25 |
|
|