fixup commit for tag 'release-6-0-pre-3'
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
IMPLEMENTATION MODULE ASCII;
|
||||
BEGIN
|
||||
END ASCII.
|
||||
@@ -1,131 +0,0 @@
|
||||
#include <m2_traps.h>
|
||||
;
|
||||
; (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||
; See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||
;
|
||||
;
|
||||
; Module: CARDINAL operations with overflow checking
|
||||
; Author: Ceriel J.H. Jacobs
|
||||
; Version: $Header$
|
||||
;
|
||||
|
||||
mes 2,EM_WSIZE,EM_PSIZE
|
||||
|
||||
exp $addu
|
||||
exp $subu
|
||||
exp $mulu
|
||||
#if EM_WSIZE < EM_LSIZE
|
||||
exp $addul
|
||||
exp $subul
|
||||
exp $mulul
|
||||
#endif
|
||||
|
||||
pro $addu,0
|
||||
loc -1
|
||||
lol 0
|
||||
sbu EM_WSIZE
|
||||
lol EM_WSIZE
|
||||
cmu EM_WSIZE
|
||||
zge *1
|
||||
loc M2_UOVFL
|
||||
trp
|
||||
1
|
||||
lol 0
|
||||
lol EM_WSIZE
|
||||
adu EM_WSIZE
|
||||
stl EM_WSIZE
|
||||
ret 0
|
||||
end 0
|
||||
|
||||
#if EM_WSIZE < EM_LSIZE
|
||||
pro $addul,0
|
||||
ldc -1
|
||||
ldl 0
|
||||
sbu EM_LSIZE
|
||||
ldl EM_LSIZE
|
||||
cmu EM_LSIZE
|
||||
zge *1
|
||||
loc M2_UOVFL
|
||||
trp
|
||||
1
|
||||
ldl 0
|
||||
ldl EM_LSIZE
|
||||
adu EM_LSIZE
|
||||
sdl EM_LSIZE
|
||||
ret 0
|
||||
end 0
|
||||
#endif
|
||||
|
||||
pro $mulu,0
|
||||
lol 0
|
||||
zeq *1
|
||||
loc -1
|
||||
lol 0
|
||||
dvu EM_WSIZE
|
||||
lol EM_WSIZE
|
||||
cmu EM_WSIZE
|
||||
zge *1
|
||||
loc M2_UOVFL
|
||||
trp
|
||||
1
|
||||
lol 0
|
||||
lol EM_WSIZE
|
||||
mlu EM_WSIZE
|
||||
stl EM_WSIZE
|
||||
ret 0
|
||||
end 0
|
||||
|
||||
#if EM_WSIZE < EM_LSIZE
|
||||
pro $mulul,0
|
||||
ldl 0
|
||||
ldc 0
|
||||
cmu EM_LSIZE
|
||||
zeq *1
|
||||
ldc -1
|
||||
ldl 0
|
||||
dvu EM_LSIZE
|
||||
ldl EM_LSIZE
|
||||
cmu EM_LSIZE
|
||||
zge *1
|
||||
loc M2_UOVFL
|
||||
trp
|
||||
1
|
||||
ldl 0
|
||||
ldl EM_LSIZE
|
||||
mlu EM_LSIZE
|
||||
sdl EM_LSIZE
|
||||
ret 0
|
||||
end 0
|
||||
#endif
|
||||
|
||||
pro $subu,0
|
||||
lol EM_WSIZE
|
||||
lol 0
|
||||
cmu EM_WSIZE
|
||||
zge *1
|
||||
loc M2_UUVFL
|
||||
trp
|
||||
1
|
||||
lol EM_WSIZE
|
||||
lol 0
|
||||
sbu EM_WSIZE
|
||||
stl EM_WSIZE
|
||||
ret 0
|
||||
end 0
|
||||
|
||||
#if EM_WSIZE < EM_LSIZE
|
||||
pro $subul,0
|
||||
ldl EM_LSIZE
|
||||
ldl 0
|
||||
cmu EM_LSIZE
|
||||
zge *1
|
||||
loc M2_UUVFL
|
||||
trp
|
||||
1
|
||||
ldl EM_LSIZE
|
||||
ldl 0
|
||||
sbu EM_LSIZE
|
||||
sdl EM_LSIZE
|
||||
ret 0
|
||||
end 0
|
||||
#endif
|
||||
@@ -1,13 +0,0 @@
|
||||
(*$Foreign*)
|
||||
DEFINITION MODULE FIFFEF;
|
||||
|
||||
PROCEDURE FIF(arg1, arg2: LONGREAL; VAR intres: LONGREAL) : LONGREAL;
|
||||
(* multiplies arg1 and arg2, and returns the integer part of the
|
||||
result in "intres" and the fraction part as the function result.
|
||||
*)
|
||||
|
||||
PROCEDURE FEF(arg: LONGREAL; VAR exp: INTEGER) : LONGREAL;
|
||||
(* splits "arg" in mantissa and a base-2 exponent.
|
||||
The mantissa is returned, and the exponent is left in "exp".
|
||||
*)
|
||||
END FIFFEF.
|
||||
@@ -1,46 +0,0 @@
|
||||
#
|
||||
mes 2,EM_WSIZE,EM_PSIZE
|
||||
|
||||
#define ARG1 0
|
||||
#define ARG2 EM_DSIZE
|
||||
#define IRES 2*EM_DSIZE
|
||||
|
||||
; FIF is called with three parameters:
|
||||
; - address of integer part result (IRES)
|
||||
; - float two (ARG2)
|
||||
; - float one (ARG1)
|
||||
; and returns an EM_DSIZE-byte floating point number
|
||||
; Definition:
|
||||
; PROCEDURE FIF(ARG1, ARG2: LONGREAL; VAR IRES: LONGREAL) : LONGREAL;
|
||||
|
||||
exp $FIF
|
||||
pro $FIF,0
|
||||
lal 0
|
||||
loi 2*EM_DSIZE
|
||||
fif EM_DSIZE
|
||||
lal IRES
|
||||
loi EM_PSIZE
|
||||
sti EM_DSIZE
|
||||
ret EM_DSIZE
|
||||
end ?
|
||||
|
||||
#define FARG 0
|
||||
#define ERES EM_DSIZE
|
||||
|
||||
; FEF is called with two parameters:
|
||||
; - address of base 2 exponent result (ERES)
|
||||
; - floating point number to be split (FARG)
|
||||
; and returns an EM_DSIZE-byte floating point number (the mantissa)
|
||||
; Definition:
|
||||
; PROCEDURE FEF(FARG: LONGREAL; VAR ERES: integer): LONGREAL;
|
||||
|
||||
exp $FEF
|
||||
pro $FEF,0
|
||||
lal FARG
|
||||
loi EM_DSIZE
|
||||
fef EM_DSIZE
|
||||
lal ERES
|
||||
loi EM_PSIZE
|
||||
sti EM_WSIZE
|
||||
ret EM_DSIZE
|
||||
end ?
|
||||
@@ -1,8 +0,0 @@
|
||||
static char m[] = "Warning: FOR-loop control variable was changed in the body";
|
||||
_forloopchk(a,b)
|
||||
unsigned a, b;
|
||||
{
|
||||
if (a != b) {
|
||||
Traps_Message(m , 0, sizeof(m) - 2, 1);
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
HOME = ../../..
|
||||
DEFDIR = $(HOME)/lib/m2
|
||||
|
||||
SOURCES = ASCII.def EM.def MathLib0.def Processes.def \
|
||||
RealInOut.def Storage.def Arguments.def Conversion.def \
|
||||
random.def Semaphores.def Unix.def RealConver.def \
|
||||
Strings.def InOut.def Terminal.def \
|
||||
Mathlib.def PascalIO.def Traps.def CSP.def \
|
||||
Epilogue.def Streams.def ArraySort.def StripUnix.def \
|
||||
Termcap.def XXTermcap.def
|
||||
|
||||
all:
|
||||
clean:
|
||||
cmp:
|
||||
|
||||
pr:
|
||||
@pr Makefile $(SOURCES)
|
||||
opr:
|
||||
make pr | opr
|
||||
|
||||
install:
|
||||
-mkdir $(DEFDIR)
|
||||
cp $(SOURCES) $(DEFDIR)
|
||||
@@ -1,3 +0,0 @@
|
||||
DEFINITION MODULE TTY;
|
||||
PROCEDURE isatty(fd: INTEGER): BOOLEAN;
|
||||
END TTY.
|
||||
@@ -1,19 +0,0 @@
|
||||
#
|
||||
(*$R-*)
|
||||
IMPLEMENTATION MODULE TTY;
|
||||
FROM Unix IMPORT ioctl;
|
||||
FROM SYSTEM IMPORT ADR;
|
||||
PROCEDURE isatty(fd: INTEGER): BOOLEAN;
|
||||
VAR buf: ARRAY[1..100] OF CHAR;
|
||||
BEGIN
|
||||
#ifdef __USG
|
||||
RETURN ioctl(fd, INTEGER(ORD('T') * 256 + 1), ADR(buf)) >= 0;
|
||||
#else
|
||||
#ifdef __BSD4_2
|
||||
RETURN ioctl(fd, INTEGER(ORD('t') * 256 + 8 + 6*65536 + 40000000H), ADR(buf)) >= 0;
|
||||
#else
|
||||
RETURN ioctl(fd, INTEGER(ORD('t') * 256 + 8), ADR(buf)) >= 0;
|
||||
#endif
|
||||
#endif
|
||||
END isatty;
|
||||
END TTY.
|
||||
@@ -1,29 +0,0 @@
|
||||
#
|
||||
|
||||
; $Header$
|
||||
;
|
||||
; (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||
;
|
||||
; This product is part of the Amsterdam Compiler Kit.
|
||||
;
|
||||
; Permission to use, sell, duplicate or disclose this software must be
|
||||
; obtained in writing. Requests for such permissions may be sent to
|
||||
;
|
||||
; Dr. Andrew S. Tanenbaum
|
||||
; Wiskundig Seminarium
|
||||
; Vrije Universiteit
|
||||
; Postbox 7161
|
||||
; 1007 MC Amsterdam
|
||||
; The Netherlands
|
||||
;
|
||||
;
|
||||
|
||||
mes 2,EM_WSIZE,EM_PSIZE
|
||||
|
||||
; _hol0 return the address of the ABS block (hol0)
|
||||
|
||||
exp $_hol0
|
||||
pro $_hol0,0
|
||||
lae 0
|
||||
ret EM_PSIZE
|
||||
end ?
|
||||
@@ -1,31 +0,0 @@
|
||||
#
|
||||
;
|
||||
; (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||
; See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||
;
|
||||
;
|
||||
; Module: range checks for INTEGER, now for array indexing
|
||||
; Author: Ceriel J.H. Jacobs
|
||||
; Version: $Header$
|
||||
;
|
||||
#include <em_abs.h>
|
||||
|
||||
mes 2,EM_WSIZE,EM_PSIZE
|
||||
exp $rcka
|
||||
pro $rcka, 0
|
||||
|
||||
lol EM_PSIZE
|
||||
zlt *1 ; lower bound always 0
|
||||
lol EM_PSIZE
|
||||
lal 0
|
||||
loi EM_PSIZE
|
||||
adp EM_WSIZE
|
||||
loi EM_WSIZE
|
||||
cmi EM_WSIZE
|
||||
zgt *1
|
||||
ret 0
|
||||
1
|
||||
loc EARRAY
|
||||
trp
|
||||
ret 0
|
||||
end 0
|
||||
@@ -1,37 +0,0 @@
|
||||
#
|
||||
;
|
||||
; (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||
; See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||
;
|
||||
;
|
||||
; Module: range checks for INTEGER
|
||||
; Author: Ceriel J.H. Jacobs
|
||||
; Version: $Header$
|
||||
;
|
||||
#include <em_abs.h>
|
||||
|
||||
mes 2,EM_WSIZE,EM_PSIZE
|
||||
exp $rcki
|
||||
pro $rcki, 0
|
||||
|
||||
lal EM_PSIZE
|
||||
loi EM_WSIZE
|
||||
lal 0
|
||||
loi EM_PSIZE
|
||||
loi EM_WSIZE
|
||||
cmi EM_WSIZE
|
||||
zlt *1
|
||||
lal EM_PSIZE
|
||||
loi EM_WSIZE
|
||||
lal 0
|
||||
loi EM_PSIZE
|
||||
adp EM_WSIZE
|
||||
loi EM_WSIZE
|
||||
cmi EM_WSIZE
|
||||
zgt *1
|
||||
ret 0
|
||||
1
|
||||
loc ERANGE
|
||||
trp
|
||||
ret 0
|
||||
end 0
|
||||
@@ -1,37 +0,0 @@
|
||||
#
|
||||
;
|
||||
; (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||
; See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||
;
|
||||
;
|
||||
; Module: range checks for LONGINTS
|
||||
; Author: Ceriel J.H. Jacobs
|
||||
; Version: $Header$
|
||||
;
|
||||
#include <em_abs.h>
|
||||
|
||||
mes 2,EM_WSIZE,EM_PSIZE
|
||||
exp $rckil
|
||||
pro $rckil, 0
|
||||
|
||||
lal EM_PSIZE
|
||||
loi EM_LSIZE
|
||||
lal 0
|
||||
loi EM_PSIZE
|
||||
loi EM_LSIZE
|
||||
cmi EM_LSIZE
|
||||
zlt *1
|
||||
lal EM_PSIZE
|
||||
loi EM_LSIZE
|
||||
lal 0
|
||||
loi EM_PSIZE
|
||||
adp EM_LSIZE
|
||||
loi EM_LSIZE
|
||||
cmi EM_LSIZE
|
||||
zgt *1
|
||||
ret 0
|
||||
1
|
||||
loc ERANGE
|
||||
trp
|
||||
ret 0
|
||||
end 0
|
||||
@@ -1,37 +0,0 @@
|
||||
#
|
||||
;
|
||||
; (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||
; See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||
;
|
||||
;
|
||||
; Module: range checks for CARDINAL
|
||||
; Author: Ceriel J.H. Jacobs
|
||||
; Version: $Header$
|
||||
;
|
||||
#include <em_abs.h>
|
||||
|
||||
mes 2,EM_WSIZE,EM_PSIZE
|
||||
exp $rcku
|
||||
pro $rcku, 0
|
||||
|
||||
lal EM_PSIZE
|
||||
loi EM_WSIZE
|
||||
lal 0
|
||||
loi EM_PSIZE
|
||||
loi EM_WSIZE
|
||||
cmu EM_WSIZE
|
||||
zlt *1
|
||||
lal EM_PSIZE
|
||||
loi EM_WSIZE
|
||||
lal 0
|
||||
loi EM_PSIZE
|
||||
adp EM_WSIZE
|
||||
loi EM_WSIZE
|
||||
cmu EM_WSIZE
|
||||
zgt *1
|
||||
ret 0
|
||||
1
|
||||
loc ERANGE
|
||||
trp
|
||||
ret 0
|
||||
end 0
|
||||
@@ -1,37 +0,0 @@
|
||||
#
|
||||
;
|
||||
; (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||
; See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||
;
|
||||
;
|
||||
; Module: Range checks for LONGCARD
|
||||
; Author: Ceriel J.H. Jacobs
|
||||
; Version: $Header$
|
||||
;
|
||||
#include <em_abs.h>
|
||||
|
||||
mes 2,EM_WSIZE,EM_PSIZE
|
||||
exp $rckul
|
||||
pro $rckul, 0
|
||||
|
||||
lal EM_PSIZE
|
||||
loi EM_LSIZE
|
||||
lal 0
|
||||
loi EM_PSIZE
|
||||
loi EM_LSIZE
|
||||
cmu EM_LSIZE
|
||||
zlt *1
|
||||
lal EM_PSIZE
|
||||
loi EM_LSIZE
|
||||
lal 0
|
||||
loi EM_PSIZE
|
||||
adp EM_LSIZE
|
||||
loi EM_LSIZE
|
||||
cmu EM_LSIZE
|
||||
zgt *1
|
||||
ret 0
|
||||
1
|
||||
loc ERANGE
|
||||
trp
|
||||
ret 0
|
||||
end 0
|
||||
@@ -1,258 +0,0 @@
|
||||
#
|
||||
;
|
||||
; (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||
; See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||
;
|
||||
;
|
||||
; Module: implementation of coroutines
|
||||
; Author: Ceriel J.H. Jacobs
|
||||
; Version: $Header$
|
||||
;
|
||||
; This version works for EM implementations that have a contiguous downwards
|
||||
; growing stack, on which data below the stack-pointer is not destroyed.
|
||||
;
|
||||
#include <em_mes.h>
|
||||
#include <m2_traps.h>
|
||||
|
||||
mes 2, EM_WSIZE, EM_PSIZE
|
||||
|
||||
; This file contains the implementation of the following routines from
|
||||
; the SYSTEM module:
|
||||
; TRANSFER, NEWPROCESS
|
||||
; The NEWPROCESS routine creates a new coroutine stack frame.
|
||||
; The TRANSFER routine implements transfers from one coroutine to another.
|
||||
; The memory organization for coroutines is rather complicated.
|
||||
; One problem is caused by the fact that the user must allocate the
|
||||
; stackspace. So, this stackspace can be located anywhere, including on
|
||||
; the heap. This means that we cannot use this space as a stack, because
|
||||
; in EM, the stack-pointer may never point below the heap-pointer.
|
||||
; So, this space is only used to save the stack when the coroutine isn't
|
||||
; running.
|
||||
; It also contains information about the size of the frame, the
|
||||
; address of the procedure that forms the coroutine body, the offset
|
||||
; of the LB from the start of the frame, and the offset of the SP from
|
||||
; the start of the frame.
|
||||
; So, is looks like this:
|
||||
; |-----------------------------|
|
||||
; | |
|
||||
; | |
|
||||
; | |
|
||||
; .
|
||||
; .
|
||||
; .
|
||||
; | |
|
||||
; | |
|
||||
; | | <--- coroutine ident
|
||||
; |-----------------------------|
|
||||
; | saved SP |
|
||||
; |-----------------------------|
|
||||
; | saved LB |
|
||||
; |-----------------------------|
|
||||
; | procedure address or 0 |
|
||||
; |-----------------------------|
|
||||
; | size |
|
||||
; |-----------------------------|
|
||||
;
|
||||
; Another problem is that the coroutines must always run at the same
|
||||
; place in the stack. Therefore, in the runtime startoff a piece of the
|
||||
; stack is allocated for coroutines.
|
||||
|
||||
exp $_SYSTEM__NEWPROCESS
|
||||
exp $_SYSTEM__TRANSFER
|
||||
inp $ChkSize
|
||||
|
||||
pro $_SYSTEM__NEWPROCESS, 0
|
||||
|
||||
; This procedure only initializes the area used for saving the stack.
|
||||
; Its definition is:
|
||||
; PROCEDURE NEWPROCESS(P:PROC; A:ADDRESS; n:CARDINAL; VAR p1:ADDRESS);
|
||||
|
||||
lol 2*EM_PSIZE ; size of frame (n)
|
||||
cal $ChkSize
|
||||
asp EM_WSIZE
|
||||
lfr EM_WSIZE
|
||||
sil EM_PSIZE ; store size in area (indicated by A)
|
||||
lal EM_PSIZE
|
||||
loi EM_PSIZE ; address of area (A)
|
||||
lal 0
|
||||
loi EM_PSIZE ; address of coroutine body (P)
|
||||
lal EM_PSIZE
|
||||
loi EM_PSIZE
|
||||
adp EM_WSIZE
|
||||
sti EM_PSIZE ; store it in area
|
||||
lal EM_PSIZE
|
||||
loi EM_PSIZE
|
||||
adp 3*EM_PSIZE + EM_WSIZE ; this becomes the coroutine identifier
|
||||
lal 2*EM_PSIZE+EM_WSIZE
|
||||
loi EM_PSIZE
|
||||
sti EM_PSIZE
|
||||
ret 0
|
||||
end 0
|
||||
|
||||
target
|
||||
bss EM_PSIZE, 0, 0
|
||||
|
||||
pro $_SYSTEM__TRANSFER, 0
|
||||
|
||||
; This procedure does all the hard work.
|
||||
; It must save the current environment, and restore the one to which the
|
||||
; transfer is done. It must also make it look like the return is done
|
||||
; from ITS invocation of transfer.
|
||||
; Definition is:
|
||||
; PROCEDURE TRANSFER(VAR p1, p2 : ADDRESS);
|
||||
|
||||
mes ms_gto ; This is a dangerous procedure
|
||||
|
||||
lal EM_PSIZE
|
||||
loi EM_PSIZE
|
||||
loi EM_PSIZE ; address of target coroutine
|
||||
dup EM_PSIZE
|
||||
lae CurrentProcess
|
||||
loi EM_PSIZE
|
||||
dup EM_PSIZE
|
||||
lal 0
|
||||
loi EM_PSIZE ; address of place where to store address of current coroutine
|
||||
sti EM_PSIZE ; store
|
||||
cmp ; compare with current process
|
||||
zne *1
|
||||
; Here, no real transfer needs to be done
|
||||
asp EM_PSIZE
|
||||
ret 0 ; just return
|
||||
1
|
||||
lae target
|
||||
sti EM_PSIZE ; store it in target
|
||||
|
||||
; Now, we save the current stack
|
||||
; Use local base from main program
|
||||
|
||||
lor 0 ; load LB
|
||||
lae CurrentProcess
|
||||
loi EM_PSIZE
|
||||
adp -2*EM_PSIZE
|
||||
sti EM_PSIZE ; save it
|
||||
lor 1 ; load SP
|
||||
lae CurrentProcess
|
||||
loi EM_PSIZE
|
||||
adp -EM_PSIZE
|
||||
sti EM_PSIZE ; save it
|
||||
; Now, we must find a stack we can temporarily use.
|
||||
; Just take the one from the main program.
|
||||
lae MainProcess
|
||||
loi EM_PSIZE
|
||||
adp -EM_PSIZE
|
||||
loi EM_PSIZE
|
||||
str 1 ; temporary stackpointer
|
||||
|
||||
lae MainLB
|
||||
loi EM_PSIZE
|
||||
str 0
|
||||
|
||||
lae CurrentProcess
|
||||
loi EM_PSIZE
|
||||
lae MainProcess
|
||||
loi EM_PSIZE
|
||||
cmp
|
||||
zeq *2
|
||||
|
||||
lae StackBase
|
||||
loi EM_PSIZE
|
||||
lae CurrentProcess
|
||||
loi EM_PSIZE
|
||||
adp -3*EM_PSIZE-EM_WSIZE
|
||||
loi EM_WSIZE ; get size
|
||||
ngi EM_WSIZE
|
||||
ads EM_WSIZE ; gives source address
|
||||
lae CurrentProcess
|
||||
loi EM_PSIZE ; destination address
|
||||
lae CurrentProcess
|
||||
loi EM_PSIZE
|
||||
adp -3*EM_PSIZE-EM_WSIZE
|
||||
loi EM_WSIZE
|
||||
bls EM_WSIZE ; copy
|
||||
|
||||
2
|
||||
lae target
|
||||
loi EM_PSIZE
|
||||
dup EM_PSIZE
|
||||
lae CurrentProcess
|
||||
sti EM_PSIZE ; store target process descriptor in _CurrentProcess
|
||||
lae MainProcess
|
||||
loi EM_PSIZE
|
||||
cmp
|
||||
zeq *4
|
||||
; Now check if the coroutine was called before
|
||||
lae target
|
||||
loi EM_PSIZE
|
||||
adp -3*EM_PSIZE
|
||||
loi EM_PSIZE
|
||||
zer EM_PSIZE
|
||||
cmp
|
||||
zeq *5
|
||||
; No, it was'nt
|
||||
lae StackBase
|
||||
loi EM_PSIZE
|
||||
str 1 ; new stack pointer
|
||||
lae target
|
||||
loi EM_PSIZE
|
||||
adp -3*EM_PSIZE
|
||||
loi EM_PSIZE
|
||||
zer EM_PSIZE
|
||||
lae target
|
||||
loi EM_PSIZE
|
||||
adp -3*EM_PSIZE
|
||||
sti EM_PSIZE
|
||||
cai
|
||||
loc 0
|
||||
cal $exit
|
||||
ret 0
|
||||
5
|
||||
lae target
|
||||
loi EM_PSIZE ; push source address
|
||||
lae StackBase
|
||||
loi EM_PSIZE ; subtract size from this and we have the destination address
|
||||
lae target
|
||||
loi EM_PSIZE
|
||||
adp -3*EM_PSIZE-EM_WSIZE
|
||||
loi EM_WSIZE
|
||||
ngi EM_WSIZE
|
||||
ads EM_WSIZE ; got it
|
||||
lae target
|
||||
loi EM_PSIZE
|
||||
adp -3*EM_PSIZE-EM_WSIZE
|
||||
loi EM_WSIZE
|
||||
bls EM_WSIZE
|
||||
4
|
||||
lae target
|
||||
loi EM_PSIZE
|
||||
adp -2*EM_PSIZE
|
||||
loi EM_PSIZE
|
||||
str 0 ; restore LB
|
||||
lae target
|
||||
loi EM_PSIZE
|
||||
adp -EM_PSIZE
|
||||
loi EM_PSIZE
|
||||
str 1 ; restore SP
|
||||
ret 0
|
||||
end 0
|
||||
|
||||
pro $ChkSize, 0
|
||||
lol 0
|
||||
loc 3*EM_PSIZE+EM_WSIZE
|
||||
sbi EM_WSIZE
|
||||
dup EM_WSIZE
|
||||
stl 0
|
||||
loe StackSize
|
||||
cmu EM_WSIZE
|
||||
zle *1
|
||||
loc M2_TOOLARGE ; trap number for "stack size too large"
|
||||
trp
|
||||
1
|
||||
lol 0
|
||||
loc EM_WSIZE-1
|
||||
adi EM_WSIZE
|
||||
loc EM_WSIZE
|
||||
dvi EM_WSIZE
|
||||
loc EM_WSIZE
|
||||
mli EM_WSIZE
|
||||
ret EM_WSIZE
|
||||
end 0
|
||||
Reference in New Issue
Block a user