;
; wizio.s - Speed up block I/O transfers
;
	.module	wizio

; void wizio_out(const byte *p, word n, byte port)
_wizio_out::
	ld	iy,#0
	add	iy,sp
	ld	l,2(iy)
	ld	h,3(iy)
	ld	e,4(iy)
	ld	d,5(iy)
	ld	c,6(iy)
	inc	d
	dec	d
	jr	z,wo2
	ld	b,#0
wo1:	otir
	dec	d
	jr	nz,wo1
wo2:	inc	e
	dec	e
	ret	z
	ld	b,e
	otir
	ret

; void wizio_in(byte *p, word n, byte port)
_wizio_in::
	ld	iy,#0
	add	iy,sp
	ld	l,2(iy)
	ld	h,3(iy)
	ld	e,4(iy)
	ld	d,5(iy)
	ld	c,6(iy)
	inc	d
	dec	d
	jr	z,wi2
	ld	b,#0
wi1:	inir
	dec	d
	jr	nz,wi1
wi2:	inc	e
	dec	e
	ret	z
	ld	b,e
	inir
	ret
	
