home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Meeting Pearls 3
/
Meeting_Pearls_III.iso
/
Pearls
/
cdrom
/
FS+FS-Tools
/
AmiCDFileSystem
/
src
/
stackswap.asm
< prev
Wrap
Assembly Source File
|
1994-09-24
|
849b
|
63 lines
MINSTACKSIZE EQU 2400
section text,code
xdef __stackswap
__stackswap
MOVE.L 4,A0
MOVE.L $114(A0),A0
MOVE.L $3A(A0),A1
CMP.L SP,A1
BCC.S 1$
CMP.L $3E(A0),SP
BHI.S 1$
ADD.L #MINSTACKSIZE,A1
CMP.L SP,A1
BCC.S 1$
MOVE.L 4(SP),A0
JMP (A0)
1$ MOVEM.L D2/A4/A5,-(SP)
MOVE.L 4,A5
MOVEQ #0,D1
MOVE.L #MINSTACKSIZE,D0
EXG A5,A6
JSR -$C6(A6)
EXG A5,A6
MOVE.L D0,A4
MOVE.L A4,D0
BNE.S 3$
MOVEQ #0,D2
2$ MOVE.L D2,D0
MOVEM.L (SP)+,D2/A4/A5
RTS
3$ LEA MINSTACKSIZE(A4),A1
LEA -8(A1),A0
MOVE.L A1,-(A0)
MOVE.L A4,-(A0)
MOVE.L A0,8(A0)
MOVE.L A0,A4
EXG A5,A6
JSR -$2DC(A6)
EXG A5,A6
MOVE.L 8(A4),A0
LEA $3C(A0),A0
MOVEQ #10,D0
4$ MOVE.L -(A0),-(SP)
DBRA D0,4$
MOVE.L (SP),A0
JSR (A0)
MOVE.L D0,D2
MOVE.L A4,A0
EXG A5,A6
JSR -$2DC(A6)
MOVE.L (A4),A1
MOVE.L #MINSTACKSIZE,D0
JSR -$D2(A6)
EXG A5,A6
BRA.S 2$
end