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

📄 testpat.asm

📁 ART OF Assembly Language Programming, 很不错
💻 ASM
📖 第 1 页 / 共 2 页
字号:

		ldxi	HAAadp
		lesi	HaaStr1
		xor	cx, cx
		match
		jnc	HAADidntWork4
		print
		db	"AlphaDigitsPat properly matched HaaStr1",cr,lf
		db	"Starting address:  ",0
		lea	ax, HaaStr1
		putw
		printf
		db	cr,lf
		db	"ARB component:          %4x %4x\n"
		db	"AlphaDigits component:  %4x %4x\n"
		db	"                 %s\n",0
		dd	HAAadp.StartPattern,  HAAadp.EndPattern
		dd	AlphaDigitsPat.StartPattern
		dd	AlphaDigitsPat.EndPattern
		dd	HaaStr1


		lea	si, HaaStr1
		print
		db	"ARB:             ",0
		lesi	HAAadp
		call	PutPat

		print
		db	"AlphaDigitsPat:  ",0
		lesi	AlphaDigitsPat
		call	PutPat

		jmp	Test6Done

HAADidntWork4:	print
		db	"HAAagain failed to match HaaStr1",cr,lf,0

Test6Done:


		print
		db	cr,lf,lf
		db	"Testing the pattern 'ARB [a-zA-Z]+ [0-9]+' "
		db	"using ParenPat pattern"
		db	cr,lf,lf,0


		ldxi	ParenPat
		lesi	HaaStr1
		xor	cx, cx
		match
		jnc	HAADidntWork5
		print
		db	"ParenPat properly matched HaaStr1",cr,lf
		db	"Starting address:  ",0
		lea	ax, HaaStr1
		putw
		printf
		db	cr,lf
		db	"ARB component:       %4x %4x\n"
		db	"ParenPat component:  %4x %4x\n"
		db	"HAA2 component:      %4x %4x\n"
		db	"HAA3 component:      %4x %4x\n"
		db	"           %s\n",0
		dd	ParenPat.StartPattern,  ParenPat.EndPattern
		dd	HAAparen.StartPattern,  HAAparen.EndPattern
		dd	HAA2.StartPattern, HAA2.EndPattern
		dd	HAA3.StartPattern, HAA3.EndPattern
		dd	HaaStr1


		lea	si, HaaStr1
		print
		db	"ARB:       ",0
		lesi	ParenPat
		call	PutPat

		print
		db	"ParenPat:  ",0
		lesi	HAAParen
		call	PutPat

		print
		db	"HAA2:      ",0
		lesi	HAA2
		call	PutPat

		print
		db	"HAA3:      ",0
		lesi	HAA3
		call	PutPat
		jmp	Test7Done

HAADidntWork5:	print
		db	"HAAagain failed to match HaaStr1",cr,lf,0

Test7Done:

		print
		db	cr,lf
		db	"Testing MatchToString:",cr,lf,lf,0

		ldxi	MTStest
		lesi	MainString
		xor	cx, cx
		Match
		jnc	MTSFailed
		printf
		db	"MatchToString worked",cr,lf
		db	"Character range: %4x %4x",cr,lf,lf
		db	"               %s",cr,lf,0
		dd	MTStest.StartPattern, MTStest.EndPattern
		dd	MainString

		lea	si, MainString
		print
		db	"MatchToString: ",0
		lesi	MTStest
		call	PutPat
		jmp	Test8Done

MTSFailed:	print
		db	"MatchToString did not work",cr,lf,0

Test8Done:

		print
		db	cr,lf
		db	"Testing Spancset:",cr,lf,lf,0

		ldxi	SCtest
		lesi	SCtestStr
		xor	cx, cx
		Match
		jnc	SCFailed
		printf
		db	"Spancset worked",cr,lf
		db	"Character range: %4x %4x",cr,lf,lf
		db	"          %s",cr,lf,0
		dd	SCtest.StartPattern, SCtest.EndPattern
		dd      SCtestStr

		lea	si,  SCTestStr
		print
		db	"Spancset: ",0
		lesi	SCtest
		call	PutPat
		jmp	Test9Done

SCFailed:	print
		db	"Spancset did not work",cr,lf,0

Test9Done:

		print
		db	cr,lf
		db	"Testing Brkcset:",cr,lf,lf,0

		ldxi	BCtest
		lesi	SCtestStr
		xor	cx, cx
		Match
		jnc	BCFailed
		printf
		db	"Brkcset worked",cr,lf
		db	"Character range: %4x %4x",cr,lf,lf
		db	"         %s",cr,lf,0
		dd	BCtest.StartPattern, BCtest.EndPattern
		dd      SCtestStr

		lea	si,  SCTestStr
		print
		db	"Brkcset: ",0
		lesi	BCtest
		call	PutPat
		jmp	Test10Done

BCFailed:	print
		db	"Brkcset did not work",cr,lf,0

Test10Done:

		print
		db	cr,lf
		db	"Testing MatchStr:",cr,lf,lf,0

		ldxi	MStest
		lesi	SCtestStr
		xor	cx, cx
		Match
		jnc	MSFailed
		printf
		db	"MatchString worked",cr,lf
		db	"Character range: %4x %4x",cr,lf,lf
		db	"          %s",cr,lf,0
		dd	MStest.StartPattern, MStest.EndPattern
		dd      SCtestStr

		lea	si,  SCTestStr
		print
		db	"MatchStr: ",0
		lesi	MStest
		call	PutPat
		jmp	Test11Done

MSFailed:	print
		db	"MatchStr did not work",cr,lf,0

Test11Done:


		print
		db	cr,lf
		db	"Testing MatchChar:",cr,lf,lf,0

		ldxi	MCtest
		lesi	SCtestStr
		xor	cx, cx
		Match
		jnc	MCFailed
		printf
		db	"MatchChar worked",cr,lf
		db	"Character range: %4x %4x",cr,lf,lf
		db	"           %s",cr,lf,0
		dd	MCtest.StartPattern, MCtest.EndPattern
		dd      SCtestStr

		lea	si,  SCTestStr
		print
		db	"MatchChar: ",0
		lesi	MCtest
		call	PutPat
		jmp	Test12Done

MCFailed:	print
		db	"MatchChar did not work",cr,lf,0

Test12Done:


		print
		db	cr,lf
		db	"Testing Anycset:",cr,lf,lf,0

		ldxi	ACtest
		lesi	SCtestStr
		xor	cx, cx
		Match
		jnc	ACFailed
		printf
		db	"Anycset worked",cr,lf
		db	"Character range: %4x %4x",cr,lf,lf
		db	"         %s",cr,lf,0
		dd	ACtest.StartPattern, ACtest.EndPattern
		dd      SCtestStr

		lea	si,  SCTestStr
		print
		db	"Anycset: ",0
		lesi	ACtest
		call	PutPat
		jmp	Test13Done

ACFailed:	print
		db	"Anycset did not work",cr,lf,0

Test13Done:

		print
		db	cr,lf
		db	"Testing NotAnycset:",cr,lf,lf,0

		ldxi	NACtest
		lesi	NACStr
		xor	cx, cx
		Match
		jnc	NACFailed
		printf
		db	"NotAnycset worked",cr,lf
		db	"Character range: %4x %4x",cr,lf,lf
		db	"               %s",cr,lf,0
		dd	NACtest.StartPattern, NACtest.EndPattern
		dd      NACStr

		lea	si,  NACStr
		print
		db	"NotAnycset:    ",0
		lesi	NACtest
		call	PutPat
		jmp	Test14Done

NACFailed:	print
		db	"NotAnycset did not work",cr,lf,0

Test14Done:



		print
		db	cr,lf
		db	"Testing ARB/EOS:",cr,lf,lf,0

		ldxi	EOStest
		lesi	SCtestStr
		xor	cx, cx
		Match
		jnc	EOSFailed
		printf
		db	"EOS/ARB worked",cr,lf
		db	"ARB range:    %4x %4x",cr,lf
		db	"EOS position: %4x %4x",cr,lf,lf
		db	"       %s",cr,lf,0
		dd	EOStest.StartPattern, EOStest.EndPattern
		dd	EOStest2.StartPattern, EOStest2.EndPattern
		dd      SCtestStr

		lea	si,  SCtestStr
		print
		db	"ARB:   ",0
		lesi	EOStest
		call	PutPat

		print
		db	"EOS:   ",0
		lesi	EOStest2
		call	PutPat
		jmp	Test15Done

EOSFailed:	print
		db	"EOS/ARB did not work",cr,lf,0

Test15Done:



		print
		db	cr,lf
		db	"Testing Skip:",cr,lf,lf,0

		ldxi	SKIPtest
		lesi	SCtestStr
		xor	cx, cx
		Match
		jnc	SkipFailed
		printf
		db	"Skip worked",cr,lf
		db	"Character range: %4x %4x",cr,lf,lf
		db	"       %s",cr,lf,0
		dd	Skiptest.StartPattern, Skiptest.EndPattern
		dd      SCtestStr

		lea	si,  SCtestStr
		print
		db	"Skip:  ",0
		lesi	SkipTest
		call	PutPat
		jmp	Test16Done

SkipFailed:	print
		db	"Skip did not work",cr,lf,0

Test16Done:



		print
		db	cr,lf
		db	"Testing ARB/POS:",cr,lf,lf,0

		ldxi	POStest
		lesi	SCtestStr
		xor	cx, cx
		Match
		jnc	POSFailed
		printf
		db	"POS/ARB worked",cr,lf
		db	"ARB range:    %4x %4x",cr,lf
		db	"POS position: %4x %4x",cr,lf,lf
		db	"       %s",cr,lf,0
		dd	POStest.StartPattern, POStest.EndPattern
		dd	POStest2.StartPattern, POStest2.EndPattern
		dd      SCtestStr

		lea	si,  SCtestStr
		print
		db	"ARB:   ",0
		lesi	POStest
		call	PutPat

		print
		db	"POS:   ",0
		lesi	POStest2
		call	PutPat
		jmp	Test17Done

POSFailed:	print
		db	"POS/ARB did not work",cr,lf,0

Test17Done:



		print
		db	cr,lf
		db	"Testing ARB/RPOS:",cr,lf,lf,0

		ldxi	RPOStest
		lesi	SCtestStr
		xor	cx, cx
		Match
		jnc	RPOSFailed
		printf
		db	"RPOS/ARB worked",cr,lf
		db	"ARB range:    %4x %4x",cr,lf
		db	"RPOS position: %4x %4x",cr,lf,lf
		db	"       %s",cr,lf,0
		dd	RPOStest.StartPattern, RPOStest.EndPattern
		dd	RPOStest2.StartPattern, RPOStest2.EndPattern
		dd      SCtestStr

		lea	si,  SCtestStr
		print
		db	"ARB:   ",0
		lesi	RPOStest
		call	PutPat

		print
		db	"RPOS:  ",0
		lesi	RPOStest2
		call	PutPat
		jmp	Test18Done

RPOSFailed:	print
		db	"RPOS/ARB did not work",cr,lf,0

Test18Done:



		print
		db	cr,lf
		db	"Testing GOTOpos:",cr,lf,lf,0

		ldxi	GOTOposTest
		lesi	SCtestStr
		xor	cx, cx
		Match
		jnc	GOTOFailed
		printf
		db	"GOTOpos worked",cr,lf
		db	"Character range: %4x %4x",cr,lf,lf
		db	"          %s",cr,lf,0
		dd	GOTOposTest.StartPattern, GOTOposTest.EndPattern
		dd      SCtestStr

		lea	si,  SCtestStr
		print
		db	"GOTOpos:  ",0
		lesi	SkipTest
		call	PutPat
		jmp	Test19Done

GOTOFailed:	print
		db	"GOTOpos did not work",cr,lf,0

Test19Done:



		print
		db	cr,lf
		db	"Testing RGOTOpos:",cr,lf,lf,0

		ldxi	RGOTOposTest
		lesi	SCtestStr
		xor	cx, cx
		Match
		jnc	RGOTOFailed
		printf
		db	"RGOTOpos worked",cr,lf
		db	"Character range: %4x %4x",cr,lf,lf
		db	"           %s",cr,lf,0
		dd	RGOTOposTest.StartPattern, RGOTOposTest.EndPattern
		dd      SCtestStr

		lea	si,  SCtestStr
		print
		db	"RGOTOpos:  ",0
		lesi	RGOTOposTest
		call	PutPat
		jmp	Test20Done

RGOTOFailed:	print
		db	"RGOTOpos did not work",cr,lf,0

Test20Done:



		print
		db	cr,lf
		db	"Testing MatchToChar:",cr,lf,lf,0

		ldxi	Match2Chtest
		lesi	SCtestStr
		xor	cx, cx
		Match
		jnc	MTCFailed
		printf
		db	"MatchToChar worked",cr,lf
		db	"Character range: %4x %4x",cr,lf,lf
		db	"             %s",cr,lf,0
		dd	Match2ChTest.StartPattern, Match2ChTest.EndPattern
		dd      SCtestStr

		lea	si,  SCtestStr
		print
		db	"MatchToChar: ",0
		lesi	Match2ChTest
		call	PutPat
		jmp	Test21Done

MTCFailed:	print
		db	"MatchToChar did not work",cr,lf,0

Test21Done:



		print
		db	cr,lf
		db	"Testing MatchToPat:",cr,lf,lf,0

		ldxi	Match2Ptest
		lesi	SCtestStr
		xor	cx, cx
		Match
		jnc	MTPFailed
		printf
		db	"MatchToPat worked",cr,lf
		db	"Character range: %4x %4x",cr,lf
		db	"Pattern range: %4x %4x",cr,lf,lf
		db	"             %s",cr,lf,0
		dd	Match2PTest.StartPattern, Match2PTest.EndPattern
		dd	Match2PTest2.StartPattern, Match2PTest2.EndPattern
		dd      SCtestStr

		lea	si,  SCtestStr
		print
		db	"MatchToPat:  ",0
		lesi	Match2PTest
		call	PutPat

		print
		db	"MatchToPat2: ",0
		lesi	Match2PTest2
		call	PutPat
		jmp	Test22Done

MTPFailed:	print
		db	"MatchToPat did not work",cr,lf,0

Test22Done:



		print
		db	cr,lf
		db	"Testing ARBNUM:",cr,lf,lf,0

		ldxi	ArbNumtest
		lesi	SCtestStr
		xor	cx, cx
		Match
		jnc	ARBNumFailed
		printf
		db	"ARBNUM worked",cr,lf
		db	"Character range: %4x %4x",cr,lf
		db	"Pattern range: %4x %4x",cr,lf,lf
		db	"           %s",cr,lf,0
		dd	ArbNumTest.StartPattern, ArbNumTest.EndPattern
		dd	ArbNumTest2.StartPattern, ArbNumTest2.EndPattern
		dd      SCtestStr

		lea	si,  SCtestStr
		print
		db	"MatchStr:  ",0
		lesi	ArbNumTest
		call	PutPat

		print
		db	"ARBNUM:    ",0
		lesi	ArbNumTest2
		call	PutPat
		jmp	Test23Done

ArbNumFailed:	print
		db	"ARBNUM did not work",cr,lf,0

Test23Done:





Quit:		mov     ah, 4ch
		int     21h
Main		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 + -