deflate.asm.back 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. at (32)
  2. readonly (0)
  3. :index pad (2)
  4. :extra_length_bits pad (2)
  5. :len_value pad (2)
  6. :extra_dist_bits pad (2)
  7. :dist_value pad (2)
  8. at (42)
  9. :req_feed_loc pad (1)
  10. :req_feed_len pad (1)
  11. :req_feed_field pad (12)
  12. :hash_start pad (8)
  13. at (64)
  14. :byte_copy_left pad (2)
  15. :byte_copy_right pad (2)
  16. :input_bit_order pad (2)
  17. :decompressed_ptr pad (2)
  18. :length_table pad (116)
  19. :distance_table pad (120)
  20. :hash_len_loc pad (2)
  21. :state_len_loc pad (2)
  22. :ret_params_loc pad (1)
  23. :sigcomp_version pad (1)
  24. :dicts pad (2)
  25. align (64)
  26. readonly (1)
  27. :initialize_memory
  28. set (udvm_memory_size, 8192)
  29. set (length_table_start, (((length_table - 4) / 4) + 16384))
  30. set (length_table_mid, (length_table_start + 24))
  31. set (dist_table_start, (distance_table / 4))
  32. MULTILOAD (64, 122, circular_buffer, udvm_memory_size, 5,
  33. circular_buffer,
  34. 0, 3, 0, 4, 0, 5,
  35. 0, 6, 0, 7, 0, 8,
  36. 0, 9, 0, 10, 1, 11,
  37. 1, 13, 1, 15, 1, 17,
  38. 2, 19, 2, 23, 2, 27,
  39. 2, 31, 3, 35, 3, 43,
  40. 3, 51, 3, 59, 4, 67,
  41. 4, 83, 4, 99, 4, 115,
  42. 5, 131, 5, 163, 5, 195,
  43. 5, 227, 0, 258,
  44. 0, 1, 0, 2, 0, 3,
  45. 0, 4, 1, 5, 1, 7,
  46. 2, 9, 2, 13, 3, 17,
  47. 3, 25, 4, 33, 4, 49,
  48. 5, 65, 5, 97, 6, 129,
  49. 6, 193, 7, 257, 7, 385,
  50. 8, 513, 8, 769, 9, 1025,
  51. 9, 1537, 10, 2049, 10, 3073,
  52. 11, 4097, 11, 6145, 12, 8193,
  53. 12, 12289, 13, 16385, 13, 24577)
  54. ; -- hash_len, state_len, params, version, dicts
  55. INPUT-BYTES (8, hash_len_loc, !)
  56. LOAD (66, $state_len_loc)
  57. ADD(66, 64)
  58. :decompress_sigcomp_msg
  59. ; -- DICTIONARIES
  60. SWITCH (4, $dicts, sip, pres, sip_pres, start_decomp)
  61. :sip
  62. MULTILOAD (dicts, 4, 1787, 58631, 57317, 58880)
  63. JUMP (start_decomp)
  64. :pres
  65. MULTILOAD (dicts, 4, 1753, 16937, 32011, 45824)
  66. JUMP (start_decomp)
  67. :sip_pres
  68. MULTILOAD (dicts, 7, 1787, 58631, 57317, 58886, 55618, 10621, 2995)
  69. :start_decomp
  70. INPUT-BITS (3, extra_length_bits, !)
  71. :next_char
  72. INPUT-HUFFMAN (index, end_of_msg, 4,
  73. 7, 0, 23, length_table_start,
  74. 1, 48, 191, 0,
  75. 0, 192, 199, length_table_mid,
  76. 1, 400, 511, 144)
  77. COMPARE ($index, length_table_start, literal, end_of_msg,
  78. length_distance)
  79. :literal
  80. set (index_lsb, (index + 1))
  81. OUTPUT (index_lsb, 1)
  82. COPY-LITERAL (index_lsb, 1, $decompressed_ptr)
  83. JUMP (next_char)
  84. :length_distance
  85. ; this is the length part
  86. MULTIPLY ($index, 4)
  87. COPY ($index, 4, extra_length_bits)
  88. INPUT-BITS ($extra_length_bits, extra_length_bits, !)
  89. ADD ($len_value, $extra_length_bits)
  90. ; this is the distance part
  91. INPUT-HUFFMAN (index, !, 1, 5, 0, 31, dist_table_start)
  92. MULTIPLY ($index, 4)
  93. COPY ($index, 4, extra_dist_bits)
  94. INPUT-BITS ($extra_dist_bits, extra_dist_bits, !)
  95. ADD ($dist_value, $extra_dist_bits)
  96. LOAD (index, $decompressed_ptr)
  97. COPY-OFFSET ($dist_value, $len_value, $decompressed_ptr)
  98. OUTPUT ($index, $len_value)
  99. JUMP (next_char)
  100. :end_of_msg
  101. LOAD (req_feed_loc, 1158)
  102. MULTILOAD (hash_start, 4, $state_len_loc, 64, decompress_sigcomp_msg, 6)
  103. SHA-1 (hash_start, $hash_len_loc, req_feed_field)
  104. END-MESSAGE (req_feed_loc, ret_params_loc, $state_len_loc, 64, decompress_sigcomp_msg, 6, 0)
  105. readonly (0)
  106. :circular_buffer