;-------------------------------------------------------------------------
; This function gets data from a file into a buffer specified using
; a 16-bit far pointer.
;-------------------------------------------------------------------------

_TEXT	segment byte public 'CODE'
DGROUP	group	_DATA
	assume cs:_TEXT,ds:DGROUP,ss:DGROUP
_TEXT	ends

_DATA	segment word public 'DATA'
_DATA	ends

_TEXT	segment byte public 'CODE'

;-------------------------------------------------------------------------
;
; extern unsigned short far_read (unsigned char far *buf, unsigned short size,
;	int channel);
;

public	_far_read
_far_read	proc	near
	push	bp
	mov	bp,sp
	push	ds
	push	bx
	push	cx
	push	dx

	lds	dx,dword ptr [bp+4]	; unsigned char far *buf
	mov	cx,[bp+8]		; unsigned short size
	mov	bx,[bp+10]		; int channel
	mov	ax,3F00h		; READ FILE OR DEVICE
	int	21h			; call DOS

	pop	dx
	pop	cx
	pop	bx
	pop	ds
	pop	bp
	ret
_far_read	endp

;-------------------------------------------------------------------------
;
; extern unsigned short far_write (unsigned char far *buf, unsigned short size,
;	int channel);
;

public	_far_write
_far_write	proc	near
	push	bp
	mov	bp,sp
	push	ds
	push	bx
	push	cx
	push	dx

	lds	dx,dword ptr [bp+4]	; unsigned char far *buf
	mov	cx,[bp+8]		; unsigned short size
	mov	bx,[bp+10]		; int channel
	mov	ax,4000h		; WRITE FILE OR DEVICE
	int	21h			; call DOS

	pop	dx
	pop	cx
	pop	bx
	pop	ds
	pop	bp
	ret
_far_write	endp

;-------------------------------------------------------------------------

_TEXT	ends
	end
