ack/lang/cem/libcc/mon/sbrk.e

61 lines
664 B
Plaintext
Raw Normal View History

1985-01-01 22:27:02 +00:00
#
#include <em_abs.h>
1985-01-01 22:27:02 +00:00
mes 2,EM_WSIZE,EM_PSIZE
.1
bss EM_PSIZE,0,0
.2
bss EM_WSIZE,0,0
pro $ctch,0
lol 0
loc EHEAP
beq *1
lae .1
loi EM_PSIZE
sig
asp EM_PSIZE
lol 0
trp
rtt
1
loc 1
ste .2
rtt
end
1985-01-01 22:27:02 +00:00
exp $sbrk
pro $sbrk,0
lor 2
lor 2
lpi $ctch
sig
lae .1
sti EM_PSIZE
loc 0
ste .2
1985-01-01 22:27:02 +00:00
lol 0
1988-04-14 10:45:42 +00:00
ads EM_WSIZE ; this is the new heap pointer, but watch out for overflow!
1988-04-27 18:02:59 +00:00
dup EM_PSIZE
1988-04-14 10:45:42 +00:00
lor 2
cmp ; compare with old heap pointer
zlt *1
str 2 ; The - possibly - occurring trap is caught
lae .1
loi EM_PSIZE
sig
asp EM_PSIZE
loe .2
zgt *1
ret EM_PSIZE
1
asp EM_PSIZE
loc -1
loc EM_WSIZE
loc EM_PSIZE
cii
1985-01-01 22:27:02 +00:00
ret EM_PSIZE
end