home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Professional
/
OS2PRO194.ISO
/
os2
/
prgramer
/
rcs
/
sources
/
alloca.asm
< prev
next >
Wrap
Assembly Source File
|
1991-09-18
|
768b
|
33 lines
;80286 version of alloca(), in near code, returns far pointer
;assemble with "masm -Ml"
.286
_TEXT SEGMENT WORD PUBLIC 'CODE'
ASSUME cs:_TEXT
PUBLIC _alloca
_alloca PROC NEAR
pop cx ; return address
pop ax ; amount to alloc
add ax,1 ; round it to 16-bit boundary
and al,11111110B ;
sub sp,ax ; lower the stack
mov ax,sp ; return ptr to base in ax
mov dx,ss ; segment of far pointer in dx
sub sp,2 ; allow for 'add sp, 2'
jmp cx ; jump to return address
_alloca ENDP
_TEXT ENDS
END