|
@@ -1,47 +1,23 @@
|
|
|
#include "elea_tipi.h"
|
|
|
#include "governo.h"
|
|
|
+#include "memoria.h"
|
|
|
|
|
|
static carattere Accumulatore[100];
|
|
|
static segno REG_SEGNO_A = 0;
|
|
|
|
|
|
-/* Da accumulatore a memoria */
|
|
|
-int AoM(carattere *mem, int lun)
|
|
|
-{
|
|
|
- int i;
|
|
|
- int pos;
|
|
|
- for (i = 0; i < lun; i++) {
|
|
|
- pos = (R.P + lun - (i + 1));
|
|
|
- mem[i] = (Accumulatore[pos] & 0x7F);
|
|
|
- Accumulatore[pos] = 0x80;
|
|
|
- }
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-/* Da memoria a accumulatore */
|
|
|
-int MA(const carattere *mem, int lun)
|
|
|
-{
|
|
|
- int i;
|
|
|
- int pos;
|
|
|
-
|
|
|
- for (i = 0; i < lun; i++) {
|
|
|
- pos = (lun - (i + 1));
|
|
|
- Accumulatore[R.P + i] = (mem[pos] & 0x7F);
|
|
|
- Accumulatore[R.P + i] &= ~0x80;
|
|
|
- }
|
|
|
- /* accende gA nell'ultimo carattere */
|
|
|
- Accumulatore[R.P + lun - 1] |= 0x80;
|
|
|
-}
|
|
|
-
|
|
|
-int DA(const int disp)
|
|
|
-{
|
|
|
- if (disp < 0 || disp > 99)
|
|
|
- return -1;
|
|
|
- R.P = disp;
|
|
|
- return R.P;
|
|
|
-}
|
|
|
-
|
|
|
int op_da(istruzione *i)
|
|
|
{
|
|
|
+ int r;
|
|
|
+ int da;
|
|
|
+ r = estrai_cifra(i->da.I[0]);
|
|
|
+ if (r < 0)
|
|
|
+ return -1;
|
|
|
+ da = r;
|
|
|
+ r = estrai_cifra(i->da.I[1]);
|
|
|
+ if (r < 0)
|
|
|
+ return -1;
|
|
|
+ da += 10 * r;
|
|
|
+ R.P = da;
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -52,6 +28,21 @@ int op_fam(istruzione *i)
|
|
|
|
|
|
int op_aom(istruzione *i)
|
|
|
{
|
|
|
+ int pos;
|
|
|
+ indirizzo mem;
|
|
|
+ int lun;
|
|
|
+ int j;
|
|
|
+ mem = estrai_indirizzo(i->gen.I);
|
|
|
+ if (mem == (uint32_t)(-1))
|
|
|
+ return -1;
|
|
|
+ lun = estrai_lunghezza(i->gen.L);
|
|
|
+
|
|
|
+ for (j = 0; j < lun; j++) {
|
|
|
+ pos = (R.P + lun - (j + 1));
|
|
|
+ mem_scrivi_carattere(mem + j, Accumulatore[pos] & 0x7F);
|
|
|
+ /* Azzeramento */
|
|
|
+ Accumulatore[pos] = 0x80;
|
|
|
+ }
|
|
|
return 0;
|
|
|
}
|
|
|
int op_piu_ma(istruzione *i)
|
|
@@ -64,8 +55,31 @@ int op_cma(istruzione *i)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+/* Da memoria a accumulatore */
|
|
|
int op_ma(istruzione *i)
|
|
|
{
|
|
|
+ int j;
|
|
|
+ int pos;
|
|
|
+ int lun;
|
|
|
+ int r;
|
|
|
+ indirizzo mem;
|
|
|
+
|
|
|
+ mem = estrai_indirizzo(i->gen.I);
|
|
|
+ if (mem == (uint32_t)(-1))
|
|
|
+ return -1;
|
|
|
+
|
|
|
+ lun = estrai_lunghezza(i->gen.L);
|
|
|
+ if (lun < 0)
|
|
|
+ return -1;
|
|
|
+ for (j = 0; j < lun; j++) {
|
|
|
+ carattere c;
|
|
|
+ pos = (lun - (j + 1));
|
|
|
+ c = mem_leggi_carattere(mem);
|
|
|
+ Accumulatore[R.P + j] = c & 0x7f;
|
|
|
+ Accumulatore[R.P + j] &= ~0x80;
|
|
|
+ }
|
|
|
+ /* accende gA nell'ultimo carattere */
|
|
|
+ Accumulatore[R.P + lun - j] |= 0x80;
|
|
|
return 0;
|
|
|
}
|
|
|
|