;======================================================
;FILE AND.SRC
;WRITTEN 9-23-80     BY D.A. STEELE

;THIS ROUTINE WILL TAKE TWO NUMBERS PASSED TO IT AND DO A
;LOGICAL AND OF THEM.  TRUE WILL BE RETURNED IF THE RESULT
;IS NOT ZERO (I.E. IF THE TEST BIT WAS SET).  THIS WILL ALLOW THE 
;PROGRAMER TO CHECK FOR ONE BIT SET OR NOT.  IF THE TEST BIT IS
;NOT SET THEN FALSE IS RETURNED.
;
;CALL AS:
;   FUNCTION BITTEST( A,B: INTEGER ): BOOLEAN; EXTERNAL;

	NAME BITTEST
	ENTRY BITTEST

BITTEST:
	POP	H	;SAVE RETURN ADDRESS
	; GET THE PARAMETERS
	POP	D	;FIRST PARAM TO 'DE' REGS
	POP	B	;SECOND PARAM TO 'BC' REGS
	PUSH	H	;REPLACE THE RETURN ADDRESS ON THE STACK
	MOV	A,E
	ANA	C	;CHECK THE LOW BYTES
	jrnz	istrue
	MOV	A,B
	ANA	D	;CHECK THE HIGH BYTES
	jrnz	istrue
isfalse:
	; must return accum clear
	XRA	A	;ZERO A - RESET CARRY FLAG
	RET
istrue:
	XRA	A
	STC		;SET THE CARRY = TRUE
	RET
	;
	;
 must return accum clear
	XRA	A	;ZERO A - RESET CARRY FLAG
	RET
istrue:
	XRA	A
	STC		;S