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

📄 auldiv.s,v

📁 用TCPIP进行网际互联源码
💻 S,V
字号:
head	1.1;access;symbols;locks	dls:1.1; strict;comment	@# @;1.1date	97.09.21.19.27.40;	author dls;	state Dist;branches;next	;desc@@1.1log@pre-3e code@text@|J. Test	1/81|addressed unsigned long division: *dividend = *dividend / divisor	.globl	auldiv	.textauldiv:	link	a6,#0	moveml	#0x3800,sp@@-	|need d2,d3,d4 registers	movl	a6@@(8),a0	|a0 = dividend pointer	movl	a0@@,d0		|d0 = dividend	movl	d0,d3		|save dividend	movl	a6@@(12),d1	|divisor	movl	d1,d4		|save divisor	cmpl	#0x10000,d1	|divisor >= 2 ** 16?	jge	1$		|yes, divisor must be < 2 ** 16	clrw	d0		|divide dividend	swap	d0		|  by 2 ** 16	divu	d1,d0		|get the high order bits of quotient	movw	d0,d2		|save quotient high	movw	d3,d0		|dividend low + remainder * (2**16)	divu	d1,d0		|get quotient low	swap	d0		|temporarily save quotient low in high	movw	d2,d0		|restore quotient high to low part of register	swap	d0		|put things right	jra	3$		|return1$:	asrl	#1,d0		|shift dividend	asrl	#1,d1		|shift divisor	andl	#0x7FFFFFFF,d0	|assure positive	andl	#0x7FFFFFFF,d1	|  sign bit	cmpl	#0x10000,d1	|divisor < 2 ** 16?	jge	1$		|no, continue shift	divu	d1,d0		|yes, divide, remainder is garbage	andl	#0xFFFF,d0	|get rid of remainder	movl	d0,d2		|save quotient	movl	d0,sp@@-		|call ulmul with quotient	movl	d4,sp@@-		|  and saved divisor on stack	jsr	ulmul		|  as arguments	addql	#8,sp		|restore sp	cmpl	d0,d3		|original dividend >= lmul result?	jge	2$		|yes, quotient should be correct	subql	#1,d2		|no, fix up quotient2$:	movl	d2,d0		|move quotient to d03$:	movl	d0,a0@@		|store result via pointer	moveml	sp@@+,#0x1C	|restore registers	unlk	a6	rts@

⌨️ 快捷键说明

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