коды CRC-16 checking для Award БИОС (v.4.51 с

коды CRC-16 checking для Award БИОС (v.4.51 с бутблоком):

.....
2000:7085                         copy_dcomprssion_result proc near
2000:7085                                                         ; CODE XREF: lzh_expand+42p
2000:7085 50                        push  ax
2000:7086 53                        push  bx
2000:7087 52                        push  dx
2000:7088 51                        push  cx
2000:7089 06                        push  es
2000:708A 56                        push  si
2000:708B A1 04 01                  mov   ax, ds:104h
2000:708E 8E C0                     mov   es, ax
2000:7090                           assume es:nothing
2000:7090 8B 1E 06 01               mov   bx, ds:106h
2000:7094 BE 1C 37                  mov   si, 371Ch               ; ds:si = decompressed buffer
2000:7097                         next_byte_2_copy:               ; CODE XREF: copy_dcomprssion_result+19j
2000:7097 8A 04                     mov   al, [si]
2000:7099 26 88 07                  mov   es:[bx], al
2000:709C 46                        inc   si
2000:709D 43                        inc   bx
2000:709E E2 F7                     loop  next_byte_2_copy
2000:70A0 89 1E 06 01               mov   ds:106h, bx
2000:70A4 0B DB                     or    bx, bx
2000:70A6 75 06                     jnz   not_next_seg
2000:70A8 81 06 04 01 00 10         add   word ptr ds:104h, 1000h
2000:70AE                         not_next_seg:                   ; CODE XREF: copy_dcomprssion_result+21j
2000:70AE 5E                        pop   si
2000:70AF 07                        pop   es
2000:70B0 59                        pop   cx
2000:70B1 3B C1                     cmp   ax, cx
2000:70B3 72 30                     jb    exit
2000:70B5 41                        inc   cx
2000:70B6 BB 1C 37                  mov   bx, 371Ch
2000:70B9                         next_byte:                      ; CODE XREF: copy_dcomprssion_result+5Ej
2000:70B9 0F B6 07                  movzx ax, byte ptr [bx]       ; get next byte to calc crc16
2000:70BC 49                        dec   cx
2000:70BD E3 26                     jcxz  exit
2000:70BF 50                        push  ax
2000:70C0 53                        push  bx
2000:70C1 56                        push  si
2000:70C2 8B F0                     mov   si, ax
2000:70C4 A1 0C 03                  mov   ax, ds:30Ch
2000:70C7 33 C6                     xor   ax, si                  ; calc CRC16 value
2000:70C9 25 FF 00                  and   ax, 0FFh
2000:70CC 8B F0                     mov   si, ax
2000:70CE D1 E6                     shl   si, 1
2000:70D0 8B 9C 0C 01               mov   bx, [si+10Ch]
2000:70D4 A1 0C 03                  mov   ax, ds:30Ch
2000:70D7 C1 E8 08                  shr   ax, 8
2000:70DA 33 C3                     xor   ax, bx
2000:70DC A3 0C 03                  mov   ds:30Ch, ax
2000:70DF 5E                        pop   si
2000:70E0 5B                        pop   bx
2000:70E1 58                        pop   ax
2000:70E2 43                        inc   bx
2000:70E3 EB D4                     jmp   short next_byte
2000:70E5                         ; ---------------------------------------------------------------------------
2000:70E5                         exit:                           ; CODE XREF: copy_dcomprssion_result+2Ej
2000:70E5                                                         ; copy_dcomprssion_result+38j
2000:70E5 5A                        pop   dx
2000:70E6 5B                        pop   bx
2000:70E7 58                        pop   ax
2000:70E8 C3                        retn
2000:70E8                         copy_dcomprssion_result endp ;
.....
2000:790B                         --- Make_CRC16_Table ---
2000:790B                         1st pass, the base address for DS is 3_0000h
2000:790B                         in: ds = scratch_pad_segment for CRC table
2000:790B                         out: ds:10Ch - ds:11Bh = CRC-16 table
2000:790B                         ; --------------- S U B R O U T I N E ---------------------------------------
2000:790B                         Make_CRC16_Table proc near      ; CODE XREF: decomprssion_ngine+ECp
2000:790B 51                        push  cx
2000:790C 53                        push  bx
2000:790D 50                        push  ax
2000:790E 56                        push  si
2000:790F BE 0C 01                  mov   si, 10Ch
2000:7912 B9 00 01                  mov   cx, 100h
2000:7915                         next_byte:                      ; CODE XREF: Make_CRC16_Table+2Bj
2000:7915 B8 00 01                  mov   ax, 100h
2000:7918 2B C1                     sub   ax, cx
2000:791A 50                        push  ax
2000:791B BB 00 00                  mov   bx, 0
2000:791E                         next_bit:                       ; CODE XREF: Make_CRC16_Table+25j
2000:791E A9 01 00                  test  ax, 1
2000:7921 74 07                     jz    LSB_is_0
2000:7923 D1 E8                     shr   ax, 1
2000:7925 35 01 A0                  xor   ax, 0A001h              ; "CRC-substract" with the poly (the poly is A001h)
2000:7928 EB 02                     jmp   short write_tmp_crc_val
2000:792A                         ; ---------------------------------------------------------------------------
2000:792A                         LSB_is_0:                       ; CODE XREF: Make_CRC16_Table+16j
2000:792A D1 E8                     shr   ax, 1
2000:792C                         write_tmp_crc_val:              ; CODE XREF: Make_CRC16_Table+1Dj
2000:792C 43                        inc   bx
2000:792D 83 FB 08                  cmp   bx, 8
2000:7930 72 EC                     jb    next_bit
2000:7932 5B                        pop   bx
2000:7933 89 00                     mov   [bx+si], ax             ; 1st pass: 
2000:7933                                                         ; mov ds:[bx+si], ax <=> mov 3000:[bx+si], ax
2000:7935 46                        inc   si
2000:7936 E2 DD                     loop  next_byte
2000:7938 5E                        pop   si
2000:7939 58                        pop   ax
2000:793A 5B                        pop   bx
2000:793B 59                        pop   cx
2000:793C C3                        retn
2000:793C                         Make_CRC16_Table endp
....
2000:793D                         --- Calc_LZH_hdr_CRC16 ---
2000:793D                         in: ds:571Ch = LZH_hdr_len
2000:793D                              ds:102h = LZH_hdr_byte_index
2000:793D                              ds:10Ch - ds:30Bh = CRC16 table
2000:793D                         
2000:793D                         out: ds:30Ch = LZH_hdr CRC16 calculated value
2000:793D                                ds:314h = size of LZH_hdr saved to ram in byte
2000:793D                         ; --------------- S U B R O U T I N E ---------------------------------------
2000:793D                         Calc_LZH_hdr_CRC16 proc near    ; CODE XREF: ReadHeader+2Cp
2000:793D 50                        push  ax
2000:793E 53                        push  bx
2000:793F 51                        push  cx
2000:7940 52                        push  dx
2000:7941 0F B6 0E 1C 57            movzx cx, byte ptr ds:571Ch   ; cx = LZH_hdr_len
2000:7946 06                        push  es
2000:7947 56                        push  si
2000:7948 8B 1E 02 01               mov   bx, ds:102h             ; 1st pass, bx = LZH_hdr_byte_index (2)
2000:7948                                                         ; i.e. after hdr_len and 8-bit chksum
2000:794C BE 00 00                  mov   si, 0
2000:794F                         next_byte:                      ; CODE XREF: Calc_LZH_hdr_CRC16+19j
2000:794F E8 79 01                  call  FetchByte
2000:7952 88 04                     mov   [si], al                ; save LZH_hdr byte at ds:[si], i.e. 1st pass 3000:[si]
2000:7954 43                        inc   bx
2000:7955 46                        inc   si
2000:7956 E2 F7                     loop  next_byte               ; loop until last LZH hdr byte
2000:7958 8B C3                     mov   ax, bx
2000:795A 2B 06 02 01               sub   ax, ds:102h             ; ax = real_LZH_hdr_len (not including the first two ID bytes)
2000:795E 89 1E 02 01               mov   ds:102h, bx             ; ds:102h = index_to_byte_after_LZH_hdr
2000:7962 5E                        pop   si
2000:7963 07                        pop   es
2000:7964 A2 1C 57                  mov   ds:571Ch, al            ; ds:571Ch = real_LZH_hdr_len (not including the first two ID bytes)
2000:7967 8B C8                     mov   cx, ax                  ; cx = ax = real hdr len
2000:7969 01 06 14 03               add   ds:314h, ax             ; ds:314h = total size of LZH_hdr saved to ram (in byte)?
2000:796D 41                        inc   cx
2000:796E BB 00 00                  mov   bx, 0
2000:7971                         _next_byte:                     ; CODE XREF: Calc_LZH_hdr_CRC16+5Ej
2000:7971 0F B6 07                  movzx ax, byte ptr [bx]
2000:7974 49                        dec   cx
2000:7975 E3 26                     jcxz  exit
2000:7977 50                        push  ax
2000:7978 53                        push  bx
2000:7979 56                        push  si
2000:797A 8B F0                     mov   si, ax                  ; si = LZH_hdr_byte
2000:797C A1 0C 03                  mov   ax, ds:30Ch             ; mov ax, tmp_CRC_16_calculation_result; 
2000:797C                                                         ; ds:30Ch = tmp_CRC_16_calculation_result
2000:797F 33 C6                     xor   ax, si                  ; calculate 16-bit CRC of the LZH header
2000:7981 25 FF 00                  and   ax, 0FFh
2000:7984 8B F0                     mov   si, ax
2000:7986 D1 E6                     shl   si, 1
2000:7988 8B 9C 0C 01               mov   bx, [si+10Ch]           ; mov bx, CRC_16_table[si]
2000:798C A1 0C 03                  mov   ax, ds:30Ch
2000:798F C1 E8 08                  shr   ax, 8
2000:7992 33 C3                     xor   ax, bx                  ; calculate 16-bit CRC of the LZH header
2000:7994 A3 0C 03                  mov   ds:30Ch, ax             ; mov tmp_CRC_16_calculation_result, ax ; 
2000:7994                                                         ; ds:30Ch = tmp_CRC_16_calculation_result
2000:7997 5E                        pop   si
2000:7998 5B                        pop   bx
2000:7999 58                        pop   ax
2000:799A 43                        inc   bx
2000:799B EB D4                     jmp   short _next_byte
2000:799D                         ; ---------------------------------------------------------------------------
2000:799D                         exit:                           ; CODE XREF: Calc_LZH_hdr_CRC16+38j
2000:799D 5A                        pop   dx
2000:799E 59                        pop   cx
2000:799F 5B                        pop   bx
2000:79A0 58                        pop   ax
2000:79A1 C3                        retn
2000:79A1                         Calc_LZH_hdr_CRC16 endp
........

... greetz Pinczakko wink

Немного подкорректировал грамматику, если ты не против wink - ivp