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

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

?? freect.asm

?? Dos6.0
?? ASM
字號:
	page	,132
	title	freect - C runtime heap allocation _freect and _memavl
;***
;freect.asm - C runtime heap allocation _freect and _memavl
;
;	Copyright (c) 1987-1988, Microsoft Corporation, All Rights Reserved
;
;Purpose:
;	_freect and _memavl routines are useful for determining how
;	much memory within the default data segment is still free for
;	dynamic allocation (by malloc in small/medium memory models,
;	and by _nmalloc in all memory models).
;
;*******************************************************************************

include	version.inc
.xlist
include	cmacros.inc
include	brkctl.inc
.list

sBegin	data
assumes	ds,data

externW	_asegds
extrn b$nmalloc_end:word	;[1] end of BASIC near malloc buffer
externW	_abrktb

sEnd	data

externP	_nmalloc


sBegin	code
assumes	ds,data
assumes	cs,code

;
; freect() assumes that DGroup_Left() does not trash CX
;	In real mode (DOS 3), uses actual size of DGROUP
;	If executing in Protected Mode, assume DGROUP can be grown to 65535
;


cProc	DGroup_Left,<NEAR>,<>

cBegin
 	mov	ax,[b$nmalloc_end] ;[1] size of Near malloc buffer...
 	dec	ax		;[1] ...-1
not_prot_mode:
	sub	ax,3		; overhead - can only use 65534 bytes
				; allocating an entry takes 2 bytes
				; plus 1 to make AX=DGROUP-overhead
	mov	dx,[_abrktb].sz	; end of heap memory
	mov	bx,[_asegds]
	cmp	word ptr [bx+2],0fffeH ; check for heap not really set-up
	jnz	have_heap
	sub	ax,3		; more overhead: dummy heap entries
have_heap:
	cmp	ax,dx
	ja	have_room
	mov	dx,ax		; no room left
have_room:
	sub	ax,dx		; number of bytes than can be allocated
cEnd

page
;***
;unsigned _memmax() - find size of largest free block in near heap
;
;Purpose:
;	returns the size in bytes of the maximal free block left in
;	the default data segment (in the near heap)
;
;Entry:
;	None.
;
;Exit:
;	returns AX = WORD size in bytes of largest free block in DGROUP
;
;Uses:
;	BX, CX, DX.
;
;Exceptions:
;
;*******************************************************************************

cProc	_memmax,<PUBLIC>,<si>

cBegin
	call	_initheap	; make sure heap is init'd
	or	ax,ax		; did _initheap succeed ??
	jz	x_exit		; nope - return 0

	call	DGroup_Left	; Number of free bytes left in DGROUP
	mov	cx,ax		; after the end of the current heap
	mov	bx,ax		; Save in BX for later

	mov	si,[_asegds].bottom ; si = start of near heap
	jmp	short x_first	; into the middle of things

x_notfree:
	cmp	ax,-2		; check for end of heap
	je	x_endheap
	add	si,ax		; advance to next heap entry

x_first:
	lodsw			; ax = length
	test	al,1
	jz	x_notfree	;   in use - go to next one
;
;	Add up a series of 1 or more contiguous free blocks as if
;	they were coalesced.  Coalescing is only done when needed.
;
	mov	dx,-2		; bias by -2 for first header

x_isfree:
	dec	ax		; ax = length of free block
	inc	dx
	inc	dx		; add in size of freeable header
	add	dx,ax		; add in free block
	add	si,ax		; si = next entry
	lodsw
	test	al,1		; is next free?
	jnz	x_isfree	;   yes - total it up

	cmp	ax,-2
	jne	x_notend
	add	dx,bx		; add in space left in DS after heap
	add	dx,2		; don't need a new header
x_notend:
	cmp	cx,dx		; add in "would-be coalesced" block
	ja	x_notfree	; made up of adjacent free entries
	mov	cx,dx
	jmp	x_notfree	; CX keeps track of largest

x_endheap:
	mov	ax,cx		; return largest number of free
				; bytes in one contiguous piece
x_exit:

cEnd

page
;***
;unsigned _memavl() - gives byte count of remaining space in near heap
;
;Purpose:
;	The _memval function returns the approximate size, in bytes, of
;	the memory available for dynamic memory allocation within the
;	default data segment.  This function can be used with calloc,
;	malloc, or realloc in small/medium memory models, and with
;	_nmalloc in all memory models.
;
;	This is the DOS version of _memavl, and it calls DGroup_Left.
;
;Entry:
;	None.
;
;Exit:
;	returns AX = WORD size in bytes of available 'near heap' memory
;
;Uses:
;	CX, DX.
;
;Exceptions:
;
;*******************************************************************************

cProc	_memavl,<PUBLIC>,<si>

cBegin
	call	_initheap	; make sure heap is init'd
	or	ax,ax		; did _initheap succeed ??
	jz	_exit		; nope - return 0

	call	DGroup_Left	; Number of free bytes left in DGROUP
	mov	cx,ax		; after the end of the current heap

	mov	si,[_asegds].bottom ; si = start of near heap
	jmp	short _first	; into the middle of things

_notfree:
	cmp	ax,-2		; check for end of heap
	je	_endheap
	add	si,ax		; advance to next heap entry

_first:
	lodsw			; ax = length
	test	al,1
	jz	_notfree	;   in use - go to next one
;
;	Add up a series of 1 or more contiguous free blocks as if
;	they were coalesced.  Coalescing is only done when needed.
;
	mov	dx,-2		; bias by -2 for first header

_isfree:
	dec	ax		; ax = length of free block
	inc	dx
	inc	dx		; add in size of freeable header
	add	dx,ax		; add in free block
	add	si,ax		; si = next entry
	lodsw
	test	al,1		; is next free?
	jnz	_isfree		;   yes - total it up

	add	cx,dx		; add in "would-be coalesced" block
	jmp	_notfree	; made up of adjacent free entries

_endheap:
	mov	ax,cx		; return number of free bytes

_exit:

cEnd

page
;***
;unsigned _freect(size) - count of blocks of given size that can be _nmalloc()'d
;
;Purpose:
;	To give an indication of how much free space is available
;	within the default data segment for dynamic memory allocation
;	(malloc/_nmalloc), in terms of the number of blocks of the
;	given size that can be _nmalloc()'d before running out of space.
;
;Entry:
;	blksiz = WORD size of block to be used as a measuring rod
;		 of available memory
;
;Exit:
;	returns AX = WORD number of blocks of size 'blksiz' that could
;	             be _nmalloc()'d
;
;Uses:
;	BX, CX, DX.
;
;Exceptions:
;
;*******************************************************************************

cProc	_freect,<PUBLIC>,<si>

	parmW	blksiz		; block size

cBegin
	call	_initheap	; make sure heap is init'd
	or	ax,ax		; did _initheap succeed ??
	jz	freectxit	; nope - return 0

	mov	si,[_asegds].bottom ; si = start of near heap
	mov	bx,blksiz
	add	bx,3
	and	bl,not 1	; round up even (blksiz+2)
	xor	cx,cx		; # free entries
	jmp	short first	; into the middle of things

notfree:
	cmp	ax,-2		; check for end of heap
	je	endheap
	add	si,ax

first:
	lodsw			; ax = length
	test	al,1
	jz	notfree		;   in use - go to next one

	mov	dx,-2		; bias by -2

isfree:
	dec	ax		; ax = length of free block
	inc	dx
	inc	dx		; add in size of freeable header
	add	dx,ax		; add in free block
	add	si,ax		; si = next entry
	lodsw
	test	al,1		; is next free?
	jnz	isfree		;   yes - total it up

	push	ax
	xchg	ax,dx
	xor	dx,dx
	div	bx
	add	cx,ax		; cx += freeblock / (blksiz+2)
	pop	ax
	jmp	notfree

endheap:
	push	bx		; DGroup_Left may trash BX
	call	DGroup_Left	; must preserve CX
	pop	bx
	xor	dx,dx
	div	bx
	add	ax,cx		; ax = cx + DGROUPfree / (blksiz+2)

freectxit:
cEnd

page
;***
;_initheap - Initializes the heap, if necessary.
;
;Purpose:
;	_initheap tests to see if the heap is initialized.  If not,
;	it issues a malloc which causes the heap to be initialized.
;	_initheap then frees the memory it aquired (since it is not
;	really needed).
;
;	We must check to see if _nmalloc returns NULL.
;
;Entry:
;	None.
;
;Exit:
;	AX =  0 = failure, heap no room to initialize heap
;	     !0 = success, heap initialized
;
;Uses:
;	AX, BX
;
;Exceptions:
;	None.
;
;*******************************************************************************

cProc	_initheap,<NEAR>,<>

cBegin
	mov	ax,1		;ax = 1 = success flag
	mov	bx,dataoffset[_asegds] ;heap data base
	cmp	word ptr[bx],0	;is it init'd ??
	jne	_initdone	;leave if heap init'd

	;mov	ax,1		;allocate a 1-byte area
	push	ax		;onto the stack
	call	_nmalloc	;initialize the heap
	pop	bx		;[1] clean stack after call for people who's
				;[1] CMACROS doesn't put a MOV SP,BP at the end
	or	ax,ax		;did _nmalloc() succeed ??
	jz	_initdone	;if failure, exit with AX=0
	mov	bx,ax		;get mem addr in index reg
	or	byte ptr[bx-2],1 ;free the memory

_initdone:			;return with ax

cEnd

sEnd	code

	end

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品―色哟哟| 日韩精品中文字幕一区二区三区 | 91亚洲国产成人精品一区二三 | 91麻豆6部合集magnet| 成人在线综合网| 国产精品1区2区3区在线观看| 日本不卡一区二区| 日本欧美在线观看| 久久aⅴ国产欧美74aaa| 黄色小说综合网站| 国产高清不卡一区| 91免费在线播放| 一本到高清视频免费精品| 色综合激情久久| 欧美日韩国产精品成人| 欧美精品v日韩精品v韩国精品v| 欧美日韩成人高清| 精品国产乱码久久久久久1区2区| 久久久亚洲精品一区二区三区| 精品区一区二区| 国产精品美女视频| 亚洲一区二区三区免费视频| 日韩综合在线视频| 精品亚洲国产成人av制服丝袜| 国产综合久久久久影院| 成人美女视频在线看| 99久精品国产| 欧美区在线观看| 国产日韩三级在线| 一区二区三区.www| 精品一区二区在线视频| 成人免费视频网站在线观看| 欧美日韩中字一区| 国产日韩欧美精品电影三级在线| 亚洲欧美另类久久久精品2019| 青青草精品视频| www.欧美.com| 精品三级在线看| 一区二区三区欧美在线观看| 国内精品久久久久影院薰衣草 | 一区二区三区日韩欧美| 久久国产生活片100| 欧洲国产伦久久久久久久| 精品国产乱码久久久久久免费 | 26uuu亚洲婷婷狠狠天堂| 日韩理论电影院| 国产呦精品一区二区三区网站| 99精品国产热久久91蜜凸| 精品国产91九色蝌蚪| 亚洲高清不卡在线观看| a级精品国产片在线观看| 日韩欧美色综合网站| 亚洲最快最全在线视频| 成人一区二区三区在线观看| 精品国产露脸精彩对白 | 久久伊99综合婷婷久久伊| 夜夜精品视频一区二区 | 国产成人在线视频播放| 欧美一区二区三区视频免费| 一区二区在线观看视频| 成人黄页在线观看| 久久久电影一区二区三区| 日韩国产成人精品| 欧美视频中文字幕| 一区二区三区欧美| 91欧美一区二区| 国产精品国产三级国产| 黄页视频在线91| 欧美精品一区二区三区蜜臀| 日韩精品高清不卡| 欧美日韩成人激情| 亚洲成人www| 欧美日免费三级在线| 亚洲国产日韩a在线播放| 91浏览器在线视频| 亚洲激情在线播放| 在线免费观看成人短视频| 亚洲免费三区一区二区| 色综合一区二区| 一二三四区精品视频| 色94色欧美sute亚洲线路一久| 亚洲精品中文字幕乱码三区| 91网站在线观看视频| 一区二区不卡在线视频 午夜欧美不卡在| av在线免费不卡| 亚洲欧美一区二区不卡| 日本韩国欧美国产| 日韩精品91亚洲二区在线观看| 欧美一级片免费看| 国产黄色精品网站| 亚洲人成网站精品片在线观看| 欧美影视一区二区三区| 久久精品国产精品亚洲精品 | 97久久超碰国产精品| 亚洲免费毛片网站| 91精品蜜臀在线一区尤物| 精品一区二区三区视频在线观看| 久久先锋影音av鲁色资源网| av网站一区二区三区| 天堂一区二区在线免费观看| 久久久久久久久久久久电影| 99精品视频在线播放观看| 亚洲高清免费一级二级三级| 久久亚洲一级片| 欧美综合一区二区三区| 蜜臀av性久久久久蜜臀aⅴ流畅| 久久久99久久| 色婷婷国产精品| 亚洲777理论| 久久夜色精品一区| 欧美性受xxxx黑人xyx| 午夜精品成人在线| 久久午夜国产精品| 91在线观看免费视频| 日韩欧美在线一区二区三区| 99re热视频这里只精品| 亚洲精品成人悠悠色影视| 欧美精品久久久久久久多人混战 | 久久一区二区三区四区| 99精品国产视频| 国产精品黄色在线观看| 欧洲一区二区av| 另类小说综合欧美亚洲| 国产精品欧美精品| 这里只有精品电影| 成人久久18免费网站麻豆| 亚洲综合精品自拍| 欧美一区永久视频免费观看| 色综合天天综合给合国产| 肉色丝袜一区二区| 欧美国产日产图区| 欧美三级三级三级爽爽爽| 国产麻豆精品95视频| 奇米亚洲午夜久久精品| 中文一区二区在线观看| 91精品一区二区三区久久久久久 | 色菇凉天天综合网| 韩国欧美国产1区| 一区二区三区在线免费播放| 欧美性猛交xxxxxxxx| 99视频有精品| 国产精品88av| 蜜臀久久99精品久久久久久9| 最新成人av在线| 久久精品一级爱片| 337p日本欧洲亚洲大胆精品| 欧美三级蜜桃2在线观看| 不卡高清视频专区| 国产真实乱子伦精品视频| 亚洲国产精品综合小说图片区| 亚洲六月丁香色婷婷综合久久| 久久久综合精品| 日韩精品最新网址| 欧美日韩黄视频| 欧美在线观看一区二区| 欧美日精品一区视频| 色综合天天性综合| 一本久久a久久精品亚洲| 国产69精品久久99不卡| 国产自产视频一区二区三区| 久久99精品国产麻豆婷婷| 亚洲男人的天堂av| 亚洲男同性视频| 国产色综合久久| 欧美国产乱子伦| 伊人婷婷欧美激情| 夜夜嗨av一区二区三区四季av| 亚洲人快播电影网| 亚洲精品成人悠悠色影视| 亚洲青青青在线视频| 亚洲视频在线一区二区| 亚洲天天做日日做天天谢日日欢 | 不卡的av中国片| 国产成人免费视频精品含羞草妖精| 美国一区二区三区在线播放| 人人狠狠综合久久亚洲| 免费av成人在线| 成人免费毛片a| 97国产精品videossex| 一本到一区二区三区| 欧美亚洲国产bt| 欧美日本免费一区二区三区| 欧美日韩不卡视频| 欧美变态口味重另类| 久久综合狠狠综合久久综合88| 久久精品日产第一区二区三区高清版| 国产精品乱人伦中文| 国产精品萝li| 亚洲国产三级在线| 久久国产精品99精品国产| www.日本不卡| 欧美乱妇15p| www国产精品av| 亚洲免费av高清| 国产米奇在线777精品观看| 99视频超级精品| 3d成人动漫网站| 日韩欧美专区在线| 久久久久久夜精品精品免费| 亚洲欧美日韩在线|