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

📄 dparam.s

📁 LINUX lilo-22.7 源代码。
💻 S
字号:
#if 0;  dparam.S  isCopyright 1992 Werner Almesberger */All rights reserved.Licensed under the terms contained in the file 'COPYING' in the source directory.#endif	.text	.globl	_main	.org	0x100_main:	mov	bl,0x80			! NUL-terminate the command line	xor	bh,bh	mov	0x81(bx),bh	mov	bx,#0x81aloop:	mov	al,(bx)			! get the next character	inc	bx	cmp	al,#32			! space ?	je	aloop			! yes -> skip it	cmp	al,#48			! '0' ?	jne	error			! no -> invalid	cmpb	(bx),#120		! 'x' ?	je	okay			! yes -> okay	cmpb	(bx),#88		! 'X' ?	jne	error			! no -> invalidokay:	cmpb	1(bx),#56		! '8' ?	jne	error			! no -> invalid	cmpb	3(bx),#0		! one more digit ?	jne	error			! no -> invalid	mov	dl,2(bx)		! get the digit	sub	dl,#48			! convert to a number	cmp	dl,#1			! valid ?	ja	error			! no -> error	add	dl,#0x80		! adjust the number	mov	ah,#8			! get the drive parameters	int	0x13	or	ah,ah			! error ?	jnz	derror			! yes -> display a message	push	cx			! save the parameters	push	dx	mov	al,cl			! number of sectors	and	al,#0x3f	xor	ah,ah	call	decout	call	space	pop	dx			! number of heads	mov	al,dh	inc	al	xor	ah,ah	call	decout	call	space	pop	ax			! number of cylinders	xchg	ah,al	mov	cl,#6	shr	ah,cl	inc	ax	call	decout	mov	dx,#crlf		! crlf	mov	ah,#9	int	0x21	ret				! doneerror:	mov	dx,#errmsg		! display the error message	jmp	dispitderror:	mov	dx,#invdrv		! display the error message	jmp	dispitspace:	mov	dx,#spc			! display two blanks	jmp	dispitdecout:	mov	bx,#decend		! set the pointer to the enddeclp:	xor	dx,dx			! divide by 10	mov	cx,#10	div	cx	add	dl,#48			! make a digit	dec	bx			! store digit	mov	(bx),dl	or	ax,ax			! zero ?	jnz	declp			! no -> go on	mov	dx,bx			! display the stringdispit:	mov	ah,#9	int	0x21	ret				! doneerrmsg:	.ascii	"usage: dparam 0x80"	.byte	13,10	.ascii	"   or  dparam 0x81"crlf:	.byte	13,10	.ascii	"$"invdrv:	.ascii	"Invalid drive"	.byte	13,10	.ascii	"$"spc:	.ascii	"  $"decbuf:	.byte	0,0,0,0,0decend:	.ascii	"$"

⌨️ 快捷键说明

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