home *** CD-ROM | disk | FTP | other *** search
/ FreeWare Collection 2 / FreeSoftwareCollection2pd199x-jp.img / ms_dos / ish / ish200s / ish200s.lzh / DECODE.H < prev    next >
Text File  |  1990-03-27  |  6KB  |  326 lines

  1. ;
  2. ;        ish file converter for MS-DOS  Ver 2.00 (90/3/27)
  3. ;
  4. ;
  5. ;        Copyright (c) 1986, 1987, 1989, 1990  by  M. ishizuka
  6. ;        All rights reserved.
  7. ;
  8.  
  9.  
  10.  
  11. ;-----------------------------------------------;
  12. ;                        ;
  13. ;    @@get_char                ;
  14. ;                        ;
  15. ;    INPUT :    si (pointer)            ;
  16. ;    OUTPUT:    al(character)            ;
  17. ;        si (next pointer)        ;
  18. ;    ERROR :    get_frame, get_frame_2,     ;
  19. ;        error_05            ;
  20. ;    BREAK :    flags                ;
  21. ;                        ;
  22. ;-----------------------------------------------;
  23.  
  24. @@get_char    macro
  25.         call    get_char
  26.         jc    get_frame_2
  27.         jz    get_frame
  28.         endm
  29.  
  30.  
  31.  
  32. ;-----------------------------------------------;
  33. ;                        ;
  34. ;    @@decode_7bit                ;
  35. ;                        ;
  36. ;    INPUT :    al (sequence number)        ;
  37. ;        di (destination pointer)    ;
  38. ;    OUTPUT:    di (next destination pointer)    ;
  39. ;    ERROR :    get_frame, get_frame_2,     ;
  40. ;        error_05            ;
  41. ;    BREAK :    flags, al, bx, cx, dl, si    ;
  42. ;                        ;
  43. ;-----------------------------------------------;
  44.  
  45. @@decode_7bit    macro
  46.         mov    bx, offset decode_table_jis8
  47.         xlat
  48.         cmp    al, 68d + 2
  49.         jnc    get_frame
  50. ins_dl_6_1:
  51.         ins    dl, 6
  52.         mov    cx, 78d
  53.         cmp    al, 68d
  54.         jnz    decode_7bit_2
  55.         inc    cx
  56. decode_7bit_2:    @@get_char
  57.         xlat
  58.         cmp    al, 0ffh
  59.         jz    decode_7bit_2
  60. ins_dl_6_2:
  61.         ins    dl, 6
  62.         loop    decode_7bit_2
  63.         mov    bl, 68d
  64.         mov    cx, 69d
  65.         endm
  66.  
  67.  
  68.  
  69. ;-----------------------------------------------;
  70. ;                        ;
  71. ;    @@decode_13bit                ;
  72. ;                        ;
  73. ;    INPUT :    al (sequence number)        ;
  74. ;        di (destination pointer)    ;
  75. ;    OUTPUT:    di (next destination pointer)    ;
  76. ;    ERROR :    get_frame, get_frame_2,        ;
  77. ;        error_05            ;
  78. ;    BREAK :    flags, ax, bx, cx, dx, si, bp    ;
  79. ;                        ;
  80. ;-----------------------------------------------;
  81.  
  82. @@decode_13bit    macro
  83.         mov    bx, offset decode_table_jis7
  84.         and    al, 7fh
  85.         xlat
  86.         cmp    al, 62d + 2
  87.         jnc    get_frame
  88. ins_dl_5_1:
  89.         ins    dl, 5
  90.         mov    cx, 3
  91. decode_13bit_2:    @@get_char
  92.         and    al, 7fh
  93.         xlat
  94.         cmp    al, 40h
  95.         jnc    decode_13bit_2
  96. ins_dl_5_2:
  97.         ins    dl, 5
  98.         loop    decode_13bit_2
  99.         mov    dh, 91d
  100.         mov    cx, 74d/2
  101. decode_13bit_5:    @@get_char
  102.         and    al, 7fh
  103.         xlat
  104.         cmp    al, 0ffh
  105.         jz    decode_13bit_5
  106.         mul    dh
  107.         mov    bp, ax
  108. decode_13bit_6:    @@get_char
  109.         and    al, 7fh
  110.         xlat
  111.         cmp    al, 0ffh
  112.         jz    decode_13bit_6
  113.         cbw
  114.         add    ax, bp
  115.         cmp    ax, 2000h
  116.         jnc    get_frame
  117. ins_dl_12_1:
  118.         ins    dl, 12
  119.         loop    decode_13bit_5
  120.         mov    bl, 62d
  121.         mov    cx, 63d
  122.         endm
  123.  
  124.  
  125.  
  126. ;-----------------------------------------------;
  127. ;                        ;
  128. ;    @@decode_14bit                ;
  129. ;                        ;
  130. ;    INPUT :    al (sequence number)        ;
  131. ;        di (destination pointer)    ;
  132. ;    OUTPUT:    di (next destination pointer)    ;
  133. ;    ERROR :    get_frame, get_frame_2,        ;
  134. ;        error_05            ;
  135. ;    BREAK :    flags, ax, bx, cx, dx, si, bp    ;
  136. ;                        ;
  137. ;-----------------------------------------------;
  138.  
  139. @@decode_14bit    macro
  140.         mov    bx, offset decode_table_jis7
  141.         cmp    al, 80h
  142.         jnc    get_frame
  143.         xlat
  144.         cmp    al, 68d + 2
  145.         jnc    get_frame
  146.         stosb
  147.         mov    dx, 182d * 256d        ; dh := 182d , dl := 0
  148.         mov    cx, 123d * 256d + 75d    ; ch := 123d , cl := 75d
  149. decode_14bit_2:    @@get_char
  150.         mov    bx, offset decode_table_nonkana
  151.         xlat
  152.         cmp    al, 0ffh
  153.         jz    decode_14bit_2
  154.         dec    cl
  155.         cmp    al, 91d
  156.         jnb    decode_14bit_3
  157.         mul    ch
  158.         mov    bp, ax
  159. decode_14bit_2_1:
  160.         @@get_char
  161.         xlat
  162.         cmp    al, 0ffh
  163.         jz    decode_14bit_2_1
  164.         cmp    al, 91d
  165.         pushf
  166.         xor    ah, ah
  167.         add    ax, bp
  168. ins_dl_13_1:
  169.         ins    dl, 13
  170.         popf
  171.         jc    decode_14bit_4
  172.         dec    cl
  173. decode_14bit_2_2:
  174.         @@get_char
  175.         mov    bx, offset decode_table_nonkana2
  176.         xlat
  177.         cmp    al, 0ffh
  178.         jz    decode_14bit_2_2
  179. ins_dl_6_3:
  180.         ins    dl, 6
  181.         jmp    decode_14bit_4
  182.  
  183. decode_14bit_3:    sub    al, 91d
  184.         mul    dh
  185.         add    ax, 91d * 123d
  186.         mov    bp, ax
  187.         mov    bx, offset decode_table_nonkana2
  188. decode_14bit_3_1:
  189.         @@get_char
  190.         xlat
  191.         cmp    al, 0ffh
  192.         jz    decode_14bit_3_1
  193.         xor    ah, ah
  194.         add    ax, bp
  195. ins_dl_13_2:
  196.         ins    dl, 13
  197. decode_14bit_4:    dec    cl
  198.         jns    decode_14bit_2
  199.         mov    bx, offset decode_table_jis7
  200.         inc    cl
  201.         jz    decode_14bit_5
  202.         inc    cl
  203.         jz    decode_14bit_6
  204.         jmp    decode_14bit_7
  205.  
  206. decode_14bit_5:    @@get_char
  207.         and    al, 7fh
  208.         xlat
  209.         cmp    al, 0ffh
  210.         jz    decode_14bit_5
  211.         mov    dh, 91d
  212.         mul    dh
  213.         mov    bp, ax
  214. decode_14bit_5_1:
  215.         @@get_char
  216.         and    al, 7fh
  217.         xlat
  218.         cmp    al, 0ffh
  219.         jz    decode_14bit_5_1
  220.         xor    ah, ah
  221.         add    ax, bp
  222. ins_dl_12_2:
  223.         ins    dl, 12
  224.         jmp    decode_14bit_7
  225.  
  226. decode_14bit_6:    @@get_char
  227.         and    al, 7fh
  228.         xlat
  229.         cmp    al, 0ffh
  230.         jz    decode_14bit_6
  231. ins_dl_5_3:
  232.         ins    dl, 5
  233. decode_14bit_7:    mov    bl, 68d
  234.         mov    cx, 69d
  235.         endm
  236.  
  237.  
  238.  
  239. ;-----------------------------------------------;
  240. ;                        ;
  241. ;    @@decode_15bit                ;
  242. ;                        ;
  243. ;    INPUT :    al (sequence number)        ;
  244. ;        di (destination pointer)    ;
  245. ;    OUTPUT:    di (next destination pointer)    ;
  246. ;    ERROR :    get_frame, get_frame_2,        ;
  247. ;        error_05            ;
  248. ;    BREAK :    flags, ax, bx, cx, dx, si, bp    ;
  249. ;                        ;
  250. ;-----------------------------------------------;
  251.  
  252. @@decode_15bit    macro
  253.         mov    bx, offset decode_table_jis8
  254.         xlat
  255.         cmp    al, 72d + 2
  256.         jnc    get_frame
  257. ins_dl_6_4:
  258.         ins    dl, 6
  259.         mov    dh, 182d
  260.         mov    cx, 76d/2
  261. decode_15bit_2:    @@get_char
  262.         or    ch, ch
  263.         mov    bx, offset decode_table_sjis
  264.         jns    decode_15bit_7
  265.         mov    bx, offset decode_table_sjis2
  266. decode_15bit_7:    mov    ah, al
  267.         xlat
  268.         cmp    al, 0ffh
  269.         jz    decode_15bit_2
  270.         xor    ch, 80h
  271.         and    ch, ah
  272.         cmp    ah, 0a0h
  273.         jc    decode_15bit_8
  274.         cmp    ah, 0e0h
  275.         jnc    decode_15bit_8
  276.         xor    ch, ch
  277. decode_15bit_8:    mul    dh
  278.         mov    bp, ax
  279. decode_15bit_3:    @@get_char
  280.         or    ch, ch
  281.         mov    bx, offset decode_table_sjis
  282.         jns    decode_15bit_9
  283.         mov    bx, offset decode_table_sjis2
  284. decode_15bit_9:    mov    ah, al
  285.         xlat
  286.         cmp    al, 0ffh
  287.         jz    decode_15bit_3
  288.         xor    ch, 80h
  289.         and    ch, ah
  290.         cmp    ah, 0a0h
  291.         jc    decode_15bit_10
  292.         cmp    ah, 0e0h
  293.         jnc    decode_15bit_10
  294.         xor    ch, ch
  295. decode_15bit_10:
  296.         xor    ah, ah
  297.         add    ax, bp
  298.         cmp    ax, 8000h
  299.         jnc    get_frame
  300. ins_dl_14_1:
  301.         ins    dl, 14
  302.         dec    cl
  303.         jnz    decode_15bit_2
  304. decode_15bit_4:    @@get_char
  305.         or    ch, ch
  306.         mov    bx, offset decode_table_sjis2
  307.         js    decode_15bit_6
  308.         cmp    al, 089h
  309.         jc    decode_15bit_5
  310.         cmp    al, 0a0h
  311.         jc    decode_15bit_4
  312.         cmp    al, 0c9h
  313.         jc    decode_15bit_5
  314.         cmp    al, 0e0h
  315.         jnc    decode_15bit_4
  316.         sub    al, 40h
  317. decode_15bit_5:    mov    bx, offset decode_table_sjis
  318. decode_15bit_6:    xlat
  319.         cmp    al, 80h
  320.         jnc    decode_15bit_4
  321. ins_dl_6_5:
  322.         ins    dl, 6
  323.         mov    bl, 72d
  324.         mov    cx, 73d
  325.         endm
  326.