;********************************************************************
;
;	Title: typeit.com
;     Version: 1.0
;	 Date: 3 February 1985
;      Author: Charles "Zeke" Miller
;	       Z-Lab Soft Systems 
;
;	This Program is released to the Public Domain for
;	non-commercial use. Commercial use of this program
;	is expressly undesired. Copy it, use it, give it to
;	a friend but please do not sell it.
;
;
;	Revisions:
;
;
;
;	Program Description:
;
;	This program is an assembly version of the 
;	following BASIC program.
;
;	10 PRINT "TYPE LINES AT YOUR CONSOLE. THEY"
;	20 PRINT "WILL BE PRINTED  (ON YOUR PRINTER)"
;	30 PRINT "WHEN YOU HIT RETURN. TYPE A PERIOD"
;	40 PRINT "AT THE BEGINNING OF A LINE TO STOP."
;	50 LINE INPUT "";L$
;	60 IF LEFT$(L$,1)="." THEN 100
;	70 LPRINT L$
;	80 GOTO 60
;	90 END
;
;
;********************************************************************
;
rcbf	equ	0ah	;input one character from keyboard
wcbfc	equ	09h	;
write	equ	5	;write to a device
wccfc	equ	02	;
exit	equ	0	;warm boot
cr	equ	0dh	;carraige return
lf	equ	0ah	;line feed
clrs	equ	01ah	;Osborne/Kaypro clear screen
bdos	equ	05h	;bdos entry point
bufflen equ	80 	;
;
;
	org	0100h	;beginning of TPA
;
begin:	jmp 	start
;
signon:	db	clrs,'Typeit v1.0 Z-lab Soft Systems',cr,lf
	db	'Type lines at your console. They will',cr,lf
	db	'be printed (on your printer) when you',cr,lf
	db	'hit return. Type a period at the beginning',cr,lf
	db	'of a line to stop.',cr,lf,lf 
	db	'|        1         2         3         4'
	db	'         5         6         7         8',cr,lf
	db	'1234567890123456789012345678901234567890'
	db	'1234567890123456789012345678901234567890'
	db	cr,lf,lf,'$'
;
start:	lxi	d,signon
	call	wasc

;
;
loop:	call	weoll
	lxi	d,buffer	;point to buffer
input:	mvi	c,rcbf		;.and read console
	call	bdos		;..input into it
print:	lxi 	d,fbuffc	;point to first char
	ldax	d		;.in buffer and
	cpi	'.'		;..see if it is a '.'
	jz	done		;...if it is then quit
 	lxi	h,buffcc
 	mov  	e,m   
 	mvi	d,0
 	inx	h
 	dad	d
 	mov	m,0

	lxi	h,fbuffc
wasl:	mov	a,m
	ora	a
	jz	loop
	call	wacl
	inx	h
	jmp	wasl
;
;
weoll:	mvi	a,cr
	call	wacl
	call	wacc
	mvi	a,lf
	call	wacc
	call	wacl
	ret
;
;
wacl:	push	h
	push	d
	push	b
	push	psw
	mvi	c,write
	mov	e,a
	call	bdos
	pop	psw
	pop	b
	pop	d
	pop	h
	ret
;
;
wasc:	push	h
	push	d
	push	b
	push	psw
	mvi	c,wcbfc
	call	bdos
	pop	psw
	pop	b
	pop	d
	pop	h
	ret
;
;
wacc:	push	h
	push	d
	push	b
	push	psw
	mov	e,a
	mvi	c,wccfc
	call	bdos
	pop	psw
	pop	b
	pop	d
	pop	h
	ret
;
done:	jmp	exit
;
;
buffer:	db	bufflen		;
buffcc:	db	0		;returned number of char
fbuffc:	ds	bufflen		;first buffer character
	db	0
;
	end
