;
; copy_sector(from,to)
; ULONG *from,*to;
;
; Copies 128 words (512 bytes) of memory
;
	XDEF	_copy_sector

_copy_sector:
	move.l	4(sp),a0
	move.l	8(sp),a1
	move.w	#128,d0
loop
	move.l	(a0)+,(a1)+
	subq.w	#1,d0
	bne 	loop
	rts

;
; Dummy segment list for subprocess
;
	XDEF	_proc_seg_list
	XREF	_subprocess

	cnop	0,4		; long word allign
	dc.l	16		; segment length - any number will do
_proc_seg_list
	dc.l	0		; next segment
	jmp		_subprocess

;
; Routines used by wd.c to read and write sectors.
;
	XDEF	_rdsec
	XDEF	_wrsec

_rdsec					; rdsec(buf,&WD->data,size)
	move.l	4(sp),a0	; buf
	move.l	8(sp),a1	; controller data register
	move.l	12(sp),d0	; bytes to transfer
rdsec2
	move.b (a1),(a0)+	; read byte into buffer
	subq.l #1,d0		; subtract 1
	bne rdsec2			; loop till all bytes read
	rts

_wrsec					; wrsec(buf,&WD->data,size)
	move.l	4(sp),a0	; buf
	move.l	8(sp),a1	; controller data register
	move.l	12(sp),d0	; bytes to transfer
wrsec2
	move.b (a0)+,(a1)	; write byte to controller
	subq.l #1,d0		; subtract 1
	bne wrsec2			; loop till all bytes written
	rts
