[section .text align 4]

global _pushstk
global _unstk
extern _push_stk0
extern _pop_stk0
extern _free

[section .bss align 4]

sptr: resd 1
lptr: resd 1
back: resd 1
mptr: resd 1
ptr0: resd 1

[section .text align 4]

_unstk:
	lea eax,[back]
	push eax
	lea eax,[lptr]
	push eax
	lea eax,[sptr]
	push eax
	call _pop_stk0
	add esp,12
	mov ebx,[sptr]
	mov edx,[lptr]
	mov ecx,[back]
	mov esp,ebx
	mov ebp,edx
	jmp ecx


%define _mptr ebp+24
%define _size ebp+20
%define _sptr ebp+16
%define _lptr ebp+12
%define _back ebp+8
_pushstk:
	push ebp
	mov ebp,esp
	push dword [_mptr]
	push dword [_size]
	push dword [_sptr]
	push dword [_lptr]
	push dword [_back]
	call _push_stk0
	add esp,20
	leave
	ret
%undef _back
%undef _lptr
%undef _sptr
%undef _mptr

[section .data align 4]

