deflate.asm 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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. align (64)
  25. readonly (1)
  26. :initialize_memory
  27. set (udvm_memory_size, 8192)
  28. set (length_table_start, (((length_table - 4) / 4) + 16384))
  29. set (length_table_mid, (length_table_start + 24))
  30. set (dist_table_start, (distance_table / 4))
  31. MULTILOAD (64, 122, circular_buffer, udvm_memory_size, 5,
  32. circular_buffer,
  33. 0, 3, 0, 4, 0, 5,
  34. 0, 6, 0, 7, 0, 8,
  35. 0, 9, 0, 10, 1, 11,
  36. 1, 13, 1, 15, 1, 17,
  37. 2, 19, 2, 23, 2, 27,
  38. 2, 31, 3, 35, 3, 43,
  39. 3, 51, 3, 59, 4, 67,
  40. 4, 83, 4, 99, 4, 115,
  41. 5, 131, 5, 163, 5, 195,
  42. 5, 227, 0, 258,
  43. 0, 1, 0, 2, 0, 3,
  44. 0, 4, 1, 5, 1, 7,
  45. 2, 9, 2, 13, 3, 17,
  46. 3, 25, 4, 33, 4, 49,
  47. 5, 65, 5, 97, 6, 129,
  48. 6, 193, 7, 257, 7, 385,
  49. 8, 513, 8, 769, 9, 1025,
  50. 9, 1537, 10, 2049, 10, 3073,
  51. 11, 4097, 11, 6145, 12, 8193,
  52. 12, 12289, 13, 16385, 13, 24577)
  53. ; -- hash_len, state_len, params, version, dicts
  54. INPUT-BYTES (6, hash_len_loc, !)
  55. LOAD (66, $state_len_loc)
  56. ADD(66, 64)
  57. :decompress_sigcomp_msg
  58. :start_decomp
  59. INPUT-BITS (3, extra_length_bits, !)
  60. :next_char
  61. INPUT-HUFFMAN (index, end_of_msg, 4,
  62. 7, 0, 23, length_table_start,
  63. 1, 48, 191, 0,
  64. 0, 192, 199, length_table_mid,
  65. 1, 400, 511, 144)
  66. COMPARE ($index, length_table_start, literal, end_of_msg,
  67. length_distance)
  68. :literal
  69. set (index_lsb, (index + 1))
  70. OUTPUT (index_lsb, 1)
  71. COPY-LITERAL (index_lsb, 1, $decompressed_ptr)
  72. JUMP (next_char)
  73. :length_distance
  74. ; this is the length part
  75. MULTIPLY ($index, 4)
  76. COPY ($index, 4, extra_length_bits)
  77. INPUT-BITS ($extra_length_bits, extra_length_bits, !)
  78. ADD ($len_value, $extra_length_bits)
  79. ; this is the distance part
  80. INPUT-HUFFMAN (index, !, 1, 5, 0, 31, dist_table_start)
  81. MULTIPLY ($index, 4)
  82. COPY ($index, 4, extra_dist_bits)
  83. INPUT-BITS ($extra_dist_bits, extra_dist_bits, !)
  84. ADD ($dist_value, $extra_dist_bits)
  85. LOAD (index, $decompressed_ptr)
  86. COPY-OFFSET ($dist_value, $len_value, $decompressed_ptr)
  87. OUTPUT ($index, $len_value)
  88. JUMP (next_char)
  89. :end_of_msg
  90. LOAD (req_feed_loc, 1158)
  91. MULTILOAD (hash_start, 4, $state_len_loc, 64, decompress_sigcomp_msg, 6)
  92. SHA-1 (hash_start, $hash_len_loc, req_feed_field)
  93. END-MESSAGE (req_feed_loc, ret_params_loc, $state_len_loc, 64, decompress_sigcomp_msg, 6, 0)
  94. readonly (0)
  95. :circular_buffer