home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 June
/
SIMTEL_0692.cdr
/
msdos
/
filutl
/
ldiff12s.arc
/
LDD.ASM
< prev
next >
Wrap
Assembly Source File
|
1989-07-15
|
6KB
|
245 lines
;-----------------------------------------------------------------------------;
; LDD.asm ĽÅæî┼ÆΦÄ«üië≡ôÇüj (C) ÄOû╪ÿaòF NIFTY SDR SDI00147 1989/7/15;
;-----------------------------------------------------------------------------;
; ü@ü@ü@ü@ü@ü@ü@ü@ü@ü@ü@ü@ü@ü@ü@ü@ü@ èεû{ôIé╚âAâïâSâèâYâÇé═ë£æ║Äüé╠ébé≡ÄQÅ╞;
; ü@ü@ü@ü@ü@ü@ü@ü@ü@ü@ü@ü@ü@ü@ü@ü@ü@ ü@ü@ü@ü@ ì\æóë╗â}âNâìé═î├É∞Äüé╠éαé╠é≡Ägùp;
; ;
; ì∞ɼû@: ;
; optasm é≡ Use THREADs for Smaller OBJ(N) é╔é╡é─âAâZâôâuâïé╖éΘ ;
; ;
;-----------------------------------------------------------------------------;
include lms3.inc ; ìéæ¼ì\æóë╗â}âNâì
; (c)S.Furukawa
include minimac.inc ; movseg movdat movdatb
;-----------------------------------------------------------------------------;
data segment word public ;
extrn RBuff : byte ; Åæì₧é▌âoâbâtâ@
extrn WBuff : byte ; ô╟ì₧é▌âoâbâtâ@
extrn CrcTable : word ; éâéÆéâùpâeü[âuâï
extrn CRC : word ; éâéÆéâ
extrn DicSeg : word ; ĽÅæâoâbâtâ@
;
WPoint dw ? ; Åæì₧é▌â|âCâôâ^
RPoint dw ? ; ô╟ì₧é▌â|âCâôâ^
InHandle dw ? ; ôⁿù═ânâôâhâï
OutHandle dw ? ; Åoù═ânâôâhâï
PushSp dw ? ; éôéÉæ▐ö≡ùpâÅü[âN
LzdSize dw ?,? ; âtâ@âCâïâTâCâY
ReadEndPnt dw ? ; âèü[âhùpâÅü[âN
DecodeFlg dw ? ;
data ends ;
;
code segment byte public ;
assume cs:code,ds:data,es:data ;
;
public DeCode ;
;
WBUFFEND equ 0fffh ;
RBUFFEND equ 7fffh ;
;
;-------------------------------------------------------;
; ébéqébîvÄZ ;
; ---------- ;
; in cx,dx ;
; out -- ;
; des -- ;
;-------------------------------------------------------;
BEGIN CrcCalc ;
.if <cxnz> ;
pushm si,dx,cx,bx,ax ;
mov si,dx ;
mov dx,CRC ;
.do ;
lodsb ;
mov bl,dl ;
xor bh,bh ;
xor bl,al ;
shl bx,1 ;
mov ax,CrcTable[bx] ;
mov bl,dh ;
xor bh,bh ;
xor bx,ax ;
mov dx,bx ;
.loop ;
mov CRC,dx ;
popm ax,bx,cx,dx,si ;
.endif ;
ret ;
ENDN CrcCalc ;
;-------------------------------------------------------;
; éüéîé≡Åoù═ ;
; ---------- ;
; in al ;
; out -- ;
; des -- ;
;-------------------------------------------------------;
BEGIN PutC ;
push di ;
mov di,WPoint ;
.if <di a WBUFFEND> ;
pushm ax,bx,cx,dx ;
lea dx,WBuff ;
mov cx,di ;
mov bx,OutHandle ;
msdos 40h ;
jc ErrOut ;
cmp ax,cx ;
jb ErrOut ;
call CrcCalc ;
popm dx,cx,bx,ax ;
xor di,di ;
mov WPoint,di ;
.endif ;
mov WBuff[di],al ;
inc WPoint ;
pop di ;
ret ;
ENDN PutC ;
;-------------------------------------------------------;
; âfü[â^ô╟é▌ì₧é▌ ;
; -------------- ;
; in -- ;
; out al,cy ;
; des -- ;
;-------------------------------------------------------;
BEGIN GetC ;
push si ;
mov si,RPoint ;
.if <si z 0> ;
pushm ax,bx,cx,dx ;
mov cx,RBUFFEND+1 ;
.if <LzdSize[2] e 0 and <cx a LzdSize>>
mov cx,LzdSize ;
.endif ;
mov bx,InHandle ;
mov dx,offset RBuff ;
msdos 3fh ;
jc ErrOut ;
cmp ax,cx ;
jc ErrOut ;
sub LzdSize,ax ;
sbb LzdSize[2],0 ;
mov ReadEndPnt,ax ;
popm dx,cx,bx,ax ;
.endif ;
cmp si,ReadEndPnt ;
jae EndPrg ;
mov al,RBuff[si] ;
inc si ;
.if <si a RBUFFEND> ;
xor si,si ;
.endif ;
mov RPoint,si ;
pop si ;
ret ;
ENDN GetC ;
;-----------------------------------------------------------------------------;
; DeCode(in:word,out:word;size:longint;flg:word):boolean ;
;-----------------------------------------------------------------------------;
BEGIN OutCode16 ;
call GetC ;
mov ah,al ;
call GetC ;
xchg ah,al ;
mov si,ax ; ĽÅæâ|âCâôâ^
call GetC ;
mov cl,al ;
call GetC ;
mov ch,al ;
add cx,4 ; ÆPîΩé╠æσé½é│
mov ax,DicSeg ;
mov es,ax ; ĽÅæâZâOâüâôâg
.do ;
mov al,es:[si] ;
inc si ;
call PutC ;
.loop ;
ret ;
ENDN OutCode16 ;
;-------------------------------------------------------;
BEGIN OutCode18 ;
call GetC ;
mov ah,al ;
call GetC ;
xchg ah,al ;
mov si,ax ; ĽÅæâ|âCâôâ^
call GetC ;
mov ch,al ;
and al,11000000b ;
xor ah,ah ;
xchg ah,al ;
shr ax,1 ;
shr ax,1 ;
add ax,DicSeg ;
mov es,ax ; ĽÅæâZâOâüâôâg
and ch,00111111b ;
call GetC ;
mov cl,al ;
add cx,4 ; ÆPîΩé╠æσé½é│
.do ;
mov al,es:[si] ;
inc si ;
.if <z> ;
push ax ;
mov ax,es ;
add ax,1000h ;
mov es,ax ;
pop ax ;
.endif ;
call PutC ;
.loop ;
ret ;
ENDN OutCode18 ;
;-------------------------------------------------------;
BEGIN DeCode ;
cld ;
mov bx,sp ;
mov PushSp,sp ;
movdat InHandle ,ss:[bx+10] ;
movdat OutHandle ,ss:[bx+8] ;
movdat LzdSize[2],ss:[bx+6] ;
movdat LzdSize ,ss:[bx+4] ;
movdat DecodeFlg ,ss:[bx+2] ;
mov RPoint,0 ;
mov WPoint,0 ;
mov dl,10000000b ; dl âVâtâgâJâEâôâg
.do ; dh âVâtâgâtâëâO
rol dl,1 ;
.if <c> ;
call GetC ;
mov dh,al ;
mov dl,1 ;
.endif ;
test dh,dl ;
.if <nz> ;
call GetC ;
call PutC ;
.else ;
.if <DecodeFlg e 16> ;
call OutCode16 ;
.else ;
call OutCode18 ;
.endif ;
.endif ;
.enddo <> ;
EndPrg: lea dx,WBuff ;
mov bx,OutHandle ;
mov cx,WPoint ;
jcxz NrmOut ;
msdos 40h ;
.if <nc and <ax e cx>> ;
call CrcCalc ;
jmp NrmOut ;
.endif ;
ErrOut: xor ax,ax ;
jmp OutPro ;
NrmOut: mov ax,1 ;
OutPro: mov sp,PushSp ;
ret 10 ;
ENDN DeCode ;
;
;
code ends ;
end ;
;------------------------------------------------------------------------------