	include	dos.inc

LineLen	=	132

	.model	small
	.code
	.data

	public	LineBuf

DosLineBuf	db	LineLen,0
LineBuf		db	LineLen dup(0)

DGroup	group	_TEXT,_DATA

	.code

	public	InBuf, OutCh, InCh, CrLf

InCh:
	DOS	InCharNoEcho
	ret

;Get input line

InBuf:
	mov	dx,offset DGroup:DosLineBuf	;Input buffer
	DOS	InputLine		;Get input line from console

;Convert unquoted input to upper case
	mov	si,offset DGroup:LineBuf
	mov	di,si
CaseChk:
	lodsb
	cmp	al,"a"
	jb	NoConv
	cmp	al,"z"
	ja	NoConv
	sub	al,"a"-"A"		;Convert to upper case
NoConv:
	stosb				;Put it back where we got it
	cmp	al,13			;End of line?
	jz	InDone
	cmp	al,'"'
	jz	QuotScan
	cmp	al,"'"
	jnz	CaseChk
QuotScan:
	mov	ah,al			;Remember which quote mark
KillStr:
	lodsb
	stosb
	cmp	al,13
	jz	InDone
	cmp	al,ah
	jnz	KillStr
	jmp	CaseChk

InDone:
	mov	si,offset DGroup:LineBuf	;Set up SI for command processing

;Output CR/LF sequence

CrLf:
	mov	al,13
	call	OutCh
	mov	al,10

;Console output of character in AL

OutCh:
	push	ax		;Character to output on stack
	push	dx
	and	al,7FH
	mov	dl,al
	DOS	OutChar
	pop	dx
	pop	ax
	ret

end
