⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 extconv.asm

📁 Turbo Pascal 6.0编译器源码
💻 ASM
字号:
	model	large extend_text,pascal
	include	extend.inc

	.code	Extend_Text

	Argm	Num,dword,1
	Entry	Round23
	push	si
	push	ds
	lds	si,Num
	mov	ax,[si+4]
	mov	dx,[si+6]
	cmp	word ptr [si],0
	jne	@@1
	cmp	word ptr [si+2],0
	jne	@@1
	test	al,7fh
	jnz	@@1
	test	ah,1
	jz	@@2
@@1:	add	al,al
	adc	ah,0
	adc	dx,0
	jnc	@@2
	rcr	dx,1
	rcr	ax,1
	inc	word ptr [si+8]
	mov	bx,7fffh
	and	bx,[si+8]
	inc	bx
	jo	@@3
@@2:	mov	al,0
	sub	bx,bx
	mov	[si],bx
	mov	[si+2],bx
	mov	[si+4],ax
	mov	[si+6],dx
	pop	ds
	jmp	short @@4
@@3:	sub	ax,ax
	mov	dx,8000h
	jmp	@@2
@@4:	pop	si
	Exit

	Argm	Src,dword,1
	Argm	Dst,dword,1
	Loc	Temp,word,5
	Entry	Ext2Single
	push	si di
	push	ds
	lds	si,Src
	lea	di,Temp
	push	ss
	pop	es
	mov	cx,5
	cld
	rep	movsw
	pop	ds
	push	ss
	lea	ax,Temp
	push	ax
	call	Round23
	mov	bx,Temp[8]
	mov	cl,0
	shl	bx,1
	rcl	cl,1
	shr	bx,1
	cmp	bx,7fffh
	je	@@2
	add	bx,0c080h
	jle	@@4
	cmp	bx,0ffh
	jge	@@3
	mov	bh,byte ptr Temp[7]
	mov	ax,Temp[5]
	xchg	bh,bl
	shl	bl,1
@@1:	shr	cl,1
	rcr	bx,1
	les	di,Dst
	cld
	stosw
	xchg	ax,bx
	stosw
	jmp	short @@5
@@2:	mov	bl,byte ptr Temp[7]
	shl	bl,1
	mov	bh,-1
	sub	ax,ax
	jmp	@@1
@@3:	mov	bx,0ff00h
	sub	ax,ax
	jmp	@@1
@@4:	sub	bx,bx
	sub	ax,ax
	jmp	@@1
@@5:	pop	di si
	Exit

	Argm	Num,dword,1
	Entry	Round52
	push	si di
	push	ds
	lds	si,Num
	mov	ax,[si+1]
	mov	dh,3
	and	dh,al
	or	dh,[si]
	jnz	@@1
	test	al,8
	jz	@@2
@@1:	add	ax,4
	jnc	@@2
	sub	bx,bx
	adc	[si+3],bx
	adc	[si+5],bx
	adc	[si+7],bl
	jnc	@@2
	inc	word ptr [si+8]
	mov	di,7fffh
	and	di,[si+8]
	inc	di
	jo	@@4
@@2:	and	al,0f8h
	mov	byte ptr [si],0
	mov	[si+1],ax
@@3:	pop	ds
	jmp	short @@5
@@4:	mov	[si],bx
	mov	[si+2],bx
	mov	[si+4],bx
	mov	word ptr [si+6],8000h
	jmp	@@3
@@5:	pop	di si
	Exit

	Argm	Src,dword,1
	Argm	Dst,dword,1
	Loc	Temp,word,5
	Entry	Ext2Double
	push	si di
	push	ds
	lds	si,Src
	lea	di,Temp
	push	ss
	pop	es
	mov	cx,5
	cld
	rep	movsw
	pop	ds
	push	ss
	lea	ax,Temp
	push	ax
	call	Round52
	mov	ax,Temp[1]
	mov	di,Temp[3]
	mov	cx,Temp[5]
	mov	dl,byte ptr Temp[7]
	mov	bx,Temp[8]
	and	bx,7fffh
	cmp	bx,7fffh
	je	@@3
	add	bx,0c400h
	jle	@@2
	cmp	bx,7ffh
	jge	@@4
	shl	dl,1
	shr	bx,1
	rcr	dl,1
	or	al,bh
	mov	dh,bl
	mov	bx,di
	shr	di,1
	rcr	ax,1
	rcr	dx,1
	rcr	cx,1
	rcr	bx,1
	shr	di,1
	rcr	ax,1
	rcr	dx,1
	rcr	cx,1
	rcr	bx,1
	shl	Temp[8],1
	adc	al,0
	shr	di,1
	rcr	ax,1
	rcr	dx,1
	rcr	cx,1
	rcr	bx,1
@@1:	les	di,Dst
	cld
	stosw
	xchg	ax,bx
	stosw
	xchg	ax,cx
	stosw
	xchg	ax,dx
	stosw
	jmp	short @@6
@@2:	mov	dx,0
	jmp	short @@5
@@3:	and	dx,7fh
	shr	dx,1
	shr	dx,1
	or	dx,0ffe0h
	jmp	short @@5
@@4:	mov	dx,0ffe0h
@@5:	shl	temp[8],1
	rcr	dx,1
	sub	cx,cx
	mov	bx,cx
	mov	ax,cx
	jmp	@@1
@@6:	pop	di si
	Exit

	Argm	Src,dword,1
	Argm	Dst,dword,1
	Entry	Single2Ext
	push	si di
	cld
	les	si,Src
	mov	ax,es:[si]
	mov	dx,es:[si+2]
	sub	si,si
	shl	dx,1
	rcr	si,1
	sub	bx,bx
	add	bl,dh
	jz	@@4
	cmp	dh,-1
	je	@@3
	sub	bx,7fh
	stc
@@1:	rcr	dl,1
@@2:	mov	dh,dl
	mov	dl,ah
	mov	ch,al
	mov	cl,0
	les	di,Dst
	sub	ax,ax
	stosw
	stosw
	xchg	ax,cx
	stosw
	xchg	ax,dx
	stosw
	xchg	ax,bx
	add	ax,3fffh
	or	ax,si
	stosw
	jmp	short @@7
@@3:	mov	bx,ax
	or	bl,dl
	neg	bx
	mov	bx,4000h
	jmp	@@1
@@4:	mov	cx,dx
	or	cx,ax
	jz	@@6
	sub	bx,7fh
	shr	dl,1
@@5:	add	ax,ax
	adc	dl,dl
	js	@@2
	dec	bx
	jmp	@@5
@@6:	mov	bx,0c001h
	jmp	@@2
@@7:	pop	di si
	Exit

	Argm	Src,dword,1
	Argm	Dst,dword,1
	Entry	Double2Ext
	push	si di
	push	ds
	lds	si,Src
	les	di,Dst
	mov	dx,[si+6]
	sub	ax,ax
	shl	dx,1
	rcr	ax,1
	std
	lea	di,[di+8]
	mov	es:[di],ax
	mov	cl,5
	shr	dx,cl
	jz	@@4
	cmp	dx,7ffh
	je	@@3
	mov	bl,10h
	sub	dx,3ffh
@@1:	xchg	ax,dx
	add	ax,3fffh
	or	ax,es:[di]
	stosw
	mov	dx,[si+5]
	and	dh,0fh
	or	dh,bl
	mov	cx,[si+3]
	mov	bx,[si+1]
	mov	ah,[si]
	mov	al,0
	shl	ax,1
	rcl	bx,1
	rcl	cx,1
	rcl	dx,1
	shl	ax,1
	rcl	bx,1
	rcl	cx,1
	rcl	dx,1
	shl	ax,1
	rcl	bx,1
	rcl	cx,1
	rcl	dx,1
@@2:	xchg	ax,dx
	stosw
	xchg	ax,cx
	stosw
	xchg	ax,bx
	stosw
	xchg	ax,dx
	stosw
	pop	ds
	jmp	@@7
@@3:	mov	bl,[si+6]
	and	bx,0fh
	or	bx,[si+4]
	or	bx,[si+2]
	or	bx,[si]
	mov	dx,4000h
	jz	@@1
	mov	bl,10h
	jmp	@@1
@@4:	mov	bl,[si+6]
	and	bx,0fh
	or	bx,[si+4]
	or	bx,[si+2]
	or	bx,[si]
	jnz	@@5
	mov	dx,0c001h
	jmp	@@1
@@5:	mov	dx,[si+5]
	and	dh,0fh
	mov	cx,[si+3]
	mov	bx,[si+1]
	mov	ah,[si]
	mov	al,4
@@6:	dec	al
	shl	ah,1
	rcl	bx,1
	rcl	cx,1
	adc	dx,dx
	jns	@@6
	push	ax
	cbw
	add	ax,3c00h
	or	ax,es:[di]
	stosw
	pop	ax
	mov	al,0
	jmp	@@2
@@7:	pop	di si
	Exit

	Argm	Src,dword,1
	Argm	Dst,dword,1
	Entry	Comp2Ext
	push	si di
	push	ds
	lds	si,Src
	mov	ax,[si]
	mov	bx,[si+2]
	mov	cx,[si+4]
	mov	dx,[si+6]
	pop	ds
	mov	di,0
	or	dx,dx
	jl	@@1
	jg	@@2
	or	cx,cx
	jnz	@@2
	or	bx,bx
	jnz	@@2
	or	ax,ax
	jnz	@@2
	sub	si,si
	jmp	short @@7
@@1:	not	dx
	not	cx
	not	bx
	neg	ax
	cmc
	adc	bx,0
	adc	cx,0
	adc	dx,0
	mov	di,1
@@2:	mov	si,64
@@3:	or	dx,dx
	jnz	@@4
	xchg	dx,cx
	xchg	cx,bx
	xchg	bx,ax
	sub	si,16
	jmp	@@3
@@4:	js	@@6
@@5:	dec	si
	add	ax,ax
	adc	bx,bx
	adc	cx,cx
	adc	dx,dx
	jns	@@5
@@6:	add	si,3ffeh
	shl	si,1
	or	si,di
	ror	si,1
@@7:	les	di,Dst
	cld
	stosw
	xchg	ax,bx
	stosw
	xchg	ax,cx
	stosw
	xchg	ax,dx
	stosw
	xchg	ax,si
	stosw
	pop	di si
	Exit

	Argm	Src,dword,1
	Argm	Dst,dword,1
	Entry	Ext2Comp
	push	si di
	push	ds
	lds	si,Src
	mov	di,7fffh
	and	di,[si+8]
	sub	di,3ffeh
	cmp	di,63
	jg	@@1
	or	di,di
	jge	@@3
	sub	dx,dx
	jmp	short @@2
@@1:	mov	dx,8000h
@@2:	sub	ax,ax
	mov	bx,ax
	mov	cx,ax
	jmp	short @@8
@@3:	mov	dx,[si+6]
	mov	cx,[si+4]
	mov	bx,[si+2]
	mov	ax,[si]
	sub	di,48
	ja	@@5
@@4:	mov	ax,bx
	mov	bx,cx
	mov	cx,dx
	sub	dx,dx
	add	di,16
	jle	@@4
	and	di,0fh
@@5:	neg	di
	jz	@@7
	add	di,16
@@6:	shr	dx,1
	rcr	cx,1
	rcr	bx,1
	rcr	ax,1
	dec	di
	jg	@@6
@@7:	test	byte ptr [si+9],80h
	jz	@@8
	sub	si,si
	not	dx
	not	cx
	not	bx
	neg	ax
	cmc
	adc	bx,si
	adc	cx,si
	adc	dx,si
@@8:	les	di,Dst
	cld
	stosw
	xchg	ax,bx
	stosw
	xchg	ax,cx
	stosw
	xchg	ax,dx
	stosw
	sub	di,8
	pop	ds
	pop	di si
	Exit

	Argm	Src,dword,1
	Loc	Temp,word,4
	Entry	Ext2Long
	push	Src ss
	lea	ax,Temp
	push	ax
	call	Ext2Comp
	mov	ax,Temp[2]
	cwd
	cmp	dx,Temp[4]
	jne	@@1
	cmp	dx,Temp[6]
	jne	@@1
	xchg	ax,dx
	mov	ax,Temp[0]
	jmp	short @@2
@@1:	sub	ax,ax
	mov	dx,8000h
@@2:	Exit

	Argm	Dst,dword,1
	Loc	Temp,word,4
	Entry	Ext2Ulong
	push	Dst ss
	lea	ax,Temp
	push	ax
	call	Ext2Comp
	mov	ax,Temp[0]
	mov	dx,Temp[2]
	mov	cx,Temp[4]
	or	cx,Temp[6]
	jz	@@1
	mov	ax,-1
	mov	dx,ax
@@1:	Exit

	Argm	Src,dword,1
	Argm	Dst,dword,1
	Loc	Temp,word,4
	Entry	Long2Ext
	mov	ax,word ptr Src[0]
	mov	Temp[0],ax
	mov	ax,word ptr Src[2]
	mov	Temp[2],ax
	cwd
	mov	Temp[4],dx
	mov	Temp[6],dx
	push	ss
	lea	ax,Temp
	push	ax
	push	Dst
	call	Comp2Ext
	Exit

	Argm	Src,dword,1
	Argm	Dst,dword,1
	Loc	Temp,word,4
	Entry	Ulong2Ext
	mov	ax,word ptr Src[0]
	mov	Temp[0],ax
	mov	ax,word ptr Src[2]
	mov	Temp[2],ax
	sub	ax,ax
	mov	Temp[4],ax
	mov	Temp[6],ax
	push	ss
	lea	ax,Temp
	push	ax
	push	Dst
	call	Comp2Ext
	Exit

	Argm	Src,dword,1
	Argm	Dst,dword,1
	Entry	Real2Ext
	push	si di
	les	di,Src
	mov	dx,es:[di]
	sub	bx,bx
	or	dl,dl
	jnz	@@1
	mov	si,bx
	mov	cx,bx
	mov	dx,bx
	jmp	short @@2
@@1:	mov	si,es:[di+2]
	mov	cx,es:[di+4]
	mov	bh,dh
	mov	dh,ch
	and	dh,80h
	add	dx,3f7eh
	or	ch,80h
@@2:	les	di,Dst
	cld
	sub	ax,ax
	stosw
	xchg	ax,bx
	stosw
	xchg	ax,si
	stosw
	xchg	ax,cx
	stosw
	xchg	ax,dx
	stosw
	pop	di si
	Exit

	Argm	Src,dword,1
	Argm	Dst,dword,1
	Entry	Ext2Real
	push	si di
	push	ds
	lds	si,Src
	cld
	lodsw
	lodsw
	xchg	ax,bx
	lodsw
	xchg	ax,cx
	lodsw
	xchg	ax,dx
	lodsw
	pop	ds
	mov	di,ax
	and	ax,7fffh
	sub	ax,3f7eh
	jbe	@@2
	or	ah,ah
	jnz	@@1
	mov	ah,bh
	shl	bl,1
	adc	ah,0
	adc	cx,0
	adc	dx,0
	jnc	@@4
	inc	al
	jnz	@@4
@@1:	mov	ax,-1
	jmp	short @@3
@@2:	sub	ax,ax
@@3:	mov	cx,ax
	mov	dx,ax
	jmp	short @@5
@@4:	shl	dx,1
	shl	di,1
	rcr	dx,1
@@5:	les	di,Dst
	stosw
	xchg	ax,cx
	stosw
	xchg	ax,dx
	stosw
	pop	di si
	Exit

	end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -