1988-06-22 16:57:09 +00:00
|
|
|
/*
|
|
|
|
* Sources of the "INCREMENT/DECREMENT/ZERO" group instructions
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* $Header$ */
|
|
|
|
|
|
|
|
#include <em_abs.h>
|
|
|
|
#include "global.h"
|
|
|
|
#include "log.h"
|
|
|
|
#include "nofloat.h"
|
|
|
|
#include "trap.h"
|
|
|
|
#include "mem.h"
|
|
|
|
#include "text.h"
|
|
|
|
#include "fra.h"
|
|
|
|
#include "warn.h"
|
|
|
|
|
|
|
|
PRIVATE long inc(), dec();
|
|
|
|
|
1990-06-21 12:16:31 +00:00
|
|
|
DoINC()
|
1988-06-22 16:57:09 +00:00
|
|
|
{
|
|
|
|
/* INC -: Increment word on top of stack by 1 (*) */
|
1990-06-21 12:16:31 +00:00
|
|
|
LOG(("@Z6 DoINC()"));
|
1988-06-22 16:57:09 +00:00
|
|
|
spoilFRA();
|
1989-11-22 13:38:37 +00:00
|
|
|
wpush(inc(swpop()));
|
1988-06-22 16:57:09 +00:00
|
|
|
}
|
|
|
|
|
1990-06-21 12:16:31 +00:00
|
|
|
DoINL(l)
|
|
|
|
register long l;
|
1988-06-22 16:57:09 +00:00
|
|
|
{
|
|
|
|
/* INL l: Increment local or parameter (*) */
|
|
|
|
register ptr p;
|
|
|
|
|
1990-06-21 12:16:31 +00:00
|
|
|
LOG(("@Z6 DoINL(%ld)", l));
|
1988-06-22 16:57:09 +00:00
|
|
|
spoilFRA();
|
1990-06-21 12:16:31 +00:00
|
|
|
p = loc_addr(arg_l(l));
|
1989-11-22 13:38:37 +00:00
|
|
|
st_stw(p, inc(st_ldsw(p)));
|
1988-06-22 16:57:09 +00:00
|
|
|
}
|
|
|
|
|
1990-06-21 12:16:31 +00:00
|
|
|
DoINE(arg)
|
|
|
|
register long arg;
|
1988-06-22 16:57:09 +00:00
|
|
|
{
|
|
|
|
/* INE g: Increment external (*) */
|
1990-06-21 12:16:31 +00:00
|
|
|
register ptr p = i2p(arg);
|
1988-06-22 16:57:09 +00:00
|
|
|
|
1990-06-21 12:16:31 +00:00
|
|
|
LOG(("@Z6 DoINE(%lu)", p));
|
1988-06-22 16:57:09 +00:00
|
|
|
spoilFRA();
|
|
|
|
p = arg_g(p);
|
1989-11-22 13:38:37 +00:00
|
|
|
dt_stw(p, inc(dt_ldsw(p)));
|
1988-06-22 16:57:09 +00:00
|
|
|
}
|
|
|
|
|
1990-06-21 12:16:31 +00:00
|
|
|
DoDEC()
|
1988-06-22 16:57:09 +00:00
|
|
|
{
|
|
|
|
/* DEC -: Decrement word on top of stack by 1 (*) */
|
1990-06-21 12:16:31 +00:00
|
|
|
LOG(("@Z6 DoDEC()"));
|
1988-06-22 16:57:09 +00:00
|
|
|
spoilFRA();
|
1989-11-22 13:38:37 +00:00
|
|
|
wpush(dec(swpop()));
|
1988-06-22 16:57:09 +00:00
|
|
|
}
|
|
|
|
|
1990-06-21 12:16:31 +00:00
|
|
|
DoDEL(l)
|
|
|
|
register long l;
|
1988-06-22 16:57:09 +00:00
|
|
|
{
|
|
|
|
/* DEL l: Decrement local or parameter (*) */
|
|
|
|
register ptr p;
|
|
|
|
|
1990-06-21 12:16:31 +00:00
|
|
|
LOG(("@Z6 DoDEL(%ld)", l));
|
1988-06-22 16:57:09 +00:00
|
|
|
spoilFRA();
|
|
|
|
l = arg_l(l);
|
|
|
|
p = loc_addr(l);
|
1989-11-22 13:38:37 +00:00
|
|
|
st_stw(p, dec(st_ldsw(p)));
|
1988-06-22 16:57:09 +00:00
|
|
|
}
|
|
|
|
|
1990-06-21 12:16:31 +00:00
|
|
|
DoDEE(arg)
|
|
|
|
register long arg;
|
1988-06-22 16:57:09 +00:00
|
|
|
{
|
|
|
|
/* DEE g: Decrement external (*) */
|
1990-06-21 12:16:31 +00:00
|
|
|
register ptr p = i2p(arg);
|
1988-06-22 16:57:09 +00:00
|
|
|
|
1990-06-21 12:16:31 +00:00
|
|
|
LOG(("@Z6 DoDEE(%lu)", p));
|
1988-06-22 16:57:09 +00:00
|
|
|
spoilFRA();
|
|
|
|
p = arg_g(p);
|
1989-11-22 13:38:37 +00:00
|
|
|
dt_stw(p, dec(dt_ldsw(p)));
|
1988-06-22 16:57:09 +00:00
|
|
|
}
|
|
|
|
|
1990-06-21 12:16:31 +00:00
|
|
|
DoZRL(l)
|
|
|
|
register long l;
|
1988-06-22 16:57:09 +00:00
|
|
|
{
|
|
|
|
/* ZRL l: Zero local or parameter */
|
|
|
|
|
1990-06-21 12:16:31 +00:00
|
|
|
LOG(("@Z6 DoZRL(%ld)", l));
|
1988-06-22 16:57:09 +00:00
|
|
|
spoilFRA();
|
|
|
|
l = arg_l(l);
|
1989-11-22 13:38:37 +00:00
|
|
|
st_stw(loc_addr(l), 0L);
|
1988-06-22 16:57:09 +00:00
|
|
|
}
|
|
|
|
|
1990-06-21 12:16:31 +00:00
|
|
|
DoZRE(arg)
|
|
|
|
register long arg;
|
1988-06-22 16:57:09 +00:00
|
|
|
{
|
|
|
|
/* ZRE g: Zero external */
|
1990-06-21 12:16:31 +00:00
|
|
|
register ptr p = i2p(arg);
|
1988-06-22 16:57:09 +00:00
|
|
|
|
1990-06-21 12:16:31 +00:00
|
|
|
LOG(("@Z6 DoZRE(%lu)", p));
|
1988-06-22 16:57:09 +00:00
|
|
|
spoilFRA();
|
1989-11-22 13:38:37 +00:00
|
|
|
dt_stw(arg_g(p), 0L);
|
1988-06-22 16:57:09 +00:00
|
|
|
}
|
|
|
|
|
1990-06-21 12:16:31 +00:00
|
|
|
DoZRF(l)
|
|
|
|
register size l;
|
1988-06-22 16:57:09 +00:00
|
|
|
{
|
|
|
|
/* ZRF w: Load a floating zero of size w */
|
|
|
|
#ifndef NOFLOAT
|
1990-06-21 12:16:31 +00:00
|
|
|
LOG(("@Z6 DoZRF(%ld)", l));
|
1988-06-22 16:57:09 +00:00
|
|
|
spoilFRA();
|
|
|
|
fpush(0.0, arg_wf(l));
|
|
|
|
#else NOFLOAT
|
|
|
|
arg = arg;
|
|
|
|
nofloat();
|
|
|
|
#endif NOFLOAT
|
|
|
|
}
|
|
|
|
|
1990-06-21 12:16:31 +00:00
|
|
|
DoZER(l)
|
|
|
|
register size l;
|
1988-06-22 16:57:09 +00:00
|
|
|
{
|
|
|
|
/* ZER w: Load w zero bytes */
|
1990-06-21 12:16:31 +00:00
|
|
|
register size i;
|
1988-06-22 16:57:09 +00:00
|
|
|
|
1990-06-21 12:16:31 +00:00
|
|
|
LOG(("@Z6 DoZER(%ld)", l));
|
1988-06-22 16:57:09 +00:00
|
|
|
spoilFRA();
|
1990-06-21 12:16:31 +00:00
|
|
|
npush(0L, arg_w(l));
|
1988-06-22 16:57:09 +00:00
|
|
|
|
1990-06-21 12:16:31 +00:00
|
|
|
/*
|
1988-06-22 16:57:09 +00:00
|
|
|
for (i = arg_w(l); i; i -= wsize)
|
1989-11-13 15:36:12 +00:00
|
|
|
wpush(0L);
|
1990-06-21 12:16:31 +00:00
|
|
|
*/
|
1988-06-22 16:57:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
PRIVATE long inc(l)
|
|
|
|
long l;
|
|
|
|
{
|
|
|
|
if (must_test && !(IgnMask&BIT(EIOVFL))) {
|
|
|
|
if (l == i_maxsw)
|
|
|
|
trap(EIOVFL);
|
|
|
|
}
|
|
|
|
return (l + 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
PRIVATE long dec(l)
|
|
|
|
long l;
|
|
|
|
{
|
|
|
|
if (must_test && !(IgnMask&BIT(EIOVFL))) {
|
|
|
|
if (l == i_minsw)
|
|
|
|
trap(EIOVFL);
|
|
|
|
}
|
|
|
|
return (l - 1);
|
|
|
|
}
|
|
|
|
|