	.include "os9.d"
	.global	errno

	.text

	.global	readln
	; int readln(int,void *,int)
readln:
	pshs	y
	ldx	4,s
	ldy	6,s
	tfr	b,a
	os9	I$ReadLn
	bcs	erry
	tfr	y,d
	puls	y,pc


	.global	writeln
	; int writeln(int,void *,int)
writeln:
	pshs	y
	ldx	4,s
	ldy	6,s
	tfr	b,a
	os9	I$WritLn
	bcs	erry
	tfr	y,d
	puls	y,pc

erry:
	stb	<errno+1
	ldd	#-1
	puls	y,pc
