;		ブロック転送 
;		1991 3/8  Hiroshi TODA
;

	.386p

work	struc

select1	dd	?		; 転送元 セレクタ
addre1	dd	?		; 転送元 アドレス
select2	dd	?		; 転送先 セレクタ
addre2	dd	?		; 転送先 アドレス
count	dd	?		; BYTE

work	ends

cseg	segment	dword public use32 'CODE'
	assume	cs:cseg,ds:cseg

;int Transmit(int para[])
;para[0] = 転送元セレクタ
;para[1] = 転送元アドレス
;para[2] = 転送先セレクタ
;para[3] = 転送先アドレス
;para[4] = BYTE
;出力 = 常に0を返す

	public	transmit
	db	'transmit',8
transmit proc	near
	push	ebp
	mov	ebp,esp
	push	esi
	push	edi
	push	ebx
	push	es				; esを保存
	mov	edx,[ebp+8]			; edx = para のアドレス
	mov	eax,[edx].select1		; パラメータ受け渡し
	mov	fs,ax
	mov	esi,[edx].addre1
	mov	eax,[edx].select2
	mov	es,ax
	mov	edi,[edx].addre2
	cld
	mov	ecx,[edx].count
	shr	ecx,2
	rep	movs dword ptr [edi],fs:[esi]	; dword 転送
	mov	ecx,[edx].count
	and	ecx,03h
	rep	movs byte ptr [edi],fs:[esi]	; byte 転送
	xor	eax,eax				; 常に0を返す
	pop	es				; esを元に戻す
	pop	ebx
	pop	edi
	pop	esi
	mov	esp,ebp
	pop	ebp
	ret
transmit endp

cseg	ends
	end
