fragglet / lhasa

Free Software LHA implementation
http://fragglet.github.io/lhasa/
ISC License
80 stars 15 forks source link

CRC fail when decompressing lzsfx33.lzs #13

Closed roytam1 closed 9 years ago

roytam1 commented 10 years ago

lzsfx33.lzs is a wild -lz5- archive found in vector.co.jp, local mirror: http://roy.dnsd.me/lzsfx33.lzs

Files lhasa/lzsfx.exe and larc333/LZSFX.EXE differ
diff --ignore-file-name-case -rU5 lhasa/lzsfx.pas larc333/LZSFX.PAS
--- lhasa/lzsfx.pas 2013-10-09 23:08:28.266750000 +0800
+++ larc333/LZSFX.PAS   1989-02-02 11:23:46.000000000 +0800
@@ -1,7 +1,7 @@
 program LZSFX;
-(*              --
+(* ---------------
 #  LZSS self extract by MASSAN

  $Log: RCS/lzsfx.pas $
   revision 1.4 MAS 89/02/02 03:46:31
   bug fixed. (calc page size)
@@ -14,11 +14,11 @@
 # arg 2 = destin file.
 # 
 # revision 1.1 MAS 88/05/22 20:08:48
 # Initial revision
 # 
-                ----*)
+   -----------------*)
 const
   _header: string[80] = '$Header: RCS/lzsfx.pas 1.4 89/02/02 03:46:31 MAS Exp $';
   pathlen = 64 ;  { MS-DOS}
   maxstr = 255 ;
   texbufsize = 1024;
diff --ignore-file-name-case -rU5 lhasa/lzstub.asm larc333/LZSTUB.ASM
--- lhasa/lzstub.asm    2013-10-09 23:08:28.266750000 +0800
+++ larc333/LZSTUB.ASM  1989-02-02 13:01:26.000000000 +0800
@@ -1,6 +1,6 @@
-; LZ   B.ASM --    lzss self extract
+; LZSTUB.ASM --    lzss self extract
 ;$Log: RCS/lzstub.asm $
 ; revision 1.5 MAS 89/02/02 03:47:58
 ; ask overwrite.
 ; exec autolarc.bat
 ; check crc.
@@ -93,11 +93,11 @@
 code   segment byte public
    assume cs:code
 zero   label   byte

 ; -------- print messages -------------
-open_msg   db  "LZ S self extract" ; must org 0.
+open_msg   db  "LZSS self extract" ; must org 0.
 crlf_msg   db  0dh, 0ah, "$"
 wrt_err_msg    db  "write error$"
 open_err_msg   db  "can't open$"
 already_msg    db  "exists. Overwrite[y/n]$"
 crc_err_msg    db  7, "fails crc$"
@@ -114,11 +114,11 @@
    ret

 crlf:
    mov dx, offset crlf_msg
 print:
-if     LARGE
+ifdef  LARGE
    push    ds
    movsr   ds, cs
    msdos   9
    pop ds
 else
@@ -272,11 +272,11 @@
 ;  getc
 ;  in-out ds:si = pos.  out al = c, CF = eof.
 ;  destroy  ah

 getc   proc
-if     LARGE
+ifdef  LARGE
    sub word ptr [bp].count, 1
    sbb word ptr [bp].count+2, 0
    .if <nc>
        inc si
        .if <z>
@@ -328,11 +328,11 @@
 main_loop:
    .if <[si].headsiz e 0>
        pop es          ; PSP segment.
        mov bx, ((main_next-zero)+15)/16 + 10h  ; 10h for PSP.
        msdos   4ah                 ; resize memory block.
-if     LARGE
+ifdef  LARGE
        movsr   ds, cs
 endif
        mov si, offset autolarc
        .if <[si].autosw ne '.'>    ; autolarc exist?
            int 2eh                 ; execute command.
@@ -360,21 +360,21 @@
    call    putc

    mov byte ptr [di], 0    ; to asciz

    mov di, offset autolarc+1   ; check autolarc
-if     LARGE
+ifdef  LARGE
    movsr   es, cs
 endif
    mov si, dx
    mov cx, (type autol)-1
    repe    cmpsb
    pops    <si, es>
    push    dx
    .do
        .if <z>
-if    LARGE
+ifdef LARGE
            mov byte ptr cs:[di]-4, 0dh
 else
            mov byte ptr [di]-4, 0dh
 endif
        .else
@@ -408,11 +408,11 @@
    mov [bp].fhandl, ax     ; init output
    mov [bp].bufptr, BUFHEAD
    mov [bp].curcrc, 0
    mov ax, word ptr [si].ssize ; init input
    mov word ptr [bp].count, ax
-if     LARGE
+ifdef  LARGE
    mov ax, word ptr [si].ssize+2
    mov word ptr [bp].count+2, ax
    push    ds
 endif
    push    si
@@ -430,11 +430,11 @@
    .endif
    call    decode          ; main.
 decode45:
    call    eject
    pop si
-if     LARGE
+ifdef  LARGE
    pop ds
 endif

    mov bx, [bp].fhandl

@@ -450,11 +450,11 @@
    call    checkcrc
 main_skip:
    call    crlf
 ; ds:si += (ssize + headsiz + 2)
    call    srchead
-if     LARGE
+ifdef  LARGE
    mov bx, word ptr [si].ssize+2
    mov cl, 12
    shl bx, cl
    add ax, word ptr [si].ssize
    mov dx, ds
diff --ignore-file-name-case -rU5 lhasa/open.prc larc333/OPEN.PRC
--- lhasa/open.prc  2013-10-09 23:08:28.266750000 +0800
+++ larc333/OPEN.PRC    1988-08-08 09:09:30.000000000 +0800
@@ -1,6 +1,6 @@
-(*   FROM    S.INC IMPORT anystr, pathtype, tex.
+(*   FROM DEFS.INC IMPORT anystr, pathtype, tex.
    Cant(fname:pathtype) ;
    ShortName(name : pathtype) :integer ;
    ExtPos(name) : integer ;
    NewFname( old, ext : pathtype ; mode : char ('+-')) : pathtype ;
    FileExist(name: pathtype): Boolean;
fragglet commented 9 years ago

Finally got around to fixing this. Thanks for the bug report.