mirror of
https://github.com/alfishe/amiga-bootcamp.git
synced 2026-06-13 00:26:28 +00:00
More content added
This commit is contained in:
parent
5fac29ccd5
commit
8133b3a6cb
90 changed files with 7794 additions and 705 deletions
|
|
@ -55,7 +55,7 @@ extern struct DosLibrary *DOSBase;
|
|||
extern struct ExecBase *SysBase;
|
||||
```
|
||||
|
||||
These are initialised in `c.o` (the startup stub):
|
||||
These are initialized in `c.o` (the startup stub):
|
||||
```asm
|
||||
_c_start:
|
||||
MOVE.L 4.W, A6 ; SysBase from exception vector
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ The double-jump (JSR→JMP→function→RTS) costs approximately 12 extra cycles
|
|||
```c
|
||||
struct Library *MakeLibrary(
|
||||
APTR funcArray, /* A0: function pointer array */
|
||||
APTR structInit, /* A1: struct initialiser table (or NULL) */
|
||||
APTR structInit, /* A1: struct initializer table (or NULL) */
|
||||
APTR initFunc, /* A2: init function (or NULL) */
|
||||
ULONG dataSize, /* D0: sizeof(MyLibBase) */
|
||||
BPTR segList /* D1: segment list (for UnLoadSeg on expunge) */
|
||||
|
|
@ -409,8 +409,8 @@ void SumLibrary(struct Library *lib)
|
|||
stateDiagram-v2
|
||||
[*] --> OnDisk : LIBS:my.library file
|
||||
OnDisk --> Loading : OpenLibrary("my.library", 1)
|
||||
Loading --> Initialised : LoadSeg + MakeLibrary + LibInit
|
||||
Initialised --> Added : AddLibrary → SysBase→LibList
|
||||
Loading --> Initialized : LoadSeg + MakeLibrary + LibInit
|
||||
Initialized --> Added : AddLibrary → SysBase→LibList
|
||||
Added --> Open : OpenLibrary → Open() LVO → lib_OpenCnt++
|
||||
Open --> Open : More OpenLibrary calls
|
||||
Open --> Closing : CloseLibrary → Close() LVO → lib_OpenCnt--
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ void install_patch(void)
|
|||
|
||||
## Calling the Original (Chaining)
|
||||
|
||||
The replacement function **must** call the original to maintain correct library behaviour. The old function address returned by `SetFunction` is a raw pointer to the original function body (not the JMP slot):
|
||||
The replacement function **must** call the original to maintain correct library behavior. The old function address returned by `SetFunction` is a raw pointer to the original function body (not the JMP slot):
|
||||
|
||||
```c
|
||||
/* Jump to original using register convention */
|
||||
|
|
|
|||
|
|
@ -393,8 +393,8 @@ void TryFreeMemory(void)
|
|||
stateDiagram-v2
|
||||
[*] --> Unloaded : File on disk
|
||||
Unloaded --> Loading : OpenLibrary → ramlib
|
||||
Loading --> Initialised : LoadSeg + InitResident
|
||||
Initialised --> InLibList : AddLibrary → SysBase→LibList
|
||||
Loading --> Initialized : LoadSeg + InitResident
|
||||
Initialized --> InLibList : AddLibrary → SysBase→LibList
|
||||
InLibList --> Open : Open() LVO, lib_OpenCnt=1
|
||||
Open --> Open : OpenLibrary (lib_OpenCnt++)
|
||||
Open --> Closing : CloseLibrary (lib_OpenCnt--)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
## Overview
|
||||
|
||||
The AmigaOS **startup code** is the first code that runs when an executable is launched. It bridges the OS loader (which jumps to hunk 0 offset 0) and the C `main()` function. Understanding it is critical for reverse engineering — it reveals the initialisation sequence, library opens, argument parsing, and the Workbench vs CLI detection path.
|
||||
The AmigaOS **startup code** is the first code that runs when an executable is launched. It bridges the OS loader (which jumps to hunk 0 offset 0) and the C `main()` function. Understanding it is critical for reverse engineering — it reveals the initialization sequence, library opens, argument parsing, and the Workbench vs CLI detection path.
|
||||
|
||||
---
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue