;			STATWILD.ASM
;		 by Keith Petersen, W8SDZ
;		      (revised 1/16/81)
;
;This patch fixes STAT.COM so it will not accept wild-cards.
;
;	CAUTION: THE PATCHES SHOWN HERE ARE VALID FOR
;	CP/M 2.2 STAT.COM ONLY.
;
BDOS	EQU	05H
FCB	EQU	5CH
CR	EQU	0DH
LF	EQU     0AH
;        
	ORG     0100H
;
	JMP	PATCH
;
	ORG	1502H	;VERSION 2.2 STAT
;
PATCH:	LXI	H,0
	DAD	SP	;GET OLD STACK
	SHLD	STACK	;SAVE IT
	LXI	SP,STACK ;SET NEW STACK
;
;First check to see if modem is active.
;If not, allow normal stat functions.
;
	LDA	3	;GET IOBYTE
	ANI	3	;ISOLATE CONSOLE BITS
	CPI	1	;SEE IF CON:=CRT:
	JZ	433H	;YES, GO BACK TO STAT
;
;Check for wild cards
	LXI	H,FCB+1	;POINT TO FCB
	MVI	B,11
;
LOOP:	MOV	A,M
	CPI	'?'
	JZ	ERROR
	INX	H
	DCR	B
	JNZ	LOOP
	JMP	433H	;GO BACK TO STAT
;
;Print error message, then return to CCP
;
ERROR:	LXI	D,MSG	;POINT TO STRING
	MVI	C,9 
	CALL	BDOS
	LHLD	STACK	;GET OLD STACK
	SPHL		;RESTORE IT
	RET		;RETURN TO CCP
;
MSG:	DB	'++CAN''T USE WILD CARD OPTIONS',CR,LF
	DB	'  USE SD FOR MULTIPLE FILES',CR,LF,'$'
;
;Temporary storage area
;
	DS	64	;ROOM FOR NEW STACK
STACK	DS	2	;OLD STACK SAVED HERE
;
	END
