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

📄 testfp.asm

📁 汇编编程艺术
💻 ASM
📖 第 1 页 / 共 4 页
字号:
		fpcmp
		pushf
		print
		db	"AX = ",0
		puti
		popf
		je	TheyreEql3
		print
		db	" -1.0 <> 0.0",cr,lf,0
		jmp	EndTest3
;
TheyreEql3:	print
		db	" -1.0 = 1.0",cr,lf,0
EndTest3:
;
		lefpal
		dt	0.0
		lefpol
		dt	-1.0
		fpcmp
		pushf
		print
		db	"AX = ",0
		puti
		popf
		je	TheyreEql4
		print
		db	" 0.0 <> -1.0",cr,lf,0
		jmp	EndTest4
;
TheyreEql4:	print
		db	" 0.0 = -1.0",cr,lf,0
EndTest4:
;
		lefpal
		dt	1.0
		lefpol
		dt	1.0
		fpcmp
		pushf
		print
		db	"AX = ",0
		puti
		popf
		je	TheyreEql5
		print
		db	" 1.0 <> 1.0",cr,lf,0
		jmp	EndTest5
;
TheyreEql5:	print
		db	" 1.0 = 1.0",cr,lf,0
EndTest5:
;
		lefpal
		dt	-1.0
		lefpol
		dt	1.0
		fpcmp
		pushf
		print
		db	"AX = ",0
		puti
		popf
		je	TheyreEql6
		print
		db	" -1.0 <> 1.0",cr,lf,0
		jmp	EndTest6
;
TheyreEql6:	print
		db	" -1.0 = 1.0",cr,lf,0
EndTest6:
;
		lefpal
		dt	-1.0
		lefpol
		dt	-1.0
		fpcmp
		pushf
		print
		db	"AX = ",0
		puti
		popf
		je	TheyreEql7
		print
		db	" -1.0 <> -1.0",cr,lf,0
		jmp	EndTest7
;
TheyreEql7:	print
		db	" -1.0 = -1.0",cr,lf,0
EndTest7:
;
		lefpal
		dt	0.5
		lefpol
		dt	1.0
		fpcmp
		pushf
		print
		db	"AX = ",0
		puti
		popf
		je	TheyreEql8
		print
		db	" 0.5 <> 1.0",cr,lf,0
		jmp	EndTest8
;
TheyreEql8:	print
		db	" 0.5 = 1.0",cr,lf,0
EndTest8:
;
		lefpal
		dt	1.0
		lefpol
		dt	0.5
		fpcmp
		pushf
		print
		db	"AX = ",0
		puti
		popf
		je	TheyreEql9
		print
		db	" 1.0 <> 0.5",cr,lf,0
		jmp	EndTest9
;
TheyreEql9:	print
		db	" 1.0 = 0.5",cr,lf,0
EndTest9:
;
		lefpal
		dt	1.0
		lefpol
		dt	1.5
		fpcmp
		pushf
		print
		db	"AX = ",0
		puti
		popf
		je	TheyreEqla
		print
		db	" 1.0 <> 1.5",cr,lf,0
		jmp	EndTesta
;
TheyreEqla:	print
		db	" 1.0 = 1.5",cr,lf,0
EndTesta:
;
		lefpal
		dt	1.5
		lefpol
		dt	1.0
		fpcmp
		pushf
		print
		db	"(17) AX = ",0
		puti
		popf
		je	TheyreEqlb
		print
		db	" 1.5 <> 1.0",cr,lf,0
		jmp	EndTestb
;
TheyreEqlb:	print
		db	" 1.5 = 1.0",cr,lf,0
EndTestb:
;
		lefpal
		dt	1.00000000000000005
		lefpol
		dt	1.0
		fpcmp
		pushf
		print
		db	"(18) AX = ",0
		puti
		popf
		je	TheyreEqlc
		print
		db	" 1.00000000000000005 <> 1.0",cr,lf,0
		jmp	EndTestc
;
TheyreEqlc:	print
		db	" 1.00000000000000005 = 1.0",cr,lf,0
EndTestc:
;
		lefpal
		dt	1.000000000000000005
		lefpol
		dt	1.0
		fpcmp
		pushf
		print
		db	"(19) AX = ",0
		puti
		popf
		je	TheyreEqld
		print
		db	" 1.000000000000000005 <> 1.0",cr,lf,0
		jmp	EndTestd
;
TheyreEqld:	print
		db	" 1.000000000000000005 = 1.0",cr,lf,0
EndTestd:
;
		lefpal
		dt	1.0000000000000000005
		lefpol
		dt	1.0
		fpcmp
		pushf
		print
		db	"(20) AX = ",0
		puti
		popf
		je	TheyreEqle
		print
		db	" 1.0000000000000000005 <> 1.0",cr,lf,0
		jmp	EndTeste
;
TheyreEqle:	print
		db	" 1.0000000000000000005 = 1.0",cr,lf,0
EndTeste:
;
		lefpal
		dt	1.00000000000000000005
		lefpol
		dt	1.0
		fpcmp
		pushf
		print
		db	"(21) AX = ",0
		puti
		popf
		je	TheyreEqlf
		print
		db	" 1.00000000000000000005 <> 1.0",cr,lf,0
		jmp	EndTestf
;
TheyreEqlf:	print
		db	" 1.00000000000000000005 = 1.0",cr,lf,0
EndTestf:
;
		lefpal
		dt	1.000000000000000000005
		lefpol
		dt	1.0
		fpcmp
		pushf
		print
		db	"(22) AX = ",0
		puti
		popf
		je	TheyreEqlg
		print
		db	" 1.000000000000000000005 <> 1.0",cr,lf,0
		jmp	EndTestg
;
TheyreEqlg:	print
		db	" 1.000000000000000000005 = 1.0",cr,lf,0
EndTestg:
;
		lefpal
		dt	1.0000000000000000000005
		lefpol
		dt	1.0
		fpcmp
		pushf
		print
		db	"(23) AX = ",0
		puti
		popf
		je	TheyreEqlh
		print
		db	" 1.0000000000000000000005 <> 1.0",cr,lf,0
		jmp	EndTesth
;
TheyreEqlh:	print
		db	" 1.0000000000000000000005 = 1.0",cr,lf,0
EndTesth:
;
		lefpal
		dt	1.0e10
		lefpol
		dt	1.0e100
		fpcmp
		pushf
		print
		db	"AX = ",0
		puti
		popf
		je	TheyreEqli
		print
		db	" 1.0e10 <> 1.0e100",cr,lf,0
		jmp	EndTesti
;
TheyreEqli:	print
		db	" 1.0e10 = 1.0e100",cr,lf,0
EndTesti:
;
		lefpal
		dt	1.0e100
		lefpol
		dt	1.0e10
		fpcmp
		pushf
		print
		db	"AX = ",0
		puti
		popf
		je	TheyreEqlj
		print
		db	" 1.0e100 <> 1.0e10",cr,lf,0
		jmp	EndTestj
;
TheyreEqlj:	print
		db	" 1.0e100 = 1.0e10",cr,lf,0
EndTestj:
;
;
		lefpal
		dt	1.0e-100
		lefpol
		dt	1.0e-10
		fpcmp
		pushf
		print
		db	"AX = ",0
		puti
		popf
		je	TheyreEqlk
		print
		db	" 1.0e-100 <> 1.0e-10",cr,lf,0
		jmp	EndTestk
;
TheyreEqlk:	print
		db	" 1.0e-100 = 1.0e-10",cr,lf,0
EndTestk:
;
		lefpal
		dt	1.0e-100
		lefpol
		dt	1.0e-100
		fpcmp
		pushf
		print
		db	"AX = ",0
		puti
		popf
		je	TheyreEqll
		print
		db	" 1.0e-100 <> 1.0e-100",cr,lf,0
		jmp	EndTestl
;
TheyreEqll:	print
		db	" 1.0e-100 = 1.0e-100",cr,lf,0
EndTestl:
;
		lefpal
		dt	1.0
		lefpol
		dt	2.0
		fpcmp
		pushf
		print
		db	"AX = ",0
		puti
		popf
		jge	TheyreEqlm
		print
		db	" 1.0 < 2.0",cr,lf,0
		jmp	EndTestm
;
TheyreEqlm:	print
		db	" 1.0 >= 2.0",cr,lf,0
EndTestm:
;
		lefpal
		dt	1.0
		lefpol
		dt	2.0
		fpcmp
		pushf
		print
		db	"AX = ",0
		puti
		popf
		jg	TheyreEqln
		print
		db	" 1.0 <= 2.0",cr,lf,0
		jmp	EndTestn
;
TheyreEqln:	print
		db	" 1.0 > 2.0",cr,lf,0
EndTestn:
;
		lefpal
		dt	1.0
		lefpol
		dt	2.0
		fpcmp
		pushf
		print
		db	"AX = ",0
		puti
		popf
		jle	TheyreEqlo
		print
		db	" 1.0 > 2.0",cr,lf,0
		jmp	EndTesto
;
TheyreEqlo:	print
		db	" 1.0 <= 2.0",cr,lf,0
EndTesto:
;
		lefpal
		dt	2.0
		lefpol
		dt	1.0
		fpcmp
		pushf
		print
		db	"AX = ",0
		puti
		popf
		jle	TheyreEqlp
		print
		db	" 2.0 > 1.0",cr,lf,0
		jmp	EndTestp
;
TheyreEqlp:	print
		db	" 2.0 <= 1.0",cr,lf,0
EndTestp:
		putcr
		putcr
;
;
;
;
;
;
;
;----------
;
		print
		db	"Testing FTOAM...",cr,lf,0
;
		print
		db	"Printing various forms of 1.12345678901234567890"
		db	cr,lf,"Remember only 17 significant digits get printed"
		db	cr,lf,0
		lefpal
		dt	1.12345678901234567890
		mov	cx, 20
DigitsLoop:	mov	ah, cl
		mov	al, 24
		ftoam
		puts
		free
		putcr
		loop	DigitsLoop
;
		print
		db	cr,lf,"Testing FTOA...",cr,lf,0
		mov	cx, 20
DigitsLoop2:	mov	ah, cl
		mov	al, 24
		lesi	Output
		ftoa
		puts
		putcr
		loop	DigitsLoop2
;
		print
		db	cr,lf,"Testing FTOA2 (  1.00  1.00)",cr,lf,'"',0
		lefpal
		dt	1.0
		lesi	Output
		mov	ax,206h
		ftoa2
		ftoa2
		lesi	Output
		puts
		mov	al, '"'
		putc
		putcr
;
;
;
;----------
;
		print
		db	cr,lf
		db	"Testing ETOAM...",cr,lf,0
;
		print
		db	"Printing various forms of 1.12345678901234567890"
		db	cr,lf,"Remember only 17 significant digits get printed"
		db	cr,lf,0
		lefpal
		dt	1.12345678901234567890
		mov	cx, 20
DigitsLoop3:	mov	al, cl
		add	al, 8
		etoam
		puts
		free
		putcr
		loop	DigitsLoop3
;
		print
		db	cr,lf,"Testing ETOA...",cr,lf,0
		mov	cx, 20
DigitsLoop4:	mov	al, cl
		add	al, 8
		puth
		print
		db	": ",0
		lesi	Output
		etoa
		puts
		putcr
		loop	DigitsLoop4
;
		print
		db	cr,lf,"Testing ETOA2",cr,lf,'"',0
		lefpal
		dt	1.0
		lesi	Output
		mov	ax,20ah
		etoa2
		etoa2
		lesi	Output
		puts
		mov	al, '"'
		putc
		putcr
;
;
;------
;
Testatof	macro	op
		lesi	op
		puts
		print
		db	" = ",0
		atof
		ftoam
		mov	al, 32
		etoam
		puts
		putcr
		endm
;
;
		print
		db	cr,lf,"Testing ATOF...",cr,lf,lf,0
;
		Testatof	Testatof1
		Testatof	Testatof2
		Testatof	Testatof3
		Testatof	Testatof4
		Testatof	Testatof5
		Testatof	Testatof6
		Testatof	Testatof7
		Testatof	Testatof8
		Testatof	Testatof9
		Testatof	Testatof10
		Testatof	Testatof11
		Testatof	Testatof12
		Testatof	Testatof13
		Testatof	Testatof14
		Testatof	Testatof15
		Testatof	Testatof16
		Testatof	Testatof17
		Testatof	Testatof18
		Testatof	Testatof19
		Testatof	Testatof20
		Testatof	Testatof21
		Testatof	Testatof22
		Testatof	Testatof23
		Testatof	Testatof24
		Testatof	Testatof25
		Testatof	Testatof26
		Testatof	Testatof27
		Testatof	Testatof28
		Testatof	Testatof29
		Testatof	Testatof30
		Testatof	Testatof31
		Testatof	Testatof32
		Testatof	Testatof33
		Testatof	Testatof34
		Testatof	Testatof35
		Testatof	Testatof36
		Testatof	Testatof37
		Testatof	Testatof38
		Testatof	Testatof39
		Testatof	Testatof40
		Testatof	Testatof41
		Testatof	Testatof42
		Testatof	Testatof43
		Testatof	Testatof44
		Testatof	Testatof45
		Testatof	Testatof46
		Testatof	Testatof47
		Testatof	Testatof48
		Testatof	Testatof49
		Testatof	Testatof50
		Testatof	Testatof51
		Testatof	Testatof52
;
		putcr
;
		Testatof	mTestatof11
		Testatof	mTestatof12
		Testatof	mTestatof13
		Testatof	mTestatof14
		Testatof	mTestatof15
		Testatof	mTestatof16
		Testatof	mTestatof17
		Testatof	mTestatof18
		Testatof	mTestatof19
		Testatof	mTestatof20
		Testatof	mTestatof21
		Testatof	mTestatof22
		Testatof	mTestatof23
		Testatof	mTestatof24
		Testatof	mTestatof25
		Testatof	mTestatof26
		Testatof	mTestatof27
		Testatof	mTestatof28
		Testatof	mTestatof29
		Testatof	mTestatof30
		Testatof	mTestatof31
		Testatof	mTestatof32
		Testatof	mTestatof33
		Testatof	mTestatof34
		Testatof	mTestatof35
		Testatof	mTestatof36
		Testatof	mTestatof37
		Testatof	mTestatof38
		Testatof	mTestatof39
		Testatof	mTestatof40
		Testatof	mTestatof41
		Testatof	mTestatof42
		Testatof	mTestatof43
		Testatof	mTestatof44
		Testatof	mTestatof45
		Testatof	mTestatof46
		Testatof	mTestatof47
		Testatof	mTestatof48
		Testatof	mTestatof49
		Testatof	mTestatof50
		Testatof	mTestatof51
		Testatof	mTestatof52
		putcr
		putcr
;
;
;
;---------
;
		print
		db	"Testing FTOI...",cr,lf,lf,0
;
		lefpal
		dt	1.0
		ftoi
		print
		db	"1.0 = ",0
		puti
;
		lefpal
		dt	10.0
		ftoi
		print
		db	cr,lf,"10.0 = ",0
		puti
;
		lefpal
		dt	100.0
		ftoi
		print
		db	cr,lf,"100.0 = ",0
		puti
;
		lefpal
		dt	1000.0
		ftoi
		print
		db	cr,lf,"1000.0 = ",0
		puti
;
		lefpal
		dt	10000.0
		ftoi
		print
		db	cr,lf,"10000.0 = ",0
		puti
;
		lefpal
		dt	32767.0
		ftoi
		print
		db	cr,lf,"32767.0 = ",0
		puti
;
		lefpal
		dt	0.0
		ftoi
		print
		db	cr,lf,"0.0 = ",0
		puti
;
		lefpal
		dt	-1.0
		ftoi
		print
		db	cr,lf,"-1.0 = ",0
		puti
;
		lefpal
		dt	-10.0
		ftoi
		print
		db	cr,lf,"-10.0 = ",0
		puti
;
		lefpal
		dt	-100.0
		ftoi
		print
		db	cr,lf,"-100.0 = ",0
		puti
;
		lefpal
		dt	-1000.0
		ftoi
		print
		db	cr,lf,"-1000.0 = ",0
		puti
;
		lefpal
		dt	-10000.0
		ftoi
		print
		db	cr,lf,"-10000.0 = ",0
		puti
;
		lefpal
		dt	-32768.0
		ftoi
		print
		db	cr,lf,"-32768.0 = ",0
		puti
;
;
;---------
;
		print
		db	cr,lf,lf,"Testing FTOU...",cr,lf,lf,0
;
		lefpal
		dt	1.0
		ftou
		print
		db	"1.0 = ",0
		putu
;
		lefpal
		dt	10.0
		ftou
		print
		db	cr,lf,"10.0 = ",0
		putu
;
		lefpal
		dt	100.0
		ftou
		print
		db	cr,lf,"100.0 = ",0
		putu
;
		lefpal
		dt	1000.0
		ftou
		print
		db	cr,lf,"1000.0 = ",0
		putu
;
		lefpal
		dt	10000.0
		ftou
		print
		db	cr,lf,"10000.0 = ",0
		putu
;
		lefpal
		dt	65535.0
		ftou
		print
		db	cr,lf,"65535.0 = ",0
		putu
;
		lefpal
		dt	0.0
		ftou
		print
		db	cr,lf,"0.0 = ",0
		putu
;
;
;---------
;
		print
		db	cr,lf,lf,"Testing FTOL...",cr,lf,lf,0
;
		lefpal
		dt	1.0
		ftol
		print
		db	"1.0 = ",0
		putl
		print
		db	"  ",0
		xchg	dx, ax
		putw
		xchg	dx, ax
		putw
;
		lefpal
		dt	10.0
		ftol
		print
		db	cr,lf,"10.0 = ",0
		putl
;
		lefpal
		dt	100.0
		ftol
		print
		db	cr,lf,"100.0 = ",0
		putl
;
		lefpal
		dt	1000.0
		ftol
		print
		db	cr,lf,"1000.0 = ",0
		putl
;
		lefpal
		dt	10000.0
		ftol
		print
		db	cr,lf,"10000.0 = ",0
		putl
;
		lefpal
		dt	32767.0
		ftol
		print
		db	cr,lf,"32767.0 = ",0
		putl
;
		lefpal
		dt	32768.0
		ftol
		print
		db	cr,lf,"32768.0 = ",0
		putl
;
		lefpal
		dt	65535.0
		ftol
		print
		db	cr,lf,"65535.0 = ",0
		putl
;
		lefpal
		dt	65536.0
		ftol
		print
		db	cr,lf,"65536.0 = ",0
		putl
;
		lefpal
		dt	100000.0
		ftol
		print
		db	cr,lf,"100000.0 = ",0
		putl
;
		lefpal
		dt	1000000.0
		ftol
		print
		db	cr,lf,"1000000.0 = ",0
		putl
;
		lefpal
		dt	2.0e9
		ftol
		print
		db	cr,lf,"2e9 = ",0
		putl
;
		lefpal
		dt	0.0
		ftol
		print
		db	cr,lf,"0.0 = ",0
		putl
;
		lefpal
		dt	-1.0
		ftol
		print
		db	cr,lf,"-1.0 = ",0
		putl
;
		lefpal
		dt	-10.0
		ftol
		print
		db	cr,lf,"-10.0 = ",0
		putl
;
		lefpal
		dt	-100.0
		ftol
		print
		db	cr,lf,"-100.0 = ",0
		putl
;
		lefpal
		dt	-1000.0
		ftol
		print
		db	cr,lf,"-1000.0 = ",0
		putl
;
		lefpal
		dt	-10000.0
		ftol
		print
		db	cr,lf,"-10000.0 = ",0
		putl
;
		lefpal
		dt	-32768.0
		ftol
		print
		db	cr,lf,"-32768.0 = ",0
		putl
;
;
;
;---------
;
		print
		db	cr,lf,lf,"Testing FTOUL...",cr,lf,lf,0
;
		lefpal
		dt	1.0
		ftoul
		print
		db	"1.0 = ",0
		putul
;
		lefpal
		dt	10.0
		ftoul
		print
		db	cr,lf,"10.0 = ",0
		putul
;
		lefpal
		dt	100.0
		ftoul
		print
		db	cr,lf,"100.0 = ",0
		putul
;
		lefpal
		dt	1000.0
		ftoul
		print
		db	cr,lf,"1000.0 = ",0
		putul
;
		lefpal
		dt	10000.0
		ftoul
		print
		db	cr,lf,"10000.0 = ",0
		putul
;
		lefpal
		dt	32767.0
		ftoul
		print
		db	cr,lf,"32767.0 = ",0
		putul
;
		lefpal
		dt	32768.0
		ftoul
		print
		db	cr,lf,"32768.0 = ",0
		putul
;
		lefpal
		dt	65535.0
		ftoul
		print
		db	cr,lf,"65535.0 = ",0
		putul
;
		lefpal
		dt	65536.0
		ftoul
		print
		db	cr,lf,"65536.0 = ",0
		putul
;
		lefpal
		dt	100000.0
		ftoul
		print
		db	cr,lf,"100000.0 = ",0
		putul
;
		lefpal
		dt	1000000.0
		ftoul
		print
		db	cr,lf,"1000000.0 = ",0
		putul
;
		mov	ax, 0ffffh
		mov	dx, 07fffh
		ultof
		ftoul
		print
		db	cr,lf,"2^31-1 = ",0
		putul
;
;
		mov	ax, 0ffffh
		mov	dx, ax
		ultof
		ftoul
		print
		db	cr,lf,"2^32-1 = ",0
		putul
;
		lefpal
		dt	0.0
		ftoul
		print
		db	cr,lf,"0.0 = ",0
		putul
;
;
;
;
;
;
;
;***************************************************************************
;
;
;
Quit:		mov     ah, 4ch
		int     21h
;
;
Main		endp
;
;
;
;
; Putfpacc- Prints the floating point accumulator:
;
Putfpacc	proc	near
		assume	ds:StdGrp
		push	ds
		push	ax
		mov	ax, StdGrp
		mov	ds, ax
		call	Putspace
		call	Putspace
		mov	al, StdGrp:fpacc
		puth
		call	Putspace
		mov	al, StdGrp:fpacc+1
		puth
		call	Putspace
		mov	al, StdGrp:fpacc+2
		puth
		call	Putspace
		mov	al, StdGrp:fpacc+3
		puth
		call	Putspace
		mov	al, StdGrp:fpacc+4
		puth
		call	Putspace
		mov	al, StdGrp:fpacc+5
		puth
		call	Putspace
		mov	al, StdGrp:fpacc+6
		puth
		call	Putspace
		mov	al, StdGrp:fpacc+7
		puth
		call	Putspace
		call	Putspace
		mov	al, StdGrp:fpacc+8
		puth
		call	Putspace
		mov	al, StdGrp:fpacc+9
		puth
		call	Putspace
		call	Putspace
		mov	al, StdGrp:fpacc+10
		puth
;
		pop	ax
		pop	ds
		ret
PutFpacc	endp
		assume	ds:dseg
;
PutSpace	proc	near
		push	ax
		mov	al, " "
		putc
		pop	ax
		ret
PutSpace	endp
;
cseg            ends
;
;
; Allocate a reasonable amount of space for the stack (2k).
;
sseg		segment	para stack 'stack'
stk		db	256 dup ("stack   ")
sseg		ends
;
;
;
; zzzzzzseg must be the last segment that gets loaded into memory!
;
zzzzzzseg	segment	para public 'zzzzzz'
LastBytes	db	16 dup (?)
heap		db	1024 dup (?)
zzzzzzseg	ends
		end	Main

⌨️ 快捷键说明

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