26 May 2019, 15:33 | #1 |
Registered User
Join Date: Apr 2019
Location: UK
Posts: 239
|
Stack position and size
I know how to use the stack, but I've realised that I don't understand where the initial value of the stack pointer is set, and how to determine how much stack space is available.
If an executable is launched from the shell, how is the value of A7 at entry point calculated and how much stack space is available? When code in a bootblock is executed, what is the value of A7 on entry and how much stack space is available? Does the Amiga OS perhaps set the Stack Pointer(s) during boot? How are stack overflows typically detected in assembly code? Can the amount of available stack space be queried? Do demos/games typically set their own stack pointer(s), or run with the initial value? Do Amiga executables contain the desired stack size? Is this information documented anywhere? |
26 May 2019, 15:40 | #2 |
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,437
|
A few answers - though not all
Amiga OS normally allocates 4 KB of stack space for any task and IIRC this also goes for the bootblock. The actual location of the stack is decided by the OS. I do not know the algorithm. Amiga OS does set the stack pointer on boot. Note that each task has it's own stack. Stack overflows are typically not detected in assembly code (unless you make something for this purpose yourself or use the OS and have something like Enforcer or a debugger running). I sometimes set my own stack pointer, but not always. Depends on the situation. |
26 May 2019, 18:20 | #3 | ||
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,355
|
Quote:
You get alert or guru saying memory lists are corrupt. But typical asm programs don't use much stack so an overflow is unlikely if u don't mix with c. Yes, min and max values are stored in your program's task structure. Quote:
Nope - at least not until after 3.1. |
||
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Supervisor stack size? | alpine9000 | Coders. System | 71 | 09 June 2019 01:36 |
Window position and size | a600fan | support.FS-UAE | 1 | 18 February 2019 00:10 |
cli window size and position | honx | support.WinUAE | 5 | 03 September 2016 23:48 |
Saving your Game Position | Ravenhook | support.Games | 8 | 26 May 2010 22:34 |
Saving position ? | Another World | support.Games | 1 | 28 April 2007 00:32 |
|
|