Welcome, Guest. Please login or register.

Author Topic: Stack related program crash  (Read 1995 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Re: Stack related program crash
« on: June 18, 2004, 11:42:53 PM »
It is available, but only after you write the new stack poiner value to sp.

example:
Code: [Select]

 ; allocate 256 bytes from stack
 lea (-256,sp),a3

 ; can't poke the memory at a3 yet, since any task switch
 ; would write registers & system context to stack overwriting
 ; our data!

 move.l a3,sp
 ; now the memory at a3 ... a3+256 can be used freely. Any
 ; context switch will use memory before our data, and thus
 ; it won't be erased.

 ;....

 ; pop our temp storage off stack
 lea (256,sp),sp
 rts


If you're running low on standard 4k stack, just AllocMem/AllocVec some storage for the variables.