;
; misc hand-coded things
;

	.globl	_abtchk
; no-op for now
_abtchk:
	rts

;
; bzero(ptr, nbytes)
;
	.globl	_bzero
_bzero:
	jsr	popax		; get nbytes
	sta	tmp1
	stx	tmp2
	jsr	popax		; get ptr
	sta	ptr1
	stx	ptr1+1
	lda	#0
bz1:
	ldx	tmp2		; get nbytes^
	beq	bz3		; zero, try lo
	ldy	#0
bz2:
	sta	(ptr1),y	; zap a byte
	iny
	bne	bz2
	inc	ptr1+1		; bump ptr^
	dec	tmp2		; dec nbytes^
	bne	bz1		; around again
bz3:
	ldy	tmp1
	beq	bz5
	ldy	#0
bz4:
	sta	(ptr1),y	; zap a byte
	iny
	cpy	tmp1		; done?
	bne	bz4
bz5:
	rts

;
; our own isalpha routine, cloned from the library one, accepts
; underbars too
;
	.globl	_is_alpha
_is_alpha:
	jsr	popax		; get the char
	cmp	#'_'		; underbar?
	beq	yup
	cmp	#'A'
	bcc	nope		; if less than 'A', return 0
	cmp	#'Z+1
	bcc	yup
	cmp	#'a
	bcc	nope
	cmp	#'z+1
	bcs	nope
yup:
	lda	#1
	rts
nope:
	lda	#0
	rts

