home *** CD-ROM | disk | FTP | other *** search
- #set StackSize = 1024 ; how large stack do we want?
- .Start
- b Main ; jump over the stack
- .Stack_Ceiling ; top-of-stack
- dbb StackSize,0 ; allocate stack space here
- .Stack_Floor ; bottom-of-stack
- .Old_Stack dcd 0 ; place to store old r13
- .Main
- str r13,Old_Stack ; save old r13
- adr r13,Stack_Floor ; r13-> new stack
- stmfd r13!,{r0-r12,r14} ; push all registers on our stack
- .Begin
- ; normal code ; put your program here
- .End
- ldmfd r13!,{r0-r12,r14} ; pop all registers from our stack
- ldr r13,Old_Stack ; get old r13
- movs pc,r14 ; return with all registers intact