亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? unpack.asm

?? Dos6.0
?? ASM
字號:
COMMENT	#

	UNPACK.ASM

	Copyright (c) 1991 - Microsoft Corp.
	All rights reserved.
	Microsoft Confidential

	Functions for uncompressing an LZ compressed buffer.

	Created 11-28-89 johnhe
	TABS = 7

END_COMMENT #

RING_BUF_LEN	EQU	4096
UNPB_BUF_LEN	EQU	(512 * 17)
INDEX_LEN	EQU	2

WIN_MAX_STR_LEN	EQU	16
LANG_MAX_STR_LEN	EQU	(16 + INDEX_LEN)
MAX_STR_LEN		EQU	(LANG_MAX_STR_LEN + 2)

LANGUAGE_COMPRESS	EQU	1
WINDOWS_COMPRESS	EQU	2

; =========================================================================

DOSSEG

.MODEL	LARGE,C

.DATA

; =========================================================================
; UnpackSet has to allocated before a call to either ClearRingBuffer for
; Unpack. It will contain a ptr to a segment allocated for use by the
; unpack functions. When it is allocated it must be normalize to the
; allocated buffer + 16 so that it can be used with a zero offset by
; the unpack functions.
; =========================================================================

	PUBLIC	UnpackSeg
UnpackSeg	dd	(?)

; =========================================================================
; BUFFER_SEG is not a real segment in the program but is used to get the
; offsets into a buffer pointed to by UnpackSeg. By using this dummy segment
; it allows setting DS to WORD PTR UnpackSeg[2] and then accessing all of
; the area without using segment over-rides.
; =========================================================================

BUFFER_SEG 	SEGMENT at 00

	ORG	0
RingBuf		db	RING_BUF_LEN DUP (?)	; Must org @ 0
RingBufEnd	LABEL	BYTE

UnpackBuffer	db	UNPB_BUF_LEN DUP (?)
UnpackBufEnd	LABEL	BYTE

lToDo		dd	(?)		; Total bytes remaining in unpack buf
lWritten	dd	(?)		; Keeps track of total unpacked bytes

iOutFile	dw	(?)		; Open file handle passed by caller
CtrlFlags	dw	(?)		; Currunt control byte from upack buf
RingIndex	dw	(?)		; Start offset in RingBuffer
Char		db	(?)		; Current char from packed buffer

SplitPoint	db	(?)		; Determines where to start
OldSplitPoint	db	(?)		; Saves last spit point

BUFFER_SEG	ENDS

; =========================================================================

.CODE

EXTRN		fUpdateByteCount:FAR		; Must be explicitly FAR

; =========================================================================
; Sets up the ring buffer for a new file by filling the buffer with
; spaces and setting the ctrl flags and buffer index to known starting
; values.
;
; void ClearRingBuffer( int CompressType )
;
; ARGUMENTS:	int	- Compression type (0 == Language group, 1 == Windows)
; RETURNS: 	void
;
;	RingIndex =  MAX_STR_LEN (depending on compression type)
;	CtrlFlags = 0;
;	SplitPoint = 0;
;	memset( RingBuffer, ' ', RING_BUF_LEN - MAX_STR_LEN );
;
; =========================================================================

ClearRingBuffer PROC USES DS ES DI, CompressType:BYTE

	mov	AX,WORD PTR UnpackSeg[2]	; Get the allocated segment
	mov	DS,AX
	mov	ES,AX

	ASSUME	DS:BUFFER_SEG, ES:BUFFER_SEG

	xor	AX,AX				; DS:AX -> Start of ring buff
	mov	CtrlFlags,AX
	mov	SplitPoint,AL
	mov	DI,AX				; DS:DI -> Start of ring buff

	mov	RingIndex, RING_BUF_LEN - LANG_MAX_STR_LEN
	cmp	CompressType,WINDOWS_COMPRESS
	jne	@F
	mov	RingIndex, RING_BUF_LEN - WIN_MAX_STR_LEN 
@@:
	mov	AX,2020h			; AX == '  '
	mov	CX,(RING_BUF_LEN / 2)		; Storing words so use half
	cld
	rep	stosw				; Fill buffer with ' ' chars

	ret

ClearRingBuffer ENDP

; =========================================================================
; Uncompresses a portion of a compressed file which was compressed using
; LZ compression algorithm. Before the function is called the ring buffer
; and unpacked buffer must be allocated. Before each new file is unpacked
; a call must be done to ClearRingBuffer() to initialize the buffers and
; indices. As the buffer is unpacked it is written to the destination
; file when ever the index in the unpacked buffer reaches a point
; MAX_STR_LEN from the end of the buffer. Each time the buffer is flushed
; the ptr to the packed buffer must be normalized to prevent a possible
; segment wrap of the ptr.
; 																							
; long Unpack( int iFile, char far *InBuf, long lPackedBytes )			
; 																							
; ARGUMENTS:	iFile 	- Open DOS file handle to write the unpacked bytes
; 		InBuf 	- Ptr to buffer to be unpacked
; 			  lPackedBytes  - Length of the buffer in bytes
; RETURNS: 	long	- Number of bytes written to the file.
;
;
; Register will be setup and used as follows within the function
;
;	ES:BX	-> Next byte in packed buffer
;	DS:SI	-> Ring buffer
;	DS:DI	-> Next byte in unpack buffer
;	BP     ==  CtrlFlags
;	DX	   General use
;	CX	   General use
; =========================================================================

Unpack PROC USES DS ES DI SI,iFile:WORD, PackedBuf:PTR, lPackedBytes:DWORD

	mov	AX,WORD PTR UnpackSeg[2]; Get the allocated unpack segment
	mov	DS,AX

	ASSUME	DS:BUFFER_SEG

	les	AX,lPackedBytes		; ES:AX == number of bytes to unpack
	mov	WORD PTR lToDo,AX	; Move number for faster access
	mov	WORD PTR lToDo[2],ES	; lToDo = Total byte to unpacked

	mov	AL,SplitPoint		; Save split point in case this is
	mov	OldSplitPoint,AL	; a continuation of a previous unpack
	mov	SI,RingIndex		; DS:SI -> current pos. in ring buffer

	mov	AX,iFile		; Put iFile into new segment
	mov	iOutFile,AX

	les	BX,PackedBuf		; Get input buffer and normalize
	call	NEAR PTR NormalizePackPtr ; ES:BX -> normalize packed buffer

	mov	DI,OFFSET UnpackBuffer	; DS:DI -> Unpack buffer

	xor	AX,AX			; Reset everything else to 0
	mov	SplitPoint,AL
	mov	WORD PTR lWritten,AX
	mov	WORD PTR lWritten[2],AX


	push	BP			; Save BP for cleanup later
	mov	BP,CtrlFlags		; BP will always hold the ctrl flags

	cmp	OldSplitPoint,1		; See if this is a continuation
	je	SplitPoint1		; of a previous file and if so
	mov	AL,Char			; may need last char from unpack buf
	cmp	OldSplitPoint,2		; to start at the place where it
	je	SplitPoint2		; was left off last time

MainLoop:	; Start of loop which will continue until lToDo == 0

	mov	AX,WORD PTR lToDo	; See if all bytes are unpacked
	or	AX,WORD PTR lToDo[2]
	jnz	CheckUnpackBuf		; Continue if both bytes != 0
	jmp	UnpackExit		; Jump to successfull exit point

CheckUnpackBuf:				; See if time to flush buffer
	and	SI,0fffh		; Make ptr to wrap back to 0 if > 4095
	cmp	DI,OFFSET UnpackBufEnd - MAX_STR_LEN
	jl	GetNextChar 		; Buffer not full yet

	call	NEAR PTR FlushUnpackBuffer ; Else flush the buffer

	or	AX,AX			; AX will be -1 if error else 0
	jz	GetNextChar
	jmp	ErrorExit

GetNextChar:
	mov	AL,ES:[BX]		; Get next char from in buf
	inc	BX			; Increment packed buffer ptr
	sub	WORD PTR lToDo,1	; Decrement remaining packed bytes
	sbb	WORD PTR lToDo[2],0

AnyFlagsLeft:
	shr	BP,1			; High byte has bit mask of flags
	test	BP,0ff00h 		; Any flags left in this byte?
	jnz	TestFlag		; If yes go forward and check the flag

		; Set bit mask to for next 8 characters

	or	AX,0ff00h		; Set all bits in high byte for count
	mov	BP,AX

	mov	AX,WORD PTR lToDo	; See if all bytes are unpacked
	or	AX,WORD PTR lToDo[2]
	jnz	SplitPoint1		; Continue if both bytes != 0

		; If we get here it means we ran out of characters in the
		; unpacked buffer but there's still more to do on the next
		; call so set up to continue where we left off and then
		; flush the buffer and return. We we return on the next
		; call we already have the new control word can continue
		; where we left off

	mov	SplitPoint,1		; Set starting point for next call
	jmp	SHORT UnpackExit

SplitPoint1:				; At this point we just used the char
	mov	AL,ES:[BX]		; as ctrlbyte and need another char
	inc	BX			; Increment packed buffer ptr
	sub	WORD PTR lToDo,1	; Decrement remaining packed count
	sbb	WORD PTR lToDo[2],0

TestFlag:
	test	BP,1			; If flag == 1 character is not
	jz	UnpackIt		; special so just copy it

	mov	[DI],AL			; Store char in unpacked buffer
	mov	[SI],AL			; Also store it in the ring buffer
	inc	DI			; Point to next char in unpacked
	inc	SI			; and ring buffer
	jmp	MainLoop

		; Flag bit was 0 so get a string from ring buf
UnpackIt:
	mov	DX,WORD PTR lToDo	; See if all bytes are unpacked
	or	DX,WORD PTR lToDo[2]
	jnz	SplitPoint2		; Continue if both bytes != 0

		; If we get here it means we ran out of characters in the
		; unpacked buffer but there's still more to do on the next
		; call so set up to continue where we left off and then
		; flush the buffer and return. We we return on the next
		; call we already have the first byte of the control
		; word which determines the ringbuf offset and string count

	mov	Char,AL			; Save the byte, we need it next call
	mov	SplitPoint,2		; Set starting point for next call
	jmp	SHORT UnpackExit

SplitPoint2:	; offset in ringbuf = ((next char & 0xf0) << 4) + AL
		; length to copy    = (nextchar & 0x0f) + 2)

					; AL has last char from packed buffer
	mov	AH,ES:[BX]		; Get the ctrl byte from packed buf
	inc	BX			; Increment packed buffer ptr
	sub	WORD PTR lToDo,1	; Decrement remaining packed bytes
	sbb	WORD PTR lToDo[2],0

	xor	CX,CX			; Determine the str length in CX
	mov	CL,AH			; CX = ctrl byte from the packed buf
	and	CL,0fh			; Mask off the high nibble of low byte
	add	CL,3
;	inc	CL			; Add 2
;	inc	CL			; CX == count of bytes to copy


	shr	AH,1			; Put hi nibble into low nibble	of AH
	shr	AH,1			; and now AX will be a 12 bit value
	shr	AH,1			; which represents the offset in the
	shr	AH,1			; ring buffer

CopyString:
		; The string length may force a wrap of the ringbuffer so
		; we have to anticipate this by	having 2 methods of
		; copying. If the ring buffer wraps we do a slow copy that
		; normalizes SI after each movs instruction.

		; Don't need a CX check because the value will always
		; always be >= 3 because of the above ADD CX,3

	push	ES			; Save the unpacked segment

	mov	DX,SI			; DS:DX --> Dest ringbuf location

	mov	SI,AX			; DS:SI --> Source ringbuf location
	mov	AX,DS			
	mov	ES,AX			; ES:DI --> Dest unpackbuf location
					
	cld

DoCopy:
	lodsb				; Get source byte from ring buffer
	stosb				; Copy byte to unpacked buffer
	xchg	DI,DX			; DS:DI --> Dest ringbuf location
	stosb				; Copy byte to new ringbuf location
	xchg	DI,DX			; DS:DI --> Next unpackbuf location
	and	DX,0fffh		; Prevent wraps in the ring buffer
	and	SI,0fffh		; Have to do both source ptrs
	loop	DoCopy

	mov	SI,DX			; DS:SI --> Next ringbuf offset
	pop	ES			; ES:BX --> unpacked segment again
	jmp	MainLoop

		; ==========================================================
		; Function exit points. If the unpacked buffer has anything
		; copied to it which needs to be written it will be flushed
		; if there were no errors.
		; ==========================================================
UnpackExit:
	cmp	DI,OFFSET UnpackBuffer 	; See if anything in unpack buffer
	je	SetReturnCount

	call	NEAR PTR FlushUnpackBuffer ; Need to flush one last time
	or	AX,AX			; Check for error
	jnz	ErrorExit

SetReturnCount:
	les	AX,lWritten
	mov	DX,ES			; DX:AX == Unpacked bytes written
	jmp	SHORT UnpackExit2

ErrorExit:
	mov	AX,-1			; Signal error
	cwd				; DX:AX == -1

UnpackExit2:
	mov	RingIndex,SI		; Save current ring buffer index
	mov	CtrlFlags,BP
	pop	BP
	ret

Unpack	ENDP

; =========================================================================
; Flushes the unpack buffer to file and then resets the output buffer
; indices to be ready to starting filling the buffer again. After writing
; to the file a call is done to update the gage on the screen and
; then the unpacked ptr is normalized.
;
; int FlushUnpackBuffer( void )
;
; ARGUMENTS:	NONE																			*/
; RETURN:	int	- OK if disk write successfully else ERROR
;																						*/
; =========================================================================

FlushUnpackBuffer:

	push	SI
	mov	SI,BX			; Save unpacked offset for normalizing

	mov	DX,OFFSET UnpackBuffer	; DS:DX --> Start of unpacked buffer
	sub	DI,DX			; DI == count of bytes to write
	mov	CX,DI			; CX == Count of byte to write

	mov	AH,40h			; DOS write handle function
	mov	BX,iOutFile		; BX = Open file handle

	int	21h
	jc	FlushError		; Error check
	cmp	AX,DI			; See if all bytes were written
	jne	FlushError

	add	WORD PTR lWritten,CX	; Update total bytes
	adc	WORD PTR lWritten[2],0	; written to disk

		; Bytes were successfully written so setup and call
		; the function to update the gage on the screen

	push	DS
	push	ES

	mov	AX,@DATA		; Setup ES & DS to C data segment
	mov	DS,AX
	mov	ES,AX

	xor	AX,AX			
	push	AX			; Put byte count on the stack
	push	CX			; as a long value (dword)
					
	call	fUpdateByteCount	; Update the status gage C function
	add	SP,4			; Adjust SP for 2 pushes

	pop	ES
	pop	DS

	mov	BX,SI			; ES:BX --> packed buffer
	call	NEAR PTR NormalizePackPtr ; ES:BX -> normalize packed buffer

FlushExit:
	mov	DI,OFFSET UnpackBuffer	; Reset DS:DI to start of unpack buf
	pop	SI
	xor	AX,AX			; Return OK
	ret

FlushError:
	pop	SI
	mov	AX,-1			; Signal error
	ret

; =========================================================================
; Normalizes ptr to packed buffer in ES:BX
; =========================================================================

NormalizePackPtr:

	push	AX
	push	BX

	mov   	AX,ES			; AX:BX -> current packed buf location
	xchg	AX,BX			; Now BX == Segment, AX = Offset

	shr	AX,1			; Divid offset in AX by 16
	shr	AX,1
	shr	AX,1
	shr	AX,1
	add	AX,BX			; Add segment to normalized offset
	mov	ES,AX			; ES == Normalized segment

	pop	BX
	pop	AX

	and	BX,0fh			; Mask all but 4 low bits of offset

	ret				; ES:BX --> normalized packed location
					; Offset will be less than 16

; =========================================================================

END

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色噜噜狠狠一区二区三区果冻| 中文字幕第一区二区| 欧美色视频在线观看| 欧美日韩亚洲国产综合| 有码一区二区三区| 蜜臀av性久久久久蜜臀aⅴ| 国产资源在线一区| 91福利视频在线| 视频一区视频二区在线观看| 国产美女精品在线| 欧美人伦禁忌dvd放荡欲情| 国产精品污网站| 日韩成人午夜电影| 在线免费观看视频一区| 国产精品国产三级国产aⅴ中文| 视频在线观看国产精品| 精品国产自在久精品国产| 亚洲欧美激情插| 成人一级片在线观看| 777久久久精品| 亚洲天堂网中文字| 国产成人亚洲综合a∨婷婷图片| 欧美日韩不卡一区| 国产在线国偷精品产拍免费yy| 欧美激情中文不卡| 91成人国产精品| 激情综合色综合久久| 6080yy午夜一二三区久久| 国产一区二区三区免费看| 亚洲色图欧洲色图| 日韩欧美黄色影院| 午夜久久久久久久久久一区二区| 日本高清不卡视频| 精品一区二区三区蜜桃| 亚洲日本一区二区三区| 日韩一区二区免费高清| 蜜桃精品在线观看| 亚洲欧洲国产专区| 91蝌蚪国产九色| 最新不卡av在线| 日韩欧美专区在线| 色播五月激情综合网| 国产呦精品一区二区三区网站| 亚洲精品国久久99热| 欧美xxxx老人做受| 国产成人啪免费观看软件| 午夜精品久久久久| 亚洲色图一区二区| 久久久精品综合| 国产精品一区二区黑丝| 国产欧美日韩在线| 成人视屏免费看| 久久国产精品第一页| 国产人伦精品一区二区| 欧美一级在线免费| 国产精品亚洲一区二区三区在线| 午夜视频久久久久久| 自拍偷拍国产亚洲| 国产精品萝li| 欧美国产精品久久| 久久久久久久久久看片| 国产清纯美女被跳蛋高潮一区二区久久w| 91麻豆免费在线观看| 国产成人免费视频精品含羞草妖精| 亚洲电影在线免费观看| 欧美特级限制片免费在线观看| 午夜精品视频在线观看| 亚洲美女屁股眼交3| 国产精品久久久久三级| 国产日韩一级二级三级| 久久综合色8888| 91国在线观看| 91视频你懂的| 91色在线porny| 91在线观看地址| 99国产欧美久久久精品| 亚洲成国产人片在线观看| 精品1区2区在线观看| 日韩欧美电影一二三| 日韩一卡二卡三卡四卡| 欧美一区二视频| 日韩欧美色综合| 欧美一区二区观看视频| 欧美一区二区三区在线观看| 制服丝袜亚洲播放| 这里只有精品视频在线观看| 欧美一区二区在线看| 日韩精品一区国产麻豆| 精品国产污网站| 久久久99精品久久| 欧美三级视频在线| 欧美日本国产视频| 日韩视频一区二区| 久久亚洲一区二区三区四区| 日韩区在线观看| 久久久久久一级片| 中文字幕佐山爱一区二区免费| 亚洲精品写真福利| 午夜久久久影院| 久久成人久久爱| 国产精品91xxx| 色哟哟精品一区| 国产综合色视频| 成人性色生活片| 久久久久久9999| 亚洲私人影院在线观看| 午夜一区二区三区视频| 久久精品国产秦先生| 成人在线视频首页| 欧美系列在线观看| 久久综合久久99| 亚洲日本在线a| 久久99日本精品| 不卡的电影网站| 丁香一区二区三区| 国产一区二区影院| 91蜜桃免费观看视频| 日韩午夜小视频| 亚洲欧美中日韩| 日本午夜精品视频在线观看| 成人动漫中文字幕| 91.成人天堂一区| 欧美激情一区二区| 日韩成人精品在线| av亚洲产国偷v产偷v自拍| 盗摄精品av一区二区三区| 欧美日韩国产一级片| 国产精品免费人成网站| 日韩av电影免费观看高清完整版 | 亚洲成人一区在线| 国产美女主播视频一区| 欧美亚男人的天堂| 国产欧美一区二区在线| 日本美女视频一区二区| 色综合天天综合网国产成人综合天| 丰满少妇在线播放bd日韩电影| 欧美色图在线观看| 国产精品欧美久久久久一区二区 | 久久99精品久久久久久| 一本大道久久a久久精品综合| 日韩欧美色电影| 三级久久三级久久| 91久久精品日日躁夜夜躁欧美| 精品成人在线观看| 五月婷婷综合在线| 日本道色综合久久| 亚洲欧洲av另类| 顶级嫩模精品视频在线看| 亚洲精品一区二区三区在线观看 | 久久91精品国产91久久小草| 欧美特级限制片免费在线观看| 亚洲日本成人在线观看| 高清日韩电视剧大全免费| 欧美tk—视频vk| 秋霞午夜鲁丝一区二区老狼| 国产在线播精品第三| 日韩欧美国产一区二区在线播放| 亚洲福利电影网| 欧美在线高清视频| 亚洲久草在线视频| 一本到不卡精品视频在线观看| 国产精品久久久久久久岛一牛影视| 国产美女一区二区三区| 精品国产一区二区精华| 久久99精品一区二区三区| 日韩欧美在线综合网| 久久精品国产在热久久| 91精品国产免费| 久久国产人妖系列| 26uuu精品一区二区| 国产专区综合网| 日本一区二区视频在线| 国产电影精品久久禁18| 国产日韩欧美电影| 丁香激情综合五月| 亚洲人成网站在线| 欧美午夜精品一区| 日韩黄色免费网站| 精品国产制服丝袜高跟| 国产一区二区按摩在线观看| 国产亚洲人成网站| www.欧美色图| 亚洲国产日韩一级| 91精品国产色综合久久| 黄色资源网久久资源365| 久久精品免费在线观看| jlzzjlzz亚洲日本少妇| 亚洲女厕所小便bbb| 欧美日韩国产电影| 久久超碰97中文字幕| 国产欧美一区二区精品忘忧草| 成人免费视频一区| 亚洲欧美日韩在线| 欧美一区二区啪啪| 成人一级黄色片| 亚洲制服丝袜在线| 日本高清无吗v一区| 日韩电影在线一区二区三区| 亚洲精品在线免费观看视频| 成人午夜av在线|