|
@@ -0,0 +1,41 @@
|
|
|
+#include "elea_tipi.h"
|
|
|
+
|
|
|
+statico carattere Accumulatore[100];
|
|
|
+statico int REG_DA = 0;
|
|
|
+statico 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 = (REG_DA + 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[REG_DA + i] = (mem[pos] & 0x7F);
|
|
|
+ Accumulatore[REG_DA + i] &= ~0x80;
|
|
|
+ }
|
|
|
+ /* accende gA nell'ultimo carattere */
|
|
|
+ Accumulatore[REG_DA + lun - 1] |= 0x80;
|
|
|
+}
|
|
|
+
|
|
|
+int DA(const int disp)
|
|
|
+{
|
|
|
+ if (disp < 0 || disp > 99)
|
|
|
+ return -1;
|
|
|
+ REG_DA = disp;
|
|
|
+ return REG_DA;
|
|
|
+}
|