governo.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. #include "elea_tipi.h"
  2. #include "governo.h"
  3. #include "memoria.h"
  4. #include "ricerca.h"
  5. #include "algebra.h"
  6. #include "accumulatore.h"
  7. #include "telescrivente.h"
  8. struct registri_sistema R;
  9. int op_salto(istruzione *i)
  10. {
  11. return 0;
  12. }
  13. static operazione *OP[64] = {
  14. /* 0 = OP_SALTO */ op_salto,
  15. /* 1 = OP_MEM */ op_mem,
  16. /* 2 = NO OP! */ (operazione *)0,
  17. /* 3 = OP_RIa */ op_ria,
  18. /* 4 = OP_-CT */ op_meno_ct,
  19. /* 5 = OP_+CT */ op_piu_ct,
  20. /* 6 = OP_CCT */ op_cct,
  21. /* 7 = OP_+MM */ op_piu_mm,
  22. /* 8 = NO OP! */ (operazione *)0,
  23. /* 9 = NO OP! */ (operazione *)0,
  24. /* 10 = OP_CMM */ op_cmm,
  25. /* 11 = OP_RIi */ op_rii,
  26. /* 12 = OP_CT */ op_ct,
  27. /* 13 = NO OP! */ (operazione *)0,
  28. /* 14 = OP_PUM */ op_pum,
  29. /* 15 = OP_-MM */ op_meno_mm,
  30. /* 16 = OP_MS */ op_ms,
  31. /* 17 = OP_DA */ op_da,
  32. /* 18 = OP_FAM */ op_fam,
  33. /* 19 = OP_AoM */ op_aom,
  34. /* 20 = NO OP! */ (operazione *)0,
  35. /* 21 = OP_+X */ op_piu_x,
  36. /* 22 = NO OP! */ (operazione *)0,
  37. /* 23 = OP_+MA */ op_piu_ma,
  38. /* 24 = OP_CMA */ op_cma,
  39. /* 25 = OP_MA */ op_ma,
  40. /* 26 = OP_CM */ op_cm,
  41. /* 27 = OP_AM */ op_am,
  42. /* 28 = NO OP! */ (operazione *)0,
  43. /* 29 = OP_-X */ op_meno_x,
  44. /* 30 = OP_+AM */ op_piu_am,
  45. /* 31 = OP_-MA */ op_meno_ma,
  46. /* 32 = NO OP! */ (operazione *)0,
  47. /* 33 = NO OP! */ (operazione *)0,
  48. /* 34 = OP_FTM */ op_ftm,
  49. /* 35 = OP_ToM */ op_tom,
  50. /* 36 = OP_+LD */ op_piu_ld,
  51. /* 37 = OP_XLD */ op_xld,
  52. /* 38 = NO OP! */ (operazione *)0,
  53. /* 39 = OP_+MT */ op_piu_mt,
  54. /* 40 = OP_CMT */ op_cmt,
  55. /* 41 = OP_MT */ op_mt,
  56. /* 42 = NO OP! */ (operazione *)0,
  57. /* 43 = OP_TM */ op_tm,
  58. /* 44 = NO OP! */ (operazione *)0,
  59. /* 45 = OP_XLN */ op_xln,
  60. /* 46 = OP_+TM */ op_piu_tm,
  61. /* 47 = OP_-MT */ op_meno_mt,
  62. /* 48 = NO OP! */ (operazione *)0,
  63. /* 49 = NO OP! */ (operazione *)0,
  64. /* 50 = NO OP! */ (operazione *)0,
  65. /* 51 = NO OP! */ (operazione *)0,
  66. /* 52 = NO OP! */ (operazione *)0,
  67. /* 53 = NO OP! */ (operazione *)0,
  68. /* 54 = NO OP! */ (operazione *)0,
  69. /* 55 = NO OP! */ (operazione *)0,
  70. /* 56 = NO OP! */ (operazione *)0,
  71. /* 57 = NO OP! */ (operazione *)0,
  72. /* 59 = NO OP! */ (operazione *)0,
  73. /* 60 = NO OP! */ (operazione *)0,
  74. /* 61 = NO OP! */ (operazione *)0,
  75. /* 62 = NO OP! */ (operazione *)0,
  76. /* 63 = NO OP! */ (operazione *)0,
  77. /* 64 = NO OP! */ (operazione *)0
  78. };
  79. static booleano CanaleInternoOcc = NO;
  80. static booleano CanaleEsternoOcc = NO;
  81. static uint32_t N_Cicli = 0;
  82. booleano canale_interno_occupato(void)
  83. {
  84. return CanaleInternoOcc;
  85. }
  86. booleano canale_esterno_occupato(void)
  87. {
  88. return CanaleEsternoOcc;
  89. }
  90. void esegui_primo_programma(void)
  91. {
  92. istruzione *i = R.I;
  93. R.I += sizeof(istruzione);
  94. carattere F = *((carattere *)i);
  95. if (OP[F] != (operazione *)0) {
  96. (*OP[F])(i);
  97. } else {
  98. /* TODO: fault */
  99. }
  100. }