elea9003-emu/telescrivente.c
2019-12-24 14:19:15 +01:00

46 rivejä
1,1 KiB
C
Raaka Selitys Historia

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;
uint32_t 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 == (uint32_t)(-1))
return -1; /* Errore */
for (j = 0; j < len; j++) {
c = mem_leggi_carattere(ind + j);
printf("%s", mappa_caratteri[c]);
}
printf("\r\n");
return 0;
}