=============================================================================\r
*/\r
\r
-/*typedef struct\r
+typedef struct\r
{\r
- unsigned bit0,bit1; // 0-255 is a character, > is a pointer to a node\r
-} huffnode;*/ //moved to src/lib/typdefst.h\r
+ word bit0,bit1; // 0-255 is a character, > is a pointer to a node\r
+} huffnode;\r
\r
\r
/*typedef struct\r
======================\r
*/\r
\r
-/*++++void CAL_HuffExpand (byte huge *source, byte huge *dest,\r
+void CAL_HuffExpand (byte huge *source, byte huge *dest,\r
long length,huffnode *hufftable)\r
{\r
// unsigned bit,byte,node,code;\r
\r
__asm\r
{\r
- mov bx,[headptr]\r
+;;;;; mov bx,[headptr]\r
\r
mov si,[sourceoff]\r
mov di,[destoff]\r
jnc sourceupshort\r
\r
bit1short:\r
-asm mov dx,[ss:bx+2] // take bit1 path\r
-asm shl cl,1 // advance to next bit position\r
-asm jnc sourceupshort\r
+ mov dx,[ss:bx+2] // take bit1 path\r
+ shl cl,1 // advance to next bit position\r
+ jnc sourceupshort\r
\r
newbyteshort:\r
-asm mov ch,[si] // load next byte\r
-asm inc si\r
-asm mov cl,1 // back to first bit\r
+ mov ch,[si] // load next byte\r
+ inc si\r
+ mov cl,1 // back to first bit\r
\r
sourceupshort:\r
-asm or dh,dh // if dx<256 its a byte, else move node\r
-asm jz storebyteshort\r
-asm mov bx,dx // next node = (huffnode *)code\r
-asm jmp expandshort\r
+ or dh,dh // if dx<256 its a byte, else move node\r
+ jz storebyteshort\r
+ mov bx,dx // next node = (huffnode *)code\r
+ jmp expandshort\r
\r
storebyteshort:\r
-asm mov [es:di],dl\r
-asm inc di // write a decopmpressed byte out\r
-asm mov bx,[headptr] // back to the head node for next bit\r
+ mov [es:di],dl\r
+ inc di // write a decopmpressed byte out\r
+;;;; mov bx,[headptr] // back to the head node for next bit\r
\r
-asm cmp di,ax // done?\r
- jne expandshort\r
+ cmp di,ax // done?\r
+ jne expandshort\r
}\r
}\r
else\r
\r
__asm\r
{\r
- mov bx,[headptr]\r
- mov cl,1\r
+;;;; mov bx,[headptr]\r
+ mov cl,1\r
\r
- mov si,[sourceoff]\r
- mov di,[destoff]\r
- mov es,[destseg]\r
- mov ds,[sourceseg]\r
+ mov si,[sourceoff]\r
+ mov di,[destoff]\r
+ mov es,[destseg]\r
+ mov ds,[sourceseg]\r
\r
- lodsb // load first byte\r
+ lodsb // load first byte\r
\r
expand:\r
- test al,cl // bit set?\r
- jnz bit1\r
- mov dx,[ss:bx] // take bit0 path from node\r
- jmp gotcode\r
+ test al,cl // bit set?\r
+ jnz bit1\r
+ mov dx,[ss:bx] // take bit0 path from node\r
+ jmp gotcode\r
bit1:\r
- mov dx,[ss:bx+2] // take bit1 path\r
+ mov dx,[ss:bx+2] // take bit1 path\r
\r
gotcode:\r
- shl cl,1 // advance to next bit position\r
- jnc sourceup\r
- lodsb\r
- cmp si,0x10 // normalize ds:si\r
-asm jb sinorm\r
- mov cx,ds\r
- inc cx\r
- mov ds,cx\r
- xor si,si\r
+ shl cl,1 // advance to next bit position\r
+ jnc sourceup\r
+ lodsb\r
+ cmp si,0x10 // normalize ds:si\r
+ jb sinorm\r
+ mov cx,ds\r
+ inc cx\r
+ mov ds,cx\r
+ xor si,si\r
sinorm:\r
- mov cl,1 // back to first bit\r
+ mov cl,1 // back to first bit\r
\r
sourceup:\r
- or dh,dh // if dx<256 its a byte, else move node\r
- jz storebyte\r
- mov bx,dx // next node = (huffnode *)code\r
- jmp expand\r
+ or dh,dh // if dx<256 its a byte, else move node\r
+ jz storebyte\r
+ mov bx,dx // next node = (huffnode *)code\r
+ jmp expand\r
\r
storebyte:\r
- mov [es:di],dl\r
- inc di // write a decopmpressed byte out\r
- mov bx,[headptr] // back to the head node for next bit\r
-\r
- cmp di,0x10 // normalize es:di\r
-asm jb dinorm\r
- mov dx,es\r
- inc dx\r
- mov es,dx\r
- xor di,di\r
+ mov [es:di],dl\r
+ inc di // write a decopmpressed byte out\r
+;;;; mov bx,[headptr] // back to the head node for next bit\r
+\r
+ cmp di,0x10 // normalize es:di\r
+ jb dinorm\r
+ mov dx,es\r
+ inc dx\r
+ mov es,dx\r
+ xor di,di\r
dinorm:\r
\r
- sub [WORD PTR ss:length],1\r
- jnc expand\r
- dec [WORD PTR ss:length+2]\r
+ sub [WORD PTR ss:length],1\r
+ jnc expand\r
+ dec [WORD PTR ss:length+2]\r
jns expand // when length = ffff ffff, done\r
}\r
}\r
mov ds,ax\r
}\r
\r
-}*/\r
+}\r
\r
\r
/*\r