elea9003-emu/telescrivente.c

46 lines
1.1 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <stdio.h>
#include "elea_tipi.h"
#include "governo.h"
#include "memoria.h"
static const carattere mappa_caratteri[64][3] = {
"0", "1", "~", "2", "4", "+", "#", "3", "5", "6", "/", "7", "9", "-", "÷", "8",
"Φ", "A", "δ", "B", "D", "=", "α", "C", "E", "F", "%", "G", "I", ",", "γ", "H",
".", "S", "θ", "T", "V", "!", ")", "U", "W", "X", "?", "Y", "\'", "&", "", "Z",
"ε", "J", "*", "K", "M", "(", "β", "L", "N", "O", "$", "η", "R", "P", "π", "Q"
};
int op_cm(istruzione *i)
{
return 0;
}
int op_ms(istruzione *i)
{
struct istruzione_gen *ms = &i->gen;
indirizzo ind;
int len;
int j;
int r;
carattere c, *stampabile;
r = estrai_cifra(ms->L[0]);
if (r < 0)
return -1; /* Errore */
len = r;
r = estrai_cifra(ms->L[1]);
if (r < 0)
return -1; /* Errore */
len += 10 * r;
ind = estrai_indirizzo(ms->I);
if (ind == (indirizzo)(-1))
return -1; /* Errore */
for (j = 0; j < len; j++) {
c = mem_leggi_carattere((uint32_t)(ind + j));
printf("%s", mappa_caratteri[c]);
}
printf("\r\n");
return 0;
}