Line | |
---|
1 | #
|
---|
2 | ! alloca() - allocate space on the stack Author: Kees J. Bot
|
---|
3 | ! 26 Jan 1994
|
---|
4 |
|
---|
5 | #if __ACK__ /* BCC can't do alloca(), register saving is wrong. */
|
---|
6 |
|
---|
7 | .text
|
---|
8 | .define _alloca
|
---|
9 | _alloca:
|
---|
10 | pop cx ! Return address
|
---|
11 | pop ax ! Bytes to allocate
|
---|
12 | add ax, #2*2+1 ! Add space for two saved register variables
|
---|
13 | andb al, #0xFE ! Align
|
---|
14 | mov bx, sp ! Keep current sp
|
---|
15 | sub sp, ax ! Lower stack
|
---|
16 | mov ax, sp ! Return value
|
---|
17 | push 2(bx) ! Push what is probably the saved si
|
---|
18 | push (bx) ! Saved di
|
---|
19 | ! Now ACK can still do:
|
---|
20 | ! pop di; pop si; mov sp, bp; pop bp; ret
|
---|
21 | push ax ! Dummy argument
|
---|
22 | jmp (cx)
|
---|
23 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.