Subversion Repositories pentevo

Rev

Blame | Last modification | View Log | Download | RSS feed | ?url?

  1. #include "defs.h"
  2. #include "tables.h"
  3.  
  4. const unsigned char incf[] =
  5. {
  6.         0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08
  7.        ,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x10
  8.        ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08
  9.        ,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x30
  10.        ,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28
  11.        ,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x30
  12.        ,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28
  13.        ,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x10
  14.        ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08
  15.        ,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x10
  16.        ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08
  17.        ,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x30
  18.        ,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28
  19.        ,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x30
  20.        ,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28
  21.        ,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x94
  22.        ,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x88
  23.        ,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x90
  24.        ,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x88
  25.        ,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0xb0
  26.        ,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa8
  27.        ,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8,0xb0
  28.        ,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa8
  29.        ,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8,0x90
  30.        ,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x88
  31.        ,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x90
  32.        ,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x88
  33.        ,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0xb0
  34.        ,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa8
  35.        ,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8,0xb0
  36.        ,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa8
  37.        ,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8,0x50
  38. };
  39.  
  40. const unsigned char decf[] =
  41. {
  42.         0xba,0x42,0x02,0x02,0x02,0x02,0x02,0x02
  43.        ,0x02,0x0a,0x0a,0x0a,0x0a,0x0a,0x0a,0x0a
  44.        ,0x1a,0x02,0x02,0x02,0x02,0x02,0x02,0x02
  45.        ,0x02,0x0a,0x0a,0x0a,0x0a,0x0a,0x0a,0x0a
  46.        ,0x1a,0x22,0x22,0x22,0x22,0x22,0x22,0x22
  47.        ,0x22,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a
  48.        ,0x3a,0x22,0x22,0x22,0x22,0x22,0x22,0x22
  49.        ,0x22,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a
  50.        ,0x3a,0x02,0x02,0x02,0x02,0x02,0x02,0x02
  51.        ,0x02,0x0a,0x0a,0x0a,0x0a,0x0a,0x0a,0x0a
  52.        ,0x1a,0x02,0x02,0x02,0x02,0x02,0x02,0x02
  53.        ,0x02,0x0a,0x0a,0x0a,0x0a,0x0a,0x0a,0x0a
  54.        ,0x1a,0x22,0x22,0x22,0x22,0x22,0x22,0x22
  55.        ,0x22,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a
  56.        ,0x3a,0x22,0x22,0x22,0x22,0x22,0x22,0x22
  57.        ,0x22,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a
  58.        ,0x3e,0x82,0x82,0x82,0x82,0x82,0x82,0x82
  59.        ,0x82,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a
  60.        ,0x9a,0x82,0x82,0x82,0x82,0x82,0x82,0x82
  61.        ,0x82,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a
  62.        ,0x9a,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2
  63.        ,0xa2,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa
  64.        ,0xba,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2
  65.        ,0xa2,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa
  66.        ,0xba,0x82,0x82,0x82,0x82,0x82,0x82,0x82
  67.        ,0x82,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a
  68.        ,0x9a,0x82,0x82,0x82,0x82,0x82,0x82,0x82
  69.        ,0x82,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a
  70.        ,0x9a,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2
  71.        ,0xa2,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa
  72.        ,0xba,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2
  73.        ,0xa2,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa
  74. };
  75.  
  76. #ifdef __ICL
  77. unsigned char adcf[0x20000]; // flags for adc and add
  78.  
  79. static void make_adc()
  80. {
  81.     for(unsigned c = 0; c < 2; c++)
  82.     {
  83.         for(unsigned x = 0; x < 0x100; x++)
  84.         {
  85.             for(unsigned y = 0; y < 0x100; y++)
  86.             {
  87.  
  88.                 unsigned res = x + y + c;
  89.                 unsigned char fl = 0;
  90.                 if(!(res & 0xFF)) fl |= ZF;
  91.                 fl |= (res & (F3 | F5 | SF));
  92.                 if(res >= 0x100) fl |= CF;
  93.                 if(((x & 0x0F) + (y & 0x0F) + c) & 0x10) fl |= HF;
  94.                 int ri = (signed char)x + (signed char)y + int(c);
  95.                 if(ri >= 0x80 || ri <= -0x81) fl |= PV;
  96.  
  97.                 adcf[c * 0x10000 + x * 0x100 + y] = fl;
  98.             }
  99.         }
  100.     }
  101. }
  102. #else
  103. #undef adcf
  104. constexpr TMakeAdcf::TMakeAdcf() : adcf{ }
  105. {
  106.     for(unsigned c = 0; c < 2; c++)
  107.     {
  108.         for(unsigned x = 0; x < 0x100; x++)
  109.         {
  110.             for(unsigned y = 0; y < 0x100; y++)
  111.             {
  112.  
  113.                 unsigned res = x + y + c;
  114.                 unsigned char fl = 0;
  115.                 if(!(res & 0xFF)) fl |= ZF;
  116.                 fl |= (res & (F3 | F5 | SF));
  117.                 if(res >= 0x100) fl |= CF;
  118.                 if(((x & 0x0F) + (y & 0x0F) + c) & 0x10) fl |= HF;
  119.                 int ri = (signed char)x + (signed char)y + int(c);
  120.                 if(ri >= 0x80 || ri <= -0x81) fl |= PV;
  121.  
  122.                 adcf[c * 0x10000 + x * 0x100 + y] = fl;
  123.             }
  124.         }
  125.     }
  126. }
  127.  
  128. constexpr TMakeAdcf MakeAdcf;
  129. #endif
  130.  
  131. #ifdef __ICL
  132. unsigned char sbcf[0x20000]; // flags for sub and sbc
  133. unsigned char cpf[0x10000];  // flags for cp
  134. unsigned char cpf8b[0x10000]; // flags for CPD/CPI/CPDR/CPIR
  135.  
  136. static void make_sbc()
  137. {
  138.     for(int c = 0; c < 2; c++)
  139.     {
  140.         for(int x = 0; x < 0x100; x++)
  141.         {
  142.             for(int y = 0; y < 0x100; y++)
  143.             {
  144.                 int res = x - y - c;
  145.                 unsigned char fl = res & (F3 | F5 | SF);
  146.                 if(!(res & 0xFF)) fl |= ZF;
  147.                 if(res & 0x10000) fl |= CF;
  148.                 int r = (signed char)x - (signed char)y - c;
  149.                 if(r >= 0x80 || r < -0x80) fl |= PV;
  150.                 if(((x & 0x0F) - (res & 0x0F) - c) & 0x10) fl |= HF;
  151.                 fl |= NF;
  152.                 sbcf[c * 0x10000 + x * 0x100 + y] = fl;
  153.             }
  154.         }
  155.     }
  156.     for(int i = 0; i < 0x10000; i++)
  157.     {
  158.         cpf[i] = (sbcf[i] & ~(F3 | F5)) | (i & (F3 | F5));
  159.         unsigned char tempbyte = u8((i >> 8) - (i & 0xFF) - ((sbcf[i] & HF) >> 4));
  160.         cpf8b[i] = (sbcf[i] & ~(F3 | F5 | PV | CF)) + (tempbyte & F3) + ((tempbyte << 4) & F5);
  161.     }
  162. }
  163. #else
  164. #undef sbcf
  165. #undef cpf
  166. #undef cpf8b
  167.  
  168. constexpr TMakeSbc::TMakeSbc() : sbcf{ }, cpf{ }, cpf8b{ }
  169. {
  170.     for(int c = 0; c < 2; c++)
  171.     {
  172.         for(int x = 0; x < 0x100; x++)
  173.         {
  174.             for(int y = 0; y < 0x100; y++)
  175.             {
  176.                 int res = x - y - c;
  177.                 unsigned char fl = u8(res & (F3 | F5 | SF));
  178.                 if(!(res & 0xFF)) fl |= ZF;
  179.                 if(res & 0x10000) fl |= CF;
  180.                 int r = (signed char)x - (signed char)y - c;
  181.                 if(r >= 0x80 || r < -0x80) fl |= PV;
  182.                 if(((x & 0x0F) - (res & 0x0F) - c) & 0x10) fl |= HF;
  183.                 fl |= NF;
  184.                 sbcf[c * 0x10000 + x * 0x100 + y] = fl;
  185.             }
  186.         }
  187.     }
  188.     for(int i = 0; i < 0x10000; i++)
  189.     {
  190.         cpf[i] = (sbcf[i] & ~(F3 | F5)) | (i & (F3 | F5));
  191.         unsigned char tempbyte = u8((i >> 8) - (i & 0xFF) - ((sbcf[i] & HF) >> 4));
  192.         cpf8b[i] = (sbcf[i] & ~(F3 | F5 | PV | CF)) + (tempbyte & F3) + ((tempbyte << 4) & F5);
  193.     }
  194. }
  195.  
  196. constexpr TMakeSbc MakeSbc;
  197. #endif
  198.  
  199.  
  200. #ifdef __ICL
  201. unsigned char log_f[0x100];
  202. static void make_log()
  203. {
  204.    for (int x = 0; x < 0x100; x++) {
  205.       unsigned char fl = x & (F3|F5|SF);
  206.       unsigned char p = PV;
  207.       for (int i = 0x80; i; i /= 2)
  208.          if (x & i) p ^= PV;
  209.       log_f[x] = fl | p;
  210.    }
  211.    log_f[0] |= ZF;
  212. }
  213. #else
  214. #undef log_f
  215. constexpr TLogf::TLogf() : log_f{ }
  216. {
  217.     for(int x = 0; x < 0x100; x++)
  218.     {
  219.         unsigned char fl = x & (F3 | F5 | SF);
  220.         unsigned char p = PV;
  221.         for(int i = 0x80; i; i /= 2)
  222.             if(x & i) p ^= PV;
  223.         log_f[x] = fl | p;
  224.     }
  225.     log_f[0] |= ZF;
  226. }
  227.  
  228. constexpr TLogf Logf;
  229. #endif
  230.  
  231. constexpr u8 rlcf[0x100] = // for rlc r. may be for rlca (0x3B mask)
  232. {
  233.     0x44, 0x00, 0x00, 0x04, 0x08, 0x0c, 0x0c, 0x08
  234.     , 0x00, 0x04, 0x04, 0x00, 0x0c, 0x08, 0x08, 0x0c
  235.     , 0x20, 0x24, 0x24, 0x20, 0x2c, 0x28, 0x28, 0x2c
  236.     , 0x24, 0x20, 0x20, 0x24, 0x28, 0x2c, 0x2c, 0x28
  237.     , 0x00, 0x04, 0x04, 0x00, 0x0c, 0x08, 0x08, 0x0c
  238.     , 0x04, 0x00, 0x00, 0x04, 0x08, 0x0c, 0x0c, 0x08
  239.     , 0x24, 0x20, 0x20, 0x24, 0x28, 0x2c, 0x2c, 0x28
  240.     , 0x20, 0x24, 0x24, 0x20, 0x2c, 0x28, 0x28, 0x2c
  241.     , 0x80, 0x84, 0x84, 0x80, 0x8c, 0x88, 0x88, 0x8c
  242.     , 0x84, 0x80, 0x80, 0x84, 0x88, 0x8c, 0x8c, 0x88
  243.     , 0xa4, 0xa0, 0xa0, 0xa4, 0xa8, 0xac, 0xac, 0xa8
  244.     , 0xa0, 0xa4, 0xa4, 0xa0, 0xac, 0xa8, 0xa8, 0xac
  245.     , 0x84, 0x80, 0x80, 0x84, 0x88, 0x8c, 0x8c, 0x88
  246.     , 0x80, 0x84, 0x84, 0x80, 0x8c, 0x88, 0x88, 0x8c
  247.     , 0xa0, 0xa4, 0xa4, 0xa0, 0xac, 0xa8, 0xa8, 0xac
  248.     , 0xa4, 0xa0, 0xa0, 0xa4, 0xa8, 0xac, 0xac, 0xa8
  249.     , 0x01, 0x05, 0x05, 0x01, 0x0d, 0x09, 0x09, 0x0d
  250.     , 0x05, 0x01, 0x01, 0x05, 0x09, 0x0d, 0x0d, 0x09
  251.     , 0x25, 0x21, 0x21, 0x25, 0x29, 0x2d, 0x2d, 0x29
  252.     , 0x21, 0x25, 0x25, 0x21, 0x2d, 0x29, 0x29, 0x2d
  253.     , 0x05, 0x01, 0x01, 0x05, 0x09, 0x0d, 0x0d, 0x09
  254.     , 0x01, 0x05, 0x05, 0x01, 0x0d, 0x09, 0x09, 0x0d
  255.     , 0x21, 0x25, 0x25, 0x21, 0x2d, 0x29, 0x29, 0x2d
  256.     , 0x25, 0x21, 0x21, 0x25, 0x29, 0x2d, 0x2d, 0x29
  257.     , 0x85, 0x81, 0x81, 0x85, 0x89, 0x8d, 0x8d, 0x89
  258.     , 0x81, 0x85, 0x85, 0x81, 0x8d, 0x89, 0x89, 0x8d
  259.     , 0xa1, 0xa5, 0xa5, 0xa1, 0xad, 0xa9, 0xa9, 0xad
  260.     , 0xa5, 0xa1, 0xa1, 0xa5, 0xa9, 0xad, 0xad, 0xa9
  261.     , 0x81, 0x85, 0x85, 0x81, 0x8d, 0x89, 0x89, 0x8d
  262.     , 0x85, 0x81, 0x81, 0x85, 0x89, 0x8d, 0x8d, 0x89
  263.     , 0xa5, 0xa1, 0xa1, 0xa5, 0xa9, 0xad, 0xad, 0xa9
  264.     , 0xa1, 0xa5, 0xa5, 0xa1, 0xad, 0xa9, 0xa9, 0xad
  265. };
  266.  
  267. constexpr u8 rrcf[] = // rrc r. may be for rlca (0x3B mask)
  268. {
  269.     0x44, 0x81, 0x00, 0x85, 0x00, 0x85, 0x04, 0x81
  270.     , 0x00, 0x85, 0x04, 0x81, 0x04, 0x81, 0x00, 0x85
  271.     , 0x08, 0x8d, 0x0c, 0x89, 0x0c, 0x89, 0x08, 0x8d
  272.     , 0x0c, 0x89, 0x08, 0x8d, 0x08, 0x8d, 0x0c, 0x89
  273.     , 0x00, 0x85, 0x04, 0x81, 0x04, 0x81, 0x00, 0x85
  274.     , 0x04, 0x81, 0x00, 0x85, 0x00, 0x85, 0x04, 0x81
  275.     , 0x0c, 0x89, 0x08, 0x8d, 0x08, 0x8d, 0x0c, 0x89
  276.     , 0x08, 0x8d, 0x0c, 0x89, 0x0c, 0x89, 0x08, 0x8d
  277.     , 0x20, 0xa5, 0x24, 0xa1, 0x24, 0xa1, 0x20, 0xa5
  278.     , 0x24, 0xa1, 0x20, 0xa5, 0x20, 0xa5, 0x24, 0xa1
  279.     , 0x2c, 0xa9, 0x28, 0xad, 0x28, 0xad, 0x2c, 0xa9
  280.     , 0x28, 0xad, 0x2c, 0xa9, 0x2c, 0xa9, 0x28, 0xad
  281.     , 0x24, 0xa1, 0x20, 0xa5, 0x20, 0xa5, 0x24, 0xa1
  282.     , 0x20, 0xa5, 0x24, 0xa1, 0x24, 0xa1, 0x20, 0xa5
  283.     , 0x28, 0xad, 0x2c, 0xa9, 0x2c, 0xa9, 0x28, 0xad
  284.     , 0x2c, 0xa9, 0x28, 0xad, 0x28, 0xad, 0x2c, 0xa9
  285.     , 0x00, 0x85, 0x04, 0x81, 0x04, 0x81, 0x00, 0x85
  286.     , 0x04, 0x81, 0x00, 0x85, 0x00, 0x85, 0x04, 0x81
  287.     , 0x0c, 0x89, 0x08, 0x8d, 0x08, 0x8d, 0x0c, 0x89
  288.     , 0x08, 0x8d, 0x0c, 0x89, 0x0c, 0x89, 0x08, 0x8d
  289.     , 0x04, 0x81, 0x00, 0x85, 0x00, 0x85, 0x04, 0x81
  290.     , 0x00, 0x85, 0x04, 0x81, 0x04, 0x81, 0x00, 0x85
  291.     , 0x08, 0x8d, 0x0c, 0x89, 0x0c, 0x89, 0x08, 0x8d
  292.     , 0x0c, 0x89, 0x08, 0x8d, 0x08, 0x8d, 0x0c, 0x89
  293.     , 0x24, 0xa1, 0x20, 0xa5, 0x20, 0xa5, 0x24, 0xa1
  294.     , 0x20, 0xa5, 0x24, 0xa1, 0x24, 0xa1, 0x20, 0xa5
  295.     , 0x28, 0xad, 0x2c, 0xa9, 0x2c, 0xa9, 0x28, 0xad
  296.     , 0x2c, 0xa9, 0x28, 0xad, 0x28, 0xad, 0x2c, 0xa9
  297.     , 0x20, 0xa5, 0x24, 0xa1, 0x24, 0xa1, 0x20, 0xa5
  298.     , 0x24, 0xa1, 0x20, 0xa5, 0x20, 0xa5, 0x24, 0xa1
  299.     , 0x2c, 0xa9, 0x28, 0xad, 0x28, 0xad, 0x2c, 0xa9
  300.     , 0x28, 0xad, 0x2c, 0xa9, 0x2c, 0xa9, 0x28, 0xad
  301. };
  302.  
  303.  
  304. #ifdef __ICL
  305. unsigned char rlcaf[0x100];
  306. unsigned char rrcaf[0x100];
  307. unsigned char rol[0x100];
  308. unsigned char ror[0x100];
  309.  
  310. static void make_rot()
  311. {
  312.     for(int i = 0; i < 0x100; i++)
  313.     {
  314.         rlcaf[i] = rlcf[i] & 0x3B;        // rra,rla uses same tables
  315.         rrcaf[i] = rrcf[i] & 0x3B;
  316.         rol[i] = u8((i << 1) + (i >> 7));
  317.         ror[i] = u8((i >> 1) + (i << 7));
  318.     }
  319. }
  320. #else
  321. #undef rol
  322. #undef ror
  323. #undef rlcaf
  324. #undef rrcaf
  325. constexpr TMakeRot::TMakeRot() : rol{ }, ror{ }, rlcaf{ }, rrcaf{ }
  326. {
  327.     for(int i = 0; i < 0x100; i++)
  328.     {
  329.         rlcaf[i] = rlcf[i] & 0x3B;        // rra,rla uses same tables
  330.         rrcaf[i] = rrcf[i] & 0x3B;
  331.         rol[i] = u8((i << 1) + (i >> 7));
  332.         ror[i] = u8((i >> 1) + (i << 7));
  333.     }
  334. }
  335.  
  336. constexpr TMakeRot MakeRot;
  337. #endif
  338.  
  339. const unsigned char rl0[] =
  340. {
  341.         0x44,0x00,0x00,0x04,0x08,0x0c,0x0c,0x08
  342.        ,0x00,0x04,0x04,0x00,0x0c,0x08,0x08,0x0c
  343.        ,0x20,0x24,0x24,0x20,0x2c,0x28,0x28,0x2c
  344.        ,0x24,0x20,0x20,0x24,0x28,0x2c,0x2c,0x28
  345.        ,0x00,0x04,0x04,0x00,0x0c,0x08,0x08,0x0c
  346.        ,0x04,0x00,0x00,0x04,0x08,0x0c,0x0c,0x08
  347.        ,0x24,0x20,0x20,0x24,0x28,0x2c,0x2c,0x28
  348.        ,0x20,0x24,0x24,0x20,0x2c,0x28,0x28,0x2c
  349.        ,0x80,0x84,0x84,0x80,0x8c,0x88,0x88,0x8c
  350.        ,0x84,0x80,0x80,0x84,0x88,0x8c,0x8c,0x88
  351.        ,0xa4,0xa0,0xa0,0xa4,0xa8,0xac,0xac,0xa8
  352.        ,0xa0,0xa4,0xa4,0xa0,0xac,0xa8,0xa8,0xac
  353.        ,0x84,0x80,0x80,0x84,0x88,0x8c,0x8c,0x88
  354.        ,0x80,0x84,0x84,0x80,0x8c,0x88,0x88,0x8c
  355.        ,0xa0,0xa4,0xa4,0xa0,0xac,0xa8,0xa8,0xac
  356.        ,0xa4,0xa0,0xa0,0xa4,0xa8,0xac,0xac,0xa8
  357.        ,0x45,0x01,0x01,0x05,0x09,0x0d,0x0d,0x09
  358.        ,0x01,0x05,0x05,0x01,0x0d,0x09,0x09,0x0d
  359.        ,0x21,0x25,0x25,0x21,0x2d,0x29,0x29,0x2d
  360.        ,0x25,0x21,0x21,0x25,0x29,0x2d,0x2d,0x29
  361.        ,0x01,0x05,0x05,0x01,0x0d,0x09,0x09,0x0d
  362.        ,0x05,0x01,0x01,0x05,0x09,0x0d,0x0d,0x09
  363.        ,0x25,0x21,0x21,0x25,0x29,0x2d,0x2d,0x29
  364.        ,0x21,0x25,0x25,0x21,0x2d,0x29,0x29,0x2d
  365.        ,0x81,0x85,0x85,0x81,0x8d,0x89,0x89,0x8d
  366.        ,0x85,0x81,0x81,0x85,0x89,0x8d,0x8d,0x89
  367.        ,0xa5,0xa1,0xa1,0xa5,0xa9,0xad,0xad,0xa9
  368.        ,0xa1,0xa5,0xa5,0xa1,0xad,0xa9,0xa9,0xad
  369.        ,0x85,0x81,0x81,0x85,0x89,0x8d,0x8d,0x89
  370.        ,0x81,0x85,0x85,0x81,0x8d,0x89,0x89,0x8d
  371.        ,0xa1,0xa5,0xa5,0xa1,0xad,0xa9,0xa9,0xad
  372.        ,0xa5,0xa1,0xa1,0xa5,0xa9,0xad,0xad,0xa9
  373. };
  374.  
  375. const unsigned char rl1[] =
  376. {
  377.         0x00,0x04,0x04,0x00,0x0c,0x08,0x08,0x0c
  378.        ,0x04,0x00,0x00,0x04,0x08,0x0c,0x0c,0x08
  379.        ,0x24,0x20,0x20,0x24,0x28,0x2c,0x2c,0x28
  380.        ,0x20,0x24,0x24,0x20,0x2c,0x28,0x28,0x2c
  381.        ,0x04,0x00,0x00,0x04,0x08,0x0c,0x0c,0x08
  382.        ,0x00,0x04,0x04,0x00,0x0c,0x08,0x08,0x0c
  383.        ,0x20,0x24,0x24,0x20,0x2c,0x28,0x28,0x2c
  384.        ,0x24,0x20,0x20,0x24,0x28,0x2c,0x2c,0x28
  385.        ,0x84,0x80,0x80,0x84,0x88,0x8c,0x8c,0x88
  386.        ,0x80,0x84,0x84,0x80,0x8c,0x88,0x88,0x8c
  387.        ,0xa0,0xa4,0xa4,0xa0,0xac,0xa8,0xa8,0xac
  388.        ,0xa4,0xa0,0xa0,0xa4,0xa8,0xac,0xac,0xa8
  389.        ,0x80,0x84,0x84,0x80,0x8c,0x88,0x88,0x8c
  390.        ,0x84,0x80,0x80,0x84,0x88,0x8c,0x8c,0x88
  391.        ,0xa4,0xa0,0xa0,0xa4,0xa8,0xac,0xac,0xa8
  392.        ,0xa0,0xa4,0xa4,0xa0,0xac,0xa8,0xa8,0xac
  393.        ,0x01,0x05,0x05,0x01,0x0d,0x09,0x09,0x0d
  394.        ,0x05,0x01,0x01,0x05,0x09,0x0d,0x0d,0x09
  395.        ,0x25,0x21,0x21,0x25,0x29,0x2d,0x2d,0x29
  396.        ,0x21,0x25,0x25,0x21,0x2d,0x29,0x29,0x2d
  397.        ,0x05,0x01,0x01,0x05,0x09,0x0d,0x0d,0x09
  398.        ,0x01,0x05,0x05,0x01,0x0d,0x09,0x09,0x0d
  399.        ,0x21,0x25,0x25,0x21,0x2d,0x29,0x29,0x2d
  400.        ,0x25,0x21,0x21,0x25,0x29,0x2d,0x2d,0x29
  401.        ,0x85,0x81,0x81,0x85,0x89,0x8d,0x8d,0x89
  402.        ,0x81,0x85,0x85,0x81,0x8d,0x89,0x89,0x8d
  403.        ,0xa1,0xa5,0xa5,0xa1,0xad,0xa9,0xa9,0xad
  404.        ,0xa5,0xa1,0xa1,0xa5,0xa9,0xad,0xad,0xa9
  405.        ,0x81,0x85,0x85,0x81,0x8d,0x89,0x89,0x8d
  406.        ,0x85,0x81,0x81,0x85,0x89,0x8d,0x8d,0x89
  407.        ,0xa5,0xa1,0xa1,0xa5,0xa9,0xad,0xad,0xa9
  408.        ,0xa1,0xa5,0xa5,0xa1,0xad,0xa9,0xa9,0xad
  409. };
  410.  
  411. const unsigned char rr0[] =
  412. {
  413.         0x44,0x45,0x00,0x01,0x00,0x01,0x04,0x05
  414.        ,0x00,0x01,0x04,0x05,0x04,0x05,0x00,0x01
  415.        ,0x08,0x09,0x0c,0x0d,0x0c,0x0d,0x08,0x09
  416.        ,0x0c,0x0d,0x08,0x09,0x08,0x09,0x0c,0x0d
  417.        ,0x00,0x01,0x04,0x05,0x04,0x05,0x00,0x01
  418.        ,0x04,0x05,0x00,0x01,0x00,0x01,0x04,0x05
  419.        ,0x0c,0x0d,0x08,0x09,0x08,0x09,0x0c,0x0d
  420.        ,0x08,0x09,0x0c,0x0d,0x0c,0x0d,0x08,0x09
  421.        ,0x20,0x21,0x24,0x25,0x24,0x25,0x20,0x21
  422.        ,0x24,0x25,0x20,0x21,0x20,0x21,0x24,0x25
  423.        ,0x2c,0x2d,0x28,0x29,0x28,0x29,0x2c,0x2d
  424.        ,0x28,0x29,0x2c,0x2d,0x2c,0x2d,0x28,0x29
  425.        ,0x24,0x25,0x20,0x21,0x20,0x21,0x24,0x25
  426.        ,0x20,0x21,0x24,0x25,0x24,0x25,0x20,0x21
  427.        ,0x28,0x29,0x2c,0x2d,0x2c,0x2d,0x28,0x29
  428.        ,0x2c,0x2d,0x28,0x29,0x28,0x29,0x2c,0x2d
  429.        ,0x00,0x01,0x04,0x05,0x04,0x05,0x00,0x01
  430.        ,0x04,0x05,0x00,0x01,0x00,0x01,0x04,0x05
  431.        ,0x0c,0x0d,0x08,0x09,0x08,0x09,0x0c,0x0d
  432.        ,0x08,0x09,0x0c,0x0d,0x0c,0x0d,0x08,0x09
  433.        ,0x04,0x05,0x00,0x01,0x00,0x01,0x04,0x05
  434.        ,0x00,0x01,0x04,0x05,0x04,0x05,0x00,0x01
  435.        ,0x08,0x09,0x0c,0x0d,0x0c,0x0d,0x08,0x09
  436.        ,0x0c,0x0d,0x08,0x09,0x08,0x09,0x0c,0x0d
  437.        ,0x24,0x25,0x20,0x21,0x20,0x21,0x24,0x25
  438.        ,0x20,0x21,0x24,0x25,0x24,0x25,0x20,0x21
  439.        ,0x28,0x29,0x2c,0x2d,0x2c,0x2d,0x28,0x29
  440.        ,0x2c,0x2d,0x28,0x29,0x28,0x29,0x2c,0x2d
  441.        ,0x20,0x21,0x24,0x25,0x24,0x25,0x20,0x21
  442.        ,0x24,0x25,0x20,0x21,0x20,0x21,0x24,0x25
  443.        ,0x2c,0x2d,0x28,0x29,0x28,0x29,0x2c,0x2d
  444.        ,0x28,0x29,0x2c,0x2d,0x2c,0x2d,0x28,0x29
  445. };
  446.  
  447. const unsigned char rr1[] =
  448. {
  449.         0x80,0x81,0x84,0x85,0x84,0x85,0x80,0x81
  450.        ,0x84,0x85,0x80,0x81,0x80,0x81,0x84,0x85
  451.        ,0x8c,0x8d,0x88,0x89,0x88,0x89,0x8c,0x8d
  452.        ,0x88,0x89,0x8c,0x8d,0x8c,0x8d,0x88,0x89
  453.        ,0x84,0x85,0x80,0x81,0x80,0x81,0x84,0x85
  454.        ,0x80,0x81,0x84,0x85,0x84,0x85,0x80,0x81
  455.        ,0x88,0x89,0x8c,0x8d,0x8c,0x8d,0x88,0x89
  456.        ,0x8c,0x8d,0x88,0x89,0x88,0x89,0x8c,0x8d
  457.        ,0xa4,0xa5,0xa0,0xa1,0xa0,0xa1,0xa4,0xa5
  458.        ,0xa0,0xa1,0xa4,0xa5,0xa4,0xa5,0xa0,0xa1
  459.        ,0xa8,0xa9,0xac,0xad,0xac,0xad,0xa8,0xa9
  460.        ,0xac,0xad,0xa8,0xa9,0xa8,0xa9,0xac,0xad
  461.        ,0xa0,0xa1,0xa4,0xa5,0xa4,0xa5,0xa0,0xa1
  462.        ,0xa4,0xa5,0xa0,0xa1,0xa0,0xa1,0xa4,0xa5
  463.        ,0xac,0xad,0xa8,0xa9,0xa8,0xa9,0xac,0xad
  464.        ,0xa8,0xa9,0xac,0xad,0xac,0xad,0xa8,0xa9
  465.        ,0x84,0x85,0x80,0x81,0x80,0x81,0x84,0x85
  466.        ,0x80,0x81,0x84,0x85,0x84,0x85,0x80,0x81
  467.        ,0x88,0x89,0x8c,0x8d,0x8c,0x8d,0x88,0x89
  468.        ,0x8c,0x8d,0x88,0x89,0x88,0x89,0x8c,0x8d
  469.        ,0x80,0x81,0x84,0x85,0x84,0x85,0x80,0x81
  470.        ,0x84,0x85,0x80,0x81,0x80,0x81,0x84,0x85
  471.        ,0x8c,0x8d,0x88,0x89,0x88,0x89,0x8c,0x8d
  472.        ,0x88,0x89,0x8c,0x8d,0x8c,0x8d,0x88,0x89
  473.        ,0xa0,0xa1,0xa4,0xa5,0xa4,0xa5,0xa0,0xa1
  474.        ,0xa4,0xa5,0xa0,0xa1,0xa0,0xa1,0xa4,0xa5
  475.        ,0xac,0xad,0xa8,0xa9,0xa8,0xa9,0xac,0xad
  476.        ,0xa8,0xa9,0xac,0xad,0xac,0xad,0xa8,0xa9
  477.        ,0xa4,0xa5,0xa0,0xa1,0xa0,0xa1,0xa4,0xa5
  478.        ,0xa0,0xa1,0xa4,0xa5,0xa4,0xa5,0xa0,0xa1
  479.        ,0xa8,0xa9,0xac,0xad,0xac,0xad,0xa8,0xa9
  480.        ,0xac,0xad,0xa8,0xa9,0xa8,0xa9,0xac,0xad
  481. };
  482.  
  483. const unsigned char sraf[] =
  484. {
  485.         0x44,0x45,0x00,0x01,0x00,0x01,0x04,0x05
  486.        ,0x00,0x01,0x04,0x05,0x04,0x05,0x00,0x01
  487.        ,0x08,0x09,0x0c,0x0d,0x0c,0x0d,0x08,0x09
  488.        ,0x0c,0x0d,0x08,0x09,0x08,0x09,0x0c,0x0d
  489.        ,0x00,0x01,0x04,0x05,0x04,0x05,0x00,0x01
  490.        ,0x04,0x05,0x00,0x01,0x00,0x01,0x04,0x05
  491.        ,0x0c,0x0d,0x08,0x09,0x08,0x09,0x0c,0x0d
  492.        ,0x08,0x09,0x0c,0x0d,0x0c,0x0d,0x08,0x09
  493.        ,0x20,0x21,0x24,0x25,0x24,0x25,0x20,0x21
  494.        ,0x24,0x25,0x20,0x21,0x20,0x21,0x24,0x25
  495.        ,0x2c,0x2d,0x28,0x29,0x28,0x29,0x2c,0x2d
  496.        ,0x28,0x29,0x2c,0x2d,0x2c,0x2d,0x28,0x29
  497.        ,0x24,0x25,0x20,0x21,0x20,0x21,0x24,0x25
  498.        ,0x20,0x21,0x24,0x25,0x24,0x25,0x20,0x21
  499.        ,0x28,0x29,0x2c,0x2d,0x2c,0x2d,0x28,0x29
  500.        ,0x2c,0x2d,0x28,0x29,0x28,0x29,0x2c,0x2d
  501.        ,0x84,0x85,0x80,0x81,0x80,0x81,0x84,0x85
  502.        ,0x80,0x81,0x84,0x85,0x84,0x85,0x80,0x81
  503.        ,0x88,0x89,0x8c,0x8d,0x8c,0x8d,0x88,0x89
  504.        ,0x8c,0x8d,0x88,0x89,0x88,0x89,0x8c,0x8d
  505.        ,0x80,0x81,0x84,0x85,0x84,0x85,0x80,0x81
  506.        ,0x84,0x85,0x80,0x81,0x80,0x81,0x84,0x85
  507.        ,0x8c,0x8d,0x88,0x89,0x88,0x89,0x8c,0x8d
  508.        ,0x88,0x89,0x8c,0x8d,0x8c,0x8d,0x88,0x89
  509.        ,0xa0,0xa1,0xa4,0xa5,0xa4,0xa5,0xa0,0xa1
  510.        ,0xa4,0xa5,0xa0,0xa1,0xa0,0xa1,0xa4,0xa5
  511.        ,0xac,0xad,0xa8,0xa9,0xa8,0xa9,0xac,0xad
  512.        ,0xa8,0xa9,0xac,0xad,0xac,0xad,0xa8,0xa9
  513.        ,0xa4,0xa5,0xa0,0xa1,0xa0,0xa1,0xa4,0xa5
  514.        ,0xa0,0xa1,0xa4,0xa5,0xa4,0xa5,0xa0,0xa1
  515.        ,0xa8,0xa9,0xac,0xad,0xac,0xad,0xa8,0xa9
  516.        ,0xac,0xad,0xa8,0xa9,0xa8,0xa9,0xac,0xad
  517. };
  518.  
  519. void init_z80tables()
  520. {
  521. #ifdef __ICL
  522.    make_adc();
  523.    make_sbc();
  524.    make_log();
  525.    make_rot();
  526. #endif
  527. }
  528.  
  529.