Advertisement
Testaware

fimp.dll v1.0.0.0 (x86)

Aug 27th, 2017
374
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 28.26 KB | None | 0 0
  1. /* *****************************************************************************
  2.  * fimp.dll v1.0.0.0 - file implode / explode dynamic linked library (dll)
  3.  * impExplode by Stuart Caie
  4.  * impImplode by JOTD
  5.  * fimp.dll   by Peace^Testaware - this software is in the Public Domain
  6.  * *****************************************************************************
  7.  *
  8.  * Website: https://testaware.wordpress.com/
  9.  *
  10.  * Version history
  11.  * 1.0.0.0   01-Dec-2008 : by Peace^Testaware
  12.  *                       - first release
  13.  *                       - sources adapted to Dev-C++ 4.9.9.2
  14.  *                       - sources assembled as dllmain.c
  15.  *                       - added impGetExplodeSize()
  16.  *                       - changed impImplodeBuffer() <-> impImplode()
  17.  *                       - changed params of impExplode()
  18.  *                       - changed ERR_FIMP_<CODE> cause haven't include error.h
  19.  *                       - included example source for PureBasic
  20.  * ****************************************************************************/
  21.  
  22. #include "dll.h"
  23. #include <windows.h>
  24. #include <stdio.h>
  25. #include <stdlib.h>
  26. #include <stdint.h>
  27.  
  28. #include "m68k_opcodes.h"        /* ported by JOTD */
  29. #include "m68k_opcodes.c"        /* ported by JOTD */
  30.  
  31. #define  ERR_FIMP_NONE           (0)
  32. #define  ERR_FIMP_TOOSHORT       (-1)
  33. #define  ERR_FIMP_UNKNOWNFORMAT  (-2)
  34. #define  ERR_FIMP_COMPNOTEVEN    (-3)
  35. #define  ERR_FIMP_COMPTOOSHORT   (-4)
  36. #define  ERR_FIMP_NOTENOUGHDATA  (-5)
  37. #define  ERR_FIMP_OUTPUTLTINPUT  (-6)
  38. #define  ERR_FIMP_CANNOTALLOCMEM (-7)
  39. #define  ERR_FIMP_CANNOTDEPLODE  (-8)
  40.  
  41. #define  ID_IMP          (0x494D5021)
  42. #define  ID_ATN          (0x41544E21)
  43.  
  44. #define SwapLong(ptr)    ((ptr[0] << 24) | (ptr[1] << 16) | (ptr[2] << 8) | ptr[3])
  45. #define REVERSE_INT(val) (((val >> 24) & 0xFF) | ((val >> 8) & 0xFF00) | ((val << 8) & 0xFF0000) | ((val << 24) & 0xFF000000))
  46.  
  47.  
  48. /* *****************************************************************************
  49.  * SIZE = impGetExplodeSize(*buffer)
  50.  * *****************************************************************************
  51.  * calculates the exploded size of an imploded buffer
  52.  * -----------------------------------------------------------------------------
  53.  * APTR  *buffer = buffer of FImp imploded data
  54.  * -----------------------------------------------------------------------------
  55.  * SIZE = size of exploded buffer, else #ERR_FIMP_<CODE>
  56.  * ****************************************************************************/
  57. DLLIMPORT int impGetExplodeSize(unsigned char *buffer)
  58. {
  59.           int uncomp_len = 0;
  60.           unsigned int id;
  61.  
  62.           id = SwapLong(buffer);
  63.  
  64.           // Check for magic ID: IMP!, EDAM, CHFI, PARA, RDC9, FLT!, Dupa or ATN!
  65.           if (id != 0x494d5021 && id != 0x4544414d && id != 0x43484649 &&
  66.               id != 0x50415241 && id != 0x52444339 && id != 0x464c5421 &&
  67.               id != 0x44757061 && id != 0x41544e21) {
  68.                  return ERR_FIMP_UNKNOWNFORMAT;
  69.              }
  70.              else {
  71.                  buffer = (buffer + 4);
  72.                  uncomp_len = SwapLong(buffer);
  73.                  }
  74.  
  75.           return uncomp_len;
  76. }
  77.  
  78. /* *****************************************************************************
  79.  * SIZE = impExplode(*in, in_len, *out, out_len)
  80.  * *****************************************************************************
  81.  * explode an FImp imploded buffer
  82.  * -----------------------------------------------------------------------------
  83.  * APTR  *in     = buffer of imploded data
  84.  * ULONG in_len  = size in bytes of *in
  85.  * APTR  *out    = buffer to store exploded datas
  86.  * ULONG out_len = size of exploded buffer (=impGetExplodeSize())
  87.  * -----------------------------------------------------------------------------
  88.  * SIZE = size of decrunched buffer, else #PPERR_<CODE>
  89.  * ****************************************************************************/
  90. DLLIMPORT int impExplode(unsigned char *in, unsigned int in_len,
  91.               unsigned char *out, unsigned int out_len)
  92. {
  93.     unsigned int id, end_off, ok;
  94.  
  95.     if (in_len < 0x30)
  96.         return ERR_FIMP_TOOSHORT;
  97.  
  98.     id       = (in[0x00] << 24) | (in[0x01] << 16) | (in[0x02] << 8) | in[0x03];
  99.     out_len  = (in[0x04] << 24) | (in[0x05] << 16) | (in[0x06] << 8) | in[0x07];
  100.     end_off  = (in[0x08] << 24) | (in[0x09] << 16) | (in[0x0A] << 8) | in[0x0B];
  101.  
  102.     // Check for magic ID: IMP!, EDAM, CHFI, PARA, RDC9, FLT!, Dupa or ATN!
  103.     if (id != 0x494d5021 && id != 0x4544414d && id != 0x43484649 &&
  104.         id != 0x50415241 && id != 0x52444339 && id != 0x464c5421 &&
  105.         id != 0x44757061 && id != 0x41544e21)
  106.             return ERR_FIMP_UNKNOWNFORMAT;
  107.  
  108.     // Sanity checks
  109.     if (end_off & 1) return ERR_FIMP_COMPNOTEVEN;
  110.     if (end_off < 14) return ERR_FIMP_COMPTOOSHORT;
  111.     if ((end_off + 0x2E) > in_len) return ERR_FIMP_NOTENOUGHDATA;
  112.     if ((end_off + 0x26) > out_len) return ERR_FIMP_OUTPUTLTINPUT;
  113.  
  114.     // Copy input data into output buffer
  115.     memcpy(&out[0x00],    &in[end_off + 0x08], 4);
  116.     memcpy(&out[0x04],    &in[end_off + 0x04], 4);
  117.     memcpy(&out[0x08],    &in[end_off + 0x00], 4);
  118.     memcpy(&out[0x0C],    &in[0x0C], end_off - 0x0C);
  119.     memcpy(&out[end_off], &in[end_off + 0x0C], 4);
  120.  
  121.     if (in[end_off + 0x10] & 0x80)
  122.     {
  123.         out[end_off + 4] = in[end_off + 0x11];
  124.         ok = impExplodeBuffer(out, &in[end_off + 0x12], end_off + 5, out_len);
  125.     }
  126.     else
  127.     {
  128.         out[end_off - 1] = in[end_off + 0x11];
  129.         ok = impExplodeBuffer(out, &in[end_off + 0x12], end_off + 4, out_len);
  130.     }
  131.  
  132.     return ok ? ERR_FIMP_NONE : ERR_FIMP_CANNOTDEPLODE;
  133. }
  134.  
  135. /* macro which obtains the next bit from the input bitstream, from MSB to
  136.  * LSB, and sets the "bit" variable with the result. If 8 bits have been
  137.  * read, fetches another byte from the input bytestream. Equivalent to the
  138.  * following M680x0 code:
  139.  *
  140.  *     add.b   d3,d3
  141.  *     bne.b   gotbit
  142.  *     move.b  -(a3),d3
  143.  *     addx.b  d3,d3
  144.  * gotbit:
  145.  */
  146. #define EXPLODE_GETBIT do {            \
  147.     bit = bit_buffer & 0x80;           \
  148.     bit_buffer <<= 1;                  \
  149.     if (!bit_buffer)                   \
  150.     {                                  \
  151.         bit2 = bit;                    \
  152.         bit_buffer = *--i;             \
  153.         bit = bit_buffer & 0x80;       \
  154.         bit_buffer <<= 1;              \
  155.         if (bit2)                      \
  156.             bit_buffer++;              \
  157.     }                                  \
  158. } while (0)
  159.  
  160. static unsigned char explode_literal_base[4] =
  161. {
  162.     6, 10, 10, 18
  163. };
  164.  
  165. static unsigned char explode_literal_extrabits[12] =
  166. {
  167.     1, 1, 1, 1,
  168.     2, 3, 3, 4,
  169.     4, 5, 7, 14
  170. };
  171.  
  172. /**
  173.  * Decompresses a stream of Imploder-compressed data.
  174.  *
  175.  * @param buffer      a buffer that is large enough to contain all the
  176.  *                    decompressed data. On entry, the buffer should
  177.  *                    contain the entire Imploder-compressed stream at
  178.  *                    offset 0. On successful exit, the buffer will
  179.  *                    contain the decompressed data at offset 0. The
  180.  *                    original buffer contents will be overwritten.
  181.  *              
  182.  * @param table       an explosion table, consisting of 8 16-bit
  183.  *                    big-endian "base offset" values and 12 8-bit
  184.  *                    "extra bits" values.
  185.  * @param comp_len    the compressed length of the data
  186.  * @param uncomp_len  the decompressed length of the data
  187.  *
  188.  * @return zero on error, non-zero on success. If successful, the
  189.  * buffer contains the decompressed data.
  190.  */
  191. int impExplodeBuffer(unsigned char *buffer, unsigned char *table, unsigned int comp_len, unsigned int uncomp_len)
  192. {
  193.     unsigned char *i  = buffer + comp_len - 5; /* input pointer  */
  194.     unsigned char *o  = buffer + uncomp_len;   /* output pointer */
  195.     unsigned char *match;                      /* match pointer  */
  196.     unsigned char bit_buffer, bit, bit2;
  197.     unsigned int literal_len, match_len, selector, x, y;
  198.     unsigned int match_base[8];
  199.  
  200.     // Read the 'base' part of the explosion table into native byte order, for speed
  201.     for (x = 0; x < 8; x++)
  202.         match_base[x] = (table[x*2] << 8) | table[x*2 + 1];
  203.  
  204.     // Get initial bit buffer contents, and first literal length
  205.     if (comp_len & 1)
  206.     {
  207.         bit_buffer = i[4];
  208.         literal_len = (i[0] << 24) | (i[1] << 16) | (i[2] << 8) | i[3];
  209.     }
  210.     else
  211.     {
  212.         bit_buffer = i[0];
  213.         literal_len = (i[1] << 24) | (i[2] << 16) | (i[3] << 8) | i[4];
  214.     }
  215.  
  216.     // Copy literal run
  217.     while (1)
  218.     {
  219.         // Enough space?
  220.         if ((o - buffer) < literal_len)
  221.             return 0;
  222.        
  223.         while (literal_len--) *--o = *--i;
  224.  
  225.         // Main exit point - after the literal copy
  226.         if (o <= buffer) break;
  227.  
  228.         /* static Huffman encoding of the match length and selector:
  229.         *
  230.         * 0     -> selector = 0, match_len = 1
  231.         * 10    -> selector = 1, match_len = 2
  232.         * 110   -> selector = 2, match_len = 3
  233.         * 1110  -> selector = 3, match_len = 4
  234.         * 11110 -> selector = 3, match_len = 5 + next three bits (5-12)
  235.         * 11111 -> selector = 3, match_len = (next input byte)-1 (0-254)
  236.         *
  237.         */
  238.         EXPLODE_GETBIT;
  239.         if (bit)
  240.         {
  241.             EXPLODE_GETBIT;
  242.             if (bit)
  243.             {
  244.                 EXPLODE_GETBIT;
  245.                 if (bit)
  246.                 {
  247.                     selector = 3;
  248.                     EXPLODE_GETBIT;
  249.                     if (bit)
  250.                     {
  251.                         EXPLODE_GETBIT;
  252.                         if (bit)
  253.                         {
  254.                             match_len = *--i;
  255.                             // Bad input
  256.                             if (match_len == 0) return 0;
  257.                             match_len--;
  258.                         }
  259.                         else
  260.                         {
  261.                             match_len = 0;   EXPLODE_GETBIT; if (bit) match_len++;
  262.                             match_len <<= 1; EXPLODE_GETBIT; if (bit) match_len++;
  263.                             match_len <<= 1; EXPLODE_GETBIT; if (bit) match_len++;
  264.                             match_len += 5;
  265.                         }
  266.                     }
  267.                     else
  268.                         match_len = 4;
  269.                 }
  270.                 else
  271.                 {
  272.                     selector = 2;
  273.                     match_len = 3;
  274.                 }
  275.             }
  276.             else
  277.             {
  278.                 selector = 1;
  279.                 match_len = 2;
  280.             }
  281.         }
  282.         else
  283.         {
  284.             selector = 0;
  285.             match_len = 1;
  286.         }
  287.  
  288.         /* Another Huffman tuple, for deciding the base value (y) and number
  289.         * of extra bits required from the input stream (x) to create the
  290.         * length of the next literal run. Selector is 0-3, as previously
  291.         * obtained.
  292.         *
  293.         * 0  -> base = 0,                      extra = {1,1,1,1}[selector]
  294.         * 10 -> base = 2,                      extra = {2,3,3,4}[selector]
  295.         * 11 -> base = {6,10,10,18}[selector]  extra = {4,5,7,14}[selector]
  296.         */
  297.         y = 0;
  298.         x = selector;
  299.         EXPLODE_GETBIT;
  300.         if (bit)
  301.         {
  302.             EXPLODE_GETBIT;
  303.             if (bit)
  304.             {
  305.                 y = explode_literal_base[x];
  306.                 x += 8;
  307.             }
  308.             else
  309.             {
  310.                 y = 2;
  311.                 x += 4;
  312.             }
  313.         }
  314.         x = explode_literal_extrabits[x];
  315.  
  316.         // Next literal run length: read [x] bits and add [y] */
  317.         literal_len = 0;
  318.         while (x--)
  319.         {
  320.             literal_len <<= 1;
  321.             EXPLODE_GETBIT;
  322.             if (bit)
  323.                 literal_len++;
  324.         }
  325.         literal_len += y;
  326.  
  327.         /* Another Huffman tuple, for deciding the match distance: _base and
  328.         * _extra are from the explosion table, as passed into the explode
  329.         * function.
  330.         *
  331.         * 0  -> base = 1                        extra = _extra[selector + 0]
  332.         * 10 -> base = 1 + _base[selector + 0]  extra = _extra[selector + 4]
  333.         * 11 -> base = 1 + _base[selector + 4]  extra = _extra[selector + 8]
  334.         */
  335.         match = o + 1;
  336.         x = selector;
  337.         EXPLODE_GETBIT;
  338.         if (bit)
  339.         {
  340.             EXPLODE_GETBIT;
  341.             if (bit)
  342.             {
  343.                 match += match_base[selector + 4];
  344.                 x += 8;
  345.             }
  346.             else
  347.             {
  348.                 match += match_base[selector];
  349.                 x += 4;
  350.             }
  351.         }
  352.         x = table[x + 16];
  353.  
  354.         // Obtain the value of the next [x] extra bits and add it to the match offset
  355.         y = 0;
  356.         while (x--)
  357.         {
  358.             y <<= 1; EXPLODE_GETBIT;
  359.             if (bit)
  360.                 y++;
  361.         }
  362.         match += y;
  363.  
  364.         // Copy match
  365.         // Enough space?
  366.         if ((o - buffer) < match_len)
  367.             return 0;
  368.         do { *--o = *--match; } while (match_len--);
  369.  
  370.     }
  371.  
  372.     // Return 1 if we used up all input bytes (as we should)
  373.     return (i == buffer);
  374. }
  375.  
  376. /* *****************************************************************************
  377.  * SIZE = impImplode(*buffer, dlen, cmode
  378.  * *****************************************************************************
  379.  * implode buffer as like as Amiga FImp (buffer will be overwritten!)
  380.  * -----------------------------------------------------------------------------
  381.  * Remark: sorry to see JOTD didn't calculate a checksum at end of buffer, so
  382.  *         it's not possible to explode files with Amiga FImp! Also the ID is
  383.  *         changed to his ATN! mark! (but he did an absolute great job at all!)
  384.  * -----------------------------------------------------------------------------
  385.  * APTR  *buffer = buffer of unpacked datas to implode
  386.  * ULONG *dlen   = size of buffer in bytes
  387.  * ULONG cmode   = implode efficiency range 0 - 11 ( > 4 very slow! )
  388.  * -----------------------------------------------------------------------------
  389.  * SIZE = imploded size of buffer, else ERR_FIMP_<CODE>
  390.  * ****************************************************************************/
  391.  
  392. //
  393. // Imploder cruncher. Ported by JOTD.
  394. //
  395.  
  396. static const uint imtab0[] = {128,256,512,1024,1792,3328,5376,9472,20736,37376,67840,67840};
  397.  
  398. static const uint imtab1[] = { 0x5050505,0x5050505,0x6060606,0x5060707,0x6060606,0x7070606,
  399.                                0x5060707,0x7070707,0x8080808,0x5060708,0x7070808,0x8080909,
  400.                                0x6070708,0x7080909,0x8090A0A,0x6070708,0x709090A,0x80A0B0B,
  401.                                0x6070808,0x709090A,0x80A0B0C,0x6070808,0x709090A,0x90A0C0D,
  402.                                0x6070708,0x709090C,0x90A0C0E,0x6070809,0x7090A0C,0x90B0D0F,
  403.                                0x6070808,0x70A0B0B,0x90C0D10,0x6080809,0x70B0C0C,0x90D0E11 };
  404.  
  405. static const uint imtab2[] = { 0x2060E,0x1020304 };
  406. static const uint imtab3[] = { 0x1010101,0x2030304,0x405070E };
  407. static const uint imtab4[] = { 0x20002,0x20002,0x6000A,0xA0012,0x16002A,0x8A4012 };
  408.  
  409. #define IMTAB0 0
  410. #define IMTAB1 IMTAB0 + sizeof(imtab0)
  411. #define IMTAB2 IMTAB1 + sizeof(imtab1)
  412. #define IMTAB3 IMTAB2 + sizeof(imtab2)
  413. #define IMTAB4 IMTAB3 + sizeof(imtab3)
  414.  
  415. #define TABLE_SIZE IMTAB4 + sizeof(imtab4)
  416.  
  417. #define STACK_SIZE 2000
  418.  
  419. //  implode:
  420.  
  421. //  In: a0.l=*buffer
  422. //  d0.l=data length
  423. //  d1.l=crunch mode
  424.  
  425. //  Out:    d0.l=<0:user break
  426.  
  427. uint32_t _stdcall reverseLong(uint32_t Value) {
  428.     return REVERSE_INT(Value); }
  429. uint32_t _stdcall freeMemory(uint32_t* Mem) {
  430.     free(Mem);
  431.     return ERR_FIMP_NONE; }
  432.  
  433. void do_implode();
  434. void IM28();
  435. void IM37();
  436. void IM40();
  437. void IM55();
  438.  
  439. #define TRANSFER_TABLE(num) m68k_to_vmem(imtab##num,IMTAB##num,sizeof(imtab##num),4);
  440.  
  441. DLLIMPORT int impImplode(void *buffer, int dlen, int cmode)
  442. {
  443.     uint rval = 0;
  444.  
  445.     if (m68k_init(TABLE_SIZE + dlen + STACK_SIZE) == 0)
  446.     {  
  447.  
  448.     D[0] = dlen;
  449.     A[0] = TABLE_SIZE;
  450.     D[1] = cmode << 16;
  451.  
  452.     TRANSFER_TABLE(0);
  453.     TRANSFER_TABLE(1);
  454.     TRANSFER_TABLE(2);
  455.     TRANSFER_TABLE(3);
  456.     TRANSFER_TABLE(4);
  457.  
  458.     m68k_to_vmem(buffer,TABLE_SIZE,dlen,1);
  459.  
  460.     do_implode();
  461.  
  462.     rval = D[0];
  463.    
  464.     m68k_from_vmem(TABLE_SIZE,buffer,rval,1);
  465.  
  466.     m68k_terminate();
  467.     }
  468.    
  469.     return rval;
  470. }
  471.  
  472. void do_implode()
  473. {
  474. //  implode:
  475.  
  476. //  In: a0.l=*buffer
  477. //  d0.l=data length
  478. //  d1.l=crunch mode
  479.  
  480. //  Out:    d0.l=<0:user break
  481.  
  482.     A[7] -= 44; // pre
  483.     MOVEM_D_IND(252,124,A[7],4);
  484.     MOVEQ_IMM_D(0x57,D[2],4);
  485. IM01:
  486.     A[7] -= 2; // pre
  487.     CLR_IND(A[7],2);
  488.     DBF(D[2],IM01);
  489.     MOVEA_D_D(A[7],A[6],4);
  490.  //     move.l  a5,2(a6)
  491.     CMP_IMM_D(0x40,D[0],4);
  492.     BLO(IM23);
  493.     LSR_IMM_D(8,D[1],4);
  494.     SCS_IND(A[6]); // size 1
  495.     LSR_IMM_D(8,D[1],4);
  496.     CMP_IMM_D(12,D[1],1);
  497.     BLO(IM02);
  498.     MOVEQ_IMM_D(0,D[1],4);
  499. IM02:
  500.  
  501.  //     move.l  a1,6(a6)
  502.     MOVE_D_IND(A[0],10 + A[6],4);
  503.     MOVE_D_IND(A[0],0x22 + A[6],4);
  504.     MOVE_D_IND(A[0],0x26 + A[6],4);
  505.     MOVE_D_IND(D[0],0x12 + A[6],4);
  506.     ADDA_D_D(D[0],A[0],4);
  507.     MOVE_D_IND(A[0],14 + A[6],4);
  508.     LEA(IMTAB0,A[0]);
  509.     LSL_IMM_D(2,D[1],2);
  510.     MOVE_IND_D(0 + A[0] + ( D[1] & 0xFFFF ),D[1],4);
  511.     ADDQ_IMM_D(1,D[1],4);
  512.     CMP_D_D(D[0],D[1],4);
  513.     BLS(IM03);
  514.     MOVE_D_D(D[0],D[1],4);
  515.     SUBQ_IMM_D(1,D[1],4);
  516. IM03:
  517.     MOVE_D_IND(D[1],0x1A + A[6],4);
  518.     SUBQ_IMM_D(1,D[1],4);
  519.     MOVEQ_IMM_D(0,D[0],4);
  520. IM04:
  521.     CMP_IND_D(A[0],D[1],4);
  522.     A[0] += 4; // post
  523.     BLS(IM05);
  524.     ADDQ_IMM_D(1,D[0],1);
  525.     BRA(IM04);
  526. IM05:
  527.     MOVE_D_IND(D[0],1 + A[6],1);
  528.     LEA(0xA4 + A[6],A[1]);
  529.     MOVEQ_IMM_D(12,D[1],4);
  530.     MULU_D_D(D[1],D[0]);
  531.     LEA(IMTAB1,A[0]);
  532.     ADDA_D_D(D[0],A[0],4);
  533.     SUBQ_IMM_D(1,D[1],2);
  534. IM06:
  535.     MOVE_IND_IND(A[0],A[1],1);
  536.     A[0] += 1;A[1] += 1; // post
  537.     DBF(D[1],IM06);
  538.     LEA(0x74 + A[6],A[1]);
  539.     LEA(0xA4 + A[6],A[0]);
  540.     MOVEQ_IMM_D(11,D[1],4);
  541. IM07:
  542.     MOVE_IND_D(A[0],D[0],1);
  543.     A[0] += 1; // post
  544.     MOVEQ_IMM_D(0,D[2],4);
  545.     BSET8_D_D(D[0],D[2]);
  546.     MOVE_D_IND(D[2],A[1],4);
  547.     A[1] += 4; // post
  548.     DBF(D[1],IM07);
  549.     LEA(0x74 + A[6],A[0]);
  550.     LEA(0x84 + A[6],A[1]);
  551.     MOVEQ_IMM_D(7,D[1],4);
  552. IM08:
  553.     MOVE_IND_D(A[0],D[0],4);
  554.     A[0] += 4; // post
  555.     ADD_D_IND(D[0],A[1],4);
  556.     A[1] += 4; // post
  557.     DBF(D[1],IM08);
  558.     TST_IND(A[6],1);
  559.     BEQ(IM11);
  560.     LEA(0x74 + A[6],A[1]);
  561.     MOVEQ_IMM_D(7,D[0],4);
  562. IM09:
  563.     MOVE_IND_D(A[1],D[1],4);
  564.     A[1] += 4; // post
  565.     MOVE_D_IND(D[1],A[2],2);
  566.     A[2] += 2; // post
  567.     DBF(D[0],IM09);
  568.     LEA(0xA4 + A[6],A[1]);
  569.     MOVEQ_IMM_D(11,D[0],4);
  570. IM10:
  571.     MOVE_IND_IND(A[1],A[2],1);
  572.     A[1] += 1;A[2] += 1; // post
  573.     DBF(D[0],IM10);
  574. IM11:
  575.     MOVE_IMM_IND(7,0x2D + A[6],1);
  576. IM12:
  577.     BSR(IM28);
  578.     BEQ(IM15);
  579.     BSR(IM55);
  580.     BNE(IM13);
  581.  
  582.  //     move.l  $22(a6),a0
  583.  //     move.l  $26(a6),a1
  584.  //     move.b  (a0),(a1)
  585.  //     addq.l  #1,$22(a6)
  586.  //     addq.l  #1,$26(a6)
  587.  //     addq.l  #1,$30(a6)
  588.  //     addq.l  #1,$1E(a6)
  589.  //     cmp.l   #$4012,$30(a6)
  590.     LEA(0x1E + A[6],A[5]);
  591.     ADDQ_IMM_IND(1,A[5],4); // $1e
  592.     A[5] += 4; // post
  593.     MOVEA_IND_D(A[5],A[0],4); // $22
  594.     ADDQ_IMM_IND(1,A[5],4); // $22
  595.     A[5] += 4; // post
  596.     MOVEA_IND_D(A[5],A[1],4); // $26
  597.     MOVE_IND_IND(A[0],A[1],1);
  598.     ADDQ_IMM_IND(1,A[5],4); // $26
  599.     ADDQ_IMM_IND(1,0x30 + A[6],4); // $30
  600.     CMP_IMM_IND(0x4012,0x30 + A[6],4);
  601.     BCS(IM12);
  602.     // never happens yet
  603.     BRA(IM15);
  604. IM13:
  605.     MOVE_IND_D(0x5C + A[6],D[0],1);
  606.     MOVE_IND_D(0x60 + A[6],D[1],4);
  607.     BSR(IM37);
  608.     MOVE_IND_D(0x5E + A[6],D[0],1);
  609.     MOVE_IND_D(0x66 + A[6],D[1],2);
  610.     BSR(IM37);
  611.     MOVE_IND_D(0x5D + A[6],D[0],1);
  612.     MOVE_IND_D(0x64 + A[6],D[1],2);
  613.     CMP_IMM_D(13,D[0],1);
  614.     BNE(IM14);
  615.     MOVEA_IND_D(0x26 + A[6],A[0],4);
  616.     MOVE_D_IND(D[1],A[0],1);
  617.     A[0] += 1; // post
  618.     MOVE_D_IND(A[0],0x26 + A[6],4);
  619.     MOVEQ_IMM_D(5,D[0],4);
  620.     MOVEQ_IMM_D(0x1F,D[1],4);
  621. IM14:
  622.     BSR(IM37);
  623.     MOVEQ_IMM_D(0,D[0],4);
  624.     MOVE_D_IND(D[0],0x30 + A[6],4); // clr.l    $30(a6)
  625.     MOVE_IND_D(0x2E + A[6],D[0],1);
  626.     ADD_D_IND(D[0],0x22 + A[6],4);
  627.     BRA(IM12);
  628. IM15:
  629.  
  630.  
  631.  //     move.l  $22(a6),a0
  632.  //     move.l  $26(a6),a1
  633.  //     move.b  (a0),(a1)
  634.  //     addq.l  #1,$22(a6)
  635.  //     addq.l  #1,$26(a6)
  636.  //     addq.l  #1,$30(a6)
  637.  //     addq.l  #1,$1E(a6)
  638.  
  639.     LEA(0x1E + A[6],A[5]);
  640.     ADDQ_IMM_IND(1,A[5],4); // $1e
  641.     A[5] += 4; // post
  642.     MOVEA_IND_D(A[5],A[0],4); // $22
  643.     ADDQ_IMM_IND(1,A[5],4); // $22
  644.     MOVE_IND_D(A[5],D[0],4); // $22
  645.     A[5] += 4; // post
  646.     MOVEA_IND_D(A[5],A[1],4); // $26
  647.     MOVE_IND_IND(A[0],A[1],1);
  648.     ADDQ_IMM_IND(1,A[5],4); // $26
  649.     ADDQ_IMM_IND(1,0x30 + A[6],4); // $30
  650.  //     move.l  $22(a6),d0
  651.     CMP_IND_D(14 + A[6],D[0],4);
  652.     BNE(IM15);
  653.  
  654.     TST_IND(A[6],1);
  655.     BNE(IM19);
  656.     MOVE_IND_D(0x26 + A[6],D[0],4);
  657.     SUB_IND_D(10 + A[6],D[0],4);
  658.     MOVEQ_IMM_D(12,D[1],4);
  659.     CMP_D_D(D[1],D[0],4); // cmp.l #12,d0
  660.     BLO(IM23);
  661.     MOVE_IND_D(0x12 + A[6],D[1],4);
  662.     SUB_D_D(D[0],D[1],4);
  663.     MOVEQ_IMM_D(0x36,D[7],4);
  664.     CMP_D_D(D[7],D[1],4); // cmp.l  #$36,d1
  665.     BLS(IM23);
  666.     MOVEA_IND_D(10 + A[6],A[1],4);
  667.     MOVEA_IND_D(0x26 + A[6],A[0],4);
  668.     MOVE_IMM_D(0xFF00,D[7],2); // move.l    #$FF00,d7
  669.     BTST8_IMM_D(0,D[0]);
  670.     BEQ(IM16);
  671.     MOVEQ_IMM_D(0,D[7],4);
  672.     ADDQ_IMM_D(1,D[0],4);
  673.     CLR_IND(A[0],1);
  674.     A[0] += 1; // post
  675. IM16:
  676.     MOVE_IND_IND(A[1],8 + A[0],4);
  677.     MOVE_IMM_IND(m68k_string_to_long("ATN!"),A[1],4);
  678.     MOVE_IND_IND(4 + A[1],4 + A[0],4);
  679.     MOVE_IND_IND(0x12 + A[6],4 + A[1],4);
  680.     MOVE_IND_IND(8 + A[1],A[0],4);
  681.     MOVE_D_IND(D[0],8 + A[1],4);
  682.     MOVEQ_IMM_D(0x2E,D[1],4);
  683.     ADD_D_D(D[1],D[0],4); // add.l  #$2E,d0
  684.     MOVE_D_IND(D[0],0x16 + A[6],4);
  685.     MOVE_IND_IND(0x30 + A[6],12 + A[0],4);
  686.     MOVE_IND_D(0x2C + A[6],D[1],1);
  687.     AND_IMM_D(0xFE,D[1],2);
  688.     MOVE_IND_D(0x2D + A[6],D[0],1);
  689.     BSET8_D_D(D[0],D[1]);
  690.     OR_D_D(D[7],D[1],2);
  691.     MOVE_D_IND(D[1],0x10 + A[0],2);
  692.     LEA(0x74 + A[6],A[1]);
  693.     ADDA_IMM_D(0x12,A[0],2);
  694.     MOVEQ_IMM_D(7,D[0],4);
  695. IM17:
  696.     MOVE_IND_D(A[1],D[1],4);
  697.     A[1] += 4; // post
  698.     MOVE_D_IND(D[1],A[0],2);
  699.     A[0] += 2; // post
  700.     DBF(D[0],IM17);
  701.     LEA(0xA4 + A[6],A[1]);
  702.     MOVEQ_IMM_D(11,D[0],4);
  703. IM18:
  704.     MOVE_IND_IND(A[1],A[0],1);
  705.     A[1] += 1;A[0] += 1; // post
  706.     DBF(D[0],IM18);
  707.     BRA(IM23);
  708. IM19:
  709.     MOVE_IND_D(0x26 + A[6],D[0],4);
  710.     SUB_IND_D(10 + A[6],D[0],4);
  711.     MOVE_IND_D(0x12 + A[6],D[1],4);
  712.     SUB_D_D(D[0],D[1],4);
  713.     MOVEQ_IMM_D(6,D[2],4);
  714.     CMP_D_D(D[2],D[1],4); // cmp.l  #6,d1
  715.     BLS(IM23);
  716.     MOVE_IND_D(0x2C + A[6],D[1],1);
  717.     AND_IMM_D(0xFE,D[1],1);
  718.     MOVE_IND_D(0x2D + A[6],D[2],1);
  719.     BSET8_D_D(D[2],D[1]);
  720.     MOVEA_IND_D(0x26 + A[6],A[0],4);
  721.     BTST8_IMM_D(0,D[0]);
  722.     BEQ(IM20);
  723.     MOVE_D_IND(D[1],A[0],1);
  724.     A[0] += 1; // post
  725.     MOVE_IND_IND(0x30 + A[6],A[0],4);
  726.     BRA(IM21);
  727. IM20:
  728.     MOVE_IND_IND(0x30 + A[6],A[0],4);
  729.     A[0] += 4; // post
  730.     MOVE_D_IND(D[1],A[0],1);
  731. IM21:
  732.     ADDQ_IMM_D(5,D[0],4);
  733.     MOVE_D_IND(D[0],0x16 + A[6],4);
  734.  
  735. IM23:
  736.     MOVE_IND_D(0x16 + A[6],D[0],4);
  737. IM24:
  738.     MOVEQ_IMM_D(0x57,D[2],4);
  739. IM25:
  740.     CLR_IND(A[7],2);
  741.     A[7] += 2; // post
  742.     DBF(D[2],IM25);
  743.     MOVEM_IND_D(A[7],252,124,4);
  744.     A[7] += 44; // post
  745.     TST_D(D[0],4);
  746.     RTS;
  747. }
  748. void IM28()
  749. {
  750.     MOVEA_IND_D(0x22 + A[6],A[5],4);
  751.     MOVE_IND_D(14 + A[6],D[4],4);
  752.     MOVE_D_D(A[5],D[0],4);
  753.     ADDQ_IMM_D(1,D[0],4);
  754.     ADD_IND_D(0x1A + A[6],D[0],4);
  755.     CMP_D_D(D[4],D[0],4);
  756.     BLS(IM29);
  757.     MOVE_D_D(D[4],D[0],4);
  758.     MOVE_D_D(D[0],D[1],4);
  759.     SUB_D_D(A[5],D[1],4);
  760.     CMP_IMM_D(3,D[1],4);
  761.     BCC(IM29);
  762.     MOVEQ_IMM_D(0,D[0],4);
  763.     RTS;
  764. IM29:
  765.     MOVE_D_D(D[0],D[5],4);
  766.     MOVEA_D_D(A[5],A[2],4);
  767.     ADDQA_IMM_D(1,A[2],4);
  768.     MOVEA_D_D(A[2],A[4],4);
  769.     MOVEQ_IMM_D(1,D[7],4);
  770.     MOVE_IND_D(A[5],D[3],1);
  771.     LEA(0x34 + A[6],A[3]);
  772. IM30:
  773.     CMP_IND_D(A[2],D[3],1);
  774.     A[2] += 1; // post
  775.     BEQ(IM32);
  776.     CMP_IND_D(A[2],D[3],1);
  777.     A[2] += 1; // post
  778.     BEQ(IM32);
  779.     CMP_IND_D(A[2],D[3],1);
  780.     A[2] += 1; // post
  781.     BEQ(IM32);
  782.     CMP_IND_D(A[2],D[3],1);
  783.     A[2] += 1; // post
  784.     BEQ(IM32);
  785.     CMP_IND_D(A[2],D[3],1);
  786.     A[2] += 1; // post
  787.     BEQ(IM32);
  788.     CMP_IND_D(A[2],D[3],1);
  789.     A[2] += 1; // post
  790.     BEQ(IM32);
  791.     CMP_IND_D(A[2],D[3],1);
  792.     A[2] += 1; // post
  793.     BEQ(IM32);
  794.     CMP_IND_D(A[2],D[3],1);
  795.     A[2] += 1; // post
  796.     BEQ(IM32);
  797.     CMP_IND_D(A[2],D[3],1);
  798.     A[2] += 1; // post
  799.     BEQ(IM32);
  800.     CMP_IND_D(A[2],D[3],1);
  801.     A[2] += 1; // post
  802.     BEQ(IM32);
  803.     CMP_IND_D(A[2],D[3],1);
  804.     A[2] += 1; // post
  805.     BEQ(IM32);
  806.     CMP_IND_D(A[2],D[3],1);
  807.     A[2] += 1; // post
  808.     BEQ(IM32);
  809.     CMP_IND_D(A[2],D[3],1);
  810.     A[2] += 1; // post
  811.     BEQ(IM32);
  812.     CMP_IND_D(A[2],D[3],1);
  813.     A[2] += 1; // post
  814.     BEQ(IM32);
  815.     CMP_IND_D(A[2],D[3],1);
  816.     A[2] += 1; // post
  817.     BEQ(IM32);
  818.     CMP_IND_D(A[2],D[3],1);
  819.     A[2] += 1; // post
  820.     BEQ(IM32);
  821.     CMP_D_D(A[2],D[5],4);
  822.     BHI(IM30);
  823. IM31:
  824.     MOVEQ_IMM_D(-1,D[0],4);
  825.     RTS;
  826. IM32:
  827.     CMP_D_D(A[2],D[5],4);
  828.     BLS(IM31);
  829.     MOVEA_D_D(A[4],A[0],4);
  830.     MOVEA_D_D(A[2],A[1],4);
  831.     CMPM_IND_IND(A[0],A[1],1);
  832.     A[0] += 1;A[1] += 1; // post
  833.     BNE(IM30);
  834.     CMPM_IND_IND(A[0],A[1],1);
  835.     A[0] += 1;A[1] += 1; // post
  836.     BNE(IM35);
  837.     CMPM_IND_IND(A[0],A[1],1);
  838.     A[0] += 1;A[1] += 1; // post
  839.     BNE(IM34);
  840.     MOVE_IMM_D(251,D[0],2);
  841. IM33:
  842.     CMPM_IND_IND(A[0],A[1],1);
  843.     A[0] += 1;A[1] += 1; // post
  844.     DBNE(D[0],IM33);
  845. IM34:
  846.     CMPA_D_D(D[4],A[1],4);
  847.     BLS(IM35);
  848.     MOVEA_D_D(D[4],A[1],4);
  849. IM35:
  850.     MOVE_D_D(A[1],D[6],4);
  851.     SUB_D_D(A[2],D[6],4);
  852.     CMP_D_D(D[6],D[7],2);
  853.     BCC(IM30);
  854.     MOVE_D_D(D[6],D[7],2);
  855.     CMP_IMM_D(8,D[6],2);
  856.     BHI(IM36);
  857.     TST_IND(-2 + A[3] + ( D[6] & 0xFFFF ),1);
  858.     BNE(IM30);
  859.     MOVE_D_IND(D[6],-2 + A[3] + ( D[6] & 0xFFFF ),1);
  860.     MOVE_D_D(A[2],D[0],4);
  861.     SUB_D_D(A[5],D[0],4);
  862.     SUBQ_IMM_D(2,D[0],4);
  863.     MOVE_D_D(D[6],D[1],2);
  864.     LSL_IMM_D(2,D[1],2);
  865.     MOVE_D_IND(D[0],0 + A[3] + ( D[1] & 0xFFFF ),4);
  866.     BRA(IM30);
  867. IM36:
  868.     MOVE_D_IND(D[6],7 + A[3],1);
  869.     MOVE_D_D(A[2],D[0],4);
  870.     SUB_D_D(A[5],D[0],4);
  871.     SUBQ_IMM_D(2,D[0],4);
  872.     MOVE_D_IND(D[0],0x24 + A[3],4);
  873.     CMP_IMM_D(0xFF,D[6],1);
  874.     BNE(IM30);
  875.     BRA(IM31);
  876. }
  877. int call_counter=0;
  878. void IM37()
  879. {
  880.     call_counter++;
  881.     MOVE_IND_D(0x2C + A[6],D[2],1);
  882.     MOVE_IND_D(0x2D + A[6],D[3],1);
  883.     MOVEA_IND_D(0x26 + A[6],A[0],4);
  884. IM38:
  885.     LSR_IMM_D(1,D[1],4);
  886.  
  887.     ROXR_IMM_D(1,D[2],1);
  888.     SUBQ_IMM_D(1,D[3],1);
  889.     BPL(IM39);
  890.     MOVEQ_IMM_D(7,D[3],4);
  891.     // divergence ici
  892.     MOVE_D_IND(D[2],A[0],1);
  893.     A[0] += 1; // post
  894.     MOVEQ_IMM_D(0,D[2],4);
  895. IM39:
  896.     SUBQ_IMM_D(1,D[0],1);
  897.     BNE(IM38);
  898.     MOVE_D_IND(A[0],0x26 + A[6],4);
  899.     MOVE_D_IND(D[3],0x2D + A[6],1);
  900.     MOVE_D_IND(D[2],0x2C + A[6],1);
  901.     RTS;
  902. }
  903. void IM40()
  904. {
  905.     AND_IMM_D(0xFF,D[0],4);
  906.     CMP_IMM_D(13,D[0],1);
  907.     BHI(IM42);
  908.     CMP_IMM_D(5,D[0],1);
  909.     BHI(IM41);
  910.     LEA(IMTAB2,A[0]);
  911.     MOVE_IND_IND(-2 + A[0] + ( D[0] & 0xFFFF ),0x71 + A[6],1);
  912.     MOVE_IND_IND(2 + A[0] + ( D[0] & 0xFFFF ),0x69 + A[6],1);
  913.     BRA(IM44);
  914. IM41:
  915.     SUBQ_IMM_D(6,D[0],1);
  916.     OR_IMM_D(0xF0,D[0],1);
  917.     MOVE_D_IND(D[0],0x71 + A[6],1);
  918.     MOVE_IMM_IND(8,0x69 + A[6],1);
  919.     BRA(IM43);
  920. IM42:
  921.     MOVE_IMM_IND(0x1F,0x70 + A[6],1);
  922.     MOVE_D_IND(D[0],0x71 + A[6],1);
  923.     MOVE_IMM_IND(13,0x69 + A[6],1);
  924. IM43:
  925.     MOVEQ_IMM_D(5,D[0],4);
  926. IM44:
  927.     SUBQ_IMM_D(2,D[0],1);
  928.     MOVE_IND_D(0x30 + A[6],D[2],4);
  929.     LEA(IMTAB3,A[1]);
  930.     LEA(IMTAB4,A[0]);
  931.     ADDA_D_D(D[0],A[0],4);
  932.     ADDA_D_D(D[0],A[0],4);
  933.     CMP_IND_D(A[0],D[2],2);
  934.     BCC(IM45);
  935.     MOVE_IND_D(0 + A[1] + ( D[0] & 0xFFFF ),D[6],1);
  936.     MOVE_D_D(D[6],D[3],1);
  937.     ADDQ_IMM_D(1,D[3],1);
  938.     SF_IND(0x73 + A[6]); // move.b  #0,$73(a6)
  939.     MOVEQ_IMM_D(0,D[4],4);
  940.     BRA(IM48);
  941. IM45:
  942.     CMP_IND_D(8 + A[0],D[2],2);
  943.     BCC(IM46);
  944.     MOVE_IND_D(4 + A[1] + ( D[0] & 0xFFFF ),D[6],1);
  945.     MOVE_D_D(D[6],D[3],1);
  946.     ADDQ_IMM_D(2,D[3],1);
  947.     MOVE_IMM_IND(2,0x73 + A[6],1);
  948.     MOVE_IND_D(A[0],D[4],2);
  949.     BRA(IM48);
  950. IM46:
  951.     CMP_IND_D(0x10 + A[0],D[2],2);
  952.     BLO(IM47);
  953.     MOVEQ_IMM_D(0,D[0],4);
  954.     RTS;
  955. IM47:
  956.     MOVE_IND_D(8 + A[1] + ( D[0] & 0xFFFF ),D[6],1);
  957.     MOVE_D_D(D[6],D[3],1);
  958.     ADDQ_IMM_D(2,D[3],1);
  959.     MOVE_IMM_IND(3,0x73 + A[6],1);
  960.     MOVE_IND_D(8 + A[0],D[4],2);
  961. IM48:
  962.     MOVE_D_IND(D[3],0x6A + A[6],1);
  963.     SUB_D_D(D[4],D[2],2);
  964.     MOVEQ_IMM_D(0x10,D[5],4);
  965.     SUB_D_D(D[6],D[5],1);
  966.     LSL_D_D(D[5],D[2],2);
  967. IM49:
  968.     ADD_D_D(D[2],D[2],2);
  969.     ROXL_IND(0x72 + A[6],2); // PB maybe here...
  970.     SUBQ_IMM_D(1,D[6],1);
  971.     BNE(IM49);
  972.     LEA(0xA4 + A[6],A[1]);
  973.     LEA(0x74 + A[6],A[0]);
  974.     ADDA_D_D(D[0],A[0],2);
  975.     ADDA_D_D(D[0],A[0],2);
  976.     ADDA_D_D(D[0],A[0],2);
  977.     ADDA_D_D(D[0],A[0],2);
  978.     CMP_IND_D(A[0],D[1],4);
  979.     BCC(IM50);
  980.     MOVE_IND_D(0 + A[1] + ( D[0] & 0xFFFF ),D[6],1);
  981.     MOVE_D_D(D[6],D[3],1);
  982.     ADDQ_IMM_D(1,D[3],1);
  983.     MOVEQ_IMM_D(0,D[7],4);
  984.     MOVEQ_IMM_D(0,D[4],4);
  985.     BRA(IM53);
  986. IM50:
  987.     CMP_IND_D(0x10 + A[0],D[1],4);
  988.     BCC(IM51);
  989.     MOVE_IND_D(4 + A[1] + ( D[0] & 0xFFFF ),D[6],1);
  990.     MOVE_D_D(D[6],D[3],1);
  991.     ADDQ_IMM_D(2,D[3],1);
  992.     MOVEQ_IMM_D(2,D[7],4);
  993.     MOVE_IND_D(A[0],D[4],4);
  994.     BRA(IM53);
  995. IM51:
  996.     CMP_IND_D(0x20 + A[0],D[1],4);
  997.     BLO(IM52);
  998.     MOVEQ_IMM_D(0,D[0],4);
  999.     RTS;
  1000. IM52:
  1001.     MOVE_IND_D(8 + A[1] + ( D[0] & 0xFFFF ),D[6],1);
  1002.     MOVE_D_D(D[6],D[3],1);
  1003.     ADDQ_IMM_D(2,D[3],1);
  1004.     MOVEQ_IMM_D(3,D[7],4);
  1005.     MOVE_IND_D(0x10 + A[0],D[4],4);
  1006. IM53:
  1007.     MOVE_D_IND(D[3],0x68 + A[6],1);
  1008.     SUB_D_D(D[4],D[1],4);
  1009.     MOVEQ_IMM_D(0x20,D[5],4);
  1010.     SUB_D_D(D[6],D[5],1);
  1011.     LSL_D_D(D[5],D[1],4);
  1012. IM54:
  1013.     ADD_D_D(D[1],D[1],4);
  1014.     ADDX_D_D(D[7],D[7],4);
  1015.     SUBQ_IMM_D(1,D[6],1);
  1016.     BNE(IM54);
  1017.     MOVE_D_IND(D[7],0x6C + A[6],4);
  1018.     MOVEQ_IMM_D(-1,D[0],4);
  1019.     RTS;
  1020. }
  1021. void IM55()
  1022. {
  1023.     CLR_IND(0x2A + A[6],2);
  1024.     CLR_IND(0x2E + A[6],1);
  1025.     LEA(0x34 + A[6],A[4]);
  1026.     LEA(0x3C + A[6],A[5]);
  1027. IM56:
  1028.     MOVE_IND_D(A[5],D[1],4);
  1029.     A[5] += 4; // post
  1030.     MOVE_IND_D(A[4],D[0],1);
  1031.     A[4] += 1; // post
  1032.     BEQ(IM58);
  1033.     BSR(IM40);
  1034.     BEQ(IM58);
  1035.     MOVEQ_IMM_D(0,D[0],4);
  1036.     MOVEQ_IMM_D(0,D[1],4);
  1037.     MOVE_IND_D(-1 + A[4],D[0],1);
  1038.     LSL_IMM_D(3,D[0],2);
  1039.     ADD_IND_D(0x69 + A[6],D[1],1);
  1040.     ADD_IND_D(0x68 + A[6],D[1],1);
  1041.     ADD_IND_D(0x6A + A[6],D[1],1);
  1042.     SUB_D_D(D[1],D[0],2);
  1043.     BMI(IM58);
  1044.     CMP_IND_D(0x2A + A[6],D[0],2);
  1045.     BLO(IM58);
  1046.     MOVE_D_IND(D[0],0x2A + A[6],2);
  1047.     MOVE_IND_IND(-1 + A[4],0x2E + A[6],1);
  1048.     LEA(0x5C + A[6],A[0]);
  1049.     LEA(0x68 + A[6],A[1]);
  1050.     MOVEQ_IMM_D(12,D[1],4);
  1051. IM57:
  1052.     MOVE_IND_IND(A[1],A[0],1);
  1053.     A[1] += 1;A[0] += 1; // post
  1054.     DBF(D[1],IM57);
  1055. IM58:
  1056.     MOVE_D_D(A[4],D[0],4);
  1057.     SUB_D_D(A[6],D[0],4);
  1058.     CMP_IMM_D(0x3C,D[0],2);
  1059.     BNE(IM56);
  1060.     A[4] -= 4; // pre
  1061.     CLR_IND(A[4],4);
  1062.     A[4] -= 4; // pre
  1063.     CLR_IND(A[4],4);
  1064.     TST_IND(0x2E + A[6],2);
  1065.     RTS;
  1066. }
  1067.  
  1068.  
  1069. BOOL APIENTRY DllMain (HINSTANCE hInst     /* Library instance handle. */ ,
  1070.                        DWORD reason        /* Reason this function is being called. */ ,
  1071.                        LPVOID reserved     /* Not used. */ )
  1072. {
  1073.     switch (reason)
  1074.     {
  1075.       case DLL_PROCESS_ATTACH:
  1076.         break;
  1077.  
  1078.       case DLL_PROCESS_DETACH:
  1079.         break;
  1080.  
  1081.       case DLL_THREAD_ATTACH:
  1082.         break;
  1083.  
  1084.       case DLL_THREAD_DETACH:
  1085.         break;
  1086.     }
  1087.  
  1088.     /* Returns TRUE on success, FALSE on failure */
  1089.     return TRUE;
  1090. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement