Source file: /~heha/basteln/PC/oszi/oszi.zip/unused/inout.c

#include "inout.h"
#ifdef __BORLANDC__
# pragma warn -asc 
#endif
UINT PortBase=0x2C0;
#ifdef WIN32
void _CDECL access3(LPBYTE buf, UINT buflen, UINT start) {
// Versuch, Adressen-Zugriffe zu minimieren, kompatibel zu SCOPE1.DLL
 _asm{	mov	edi,[buf]
	mov	ecx,[buflen]
	mov	edx,[PortBase]
	jecxz	e
	cld
	add	edx,2
	mov	eax,[start]
 }b16: _asm{
	out	dx,ax	//Adresse komplett ausgeben
	jmp	i
 }l: _asm{
	or	al,al
	jz	b16	//gelegentlicher Aussprung!
	out	dx,al
 }i: _asm{
	insw		//Datenwort einlesen nach ES:EDI
	inc	eax
	loop	l
 }e:;
}

void _CDECL outb(UINT ofs, BYTE b) {
 _asm{	mov	edx,[PortBase]
	add	edx,[ofs]
	mov	al,[b]
	out	dx,al
 }
}

void _CDECL outw(UINT ofs, WORD w) {
 _asm{	mov	edx,[PortBase]
	add	edx,[ofs]
	mov	ax,[w]
	out	dx,ax
 }
}
#ifdef __BORLANDC__
#pragma warn -rvl
#else
#endif
BYTE _CDECL inb(UINT ofs) {
 _asm{	mov	edx,[PortBase]
	add	edx,[ofs]
	in	al,dx
 }
}

WORD _CDECL inw(UINT ofs) {
 _asm{	mov	edx,[PortBase]
	add	edx,[ofs]
	in	ax,dx
 }
}

#else
void _CDECL access3(LPBYTE buf, UINT buflen, UINT start) {
// Versuch, Adressen-Zugriffe zu minimieren, kompatibel zu SCOPE1.DLL
 _asm{	les	di,[buf]
	mov	cx,[buflen]
	mov	dx,[PortBase]
	jcxz	e
	cld
	add	dx,2
	mov	ax,[start]
 }b16: _asm{
	out	dx,ax	//Adresse komplett ausgeben
	jmp	i
 }l: _asm{
	or	al,al
	jz	b16	//gelegentlicher Aussprung!
	out	dx,al
 }i: _asm{
	insw		//Datenwort einlesen nach ES:EDI
	inc	ax
	loop	l
 }e:;
}

void _CDECL outb(UINT ofs, BYTE b) {
 asm{	mov	dx,[PortBase]
	add	dx,[ofs]
	mov	al,[b]
	out	dx,al
 }
}

void _CDECL outw(UINT ofs, WORD w) {
 asm{	mov	dx,[PortBase]
	add	dx,[ofs]
	mov	ax,[w]
	out	dx,ax
 }
}

BYTE _CDECL inb(UINT ofs) {
 _asm{	mov	dx,[PortBase]
	add	dx,[ofs]
	in	al,dx
 }
 return _AL;
}

WORD _CDECL inw(UINT ofs) {
 _asm{	mov	dx,[PortBase]
	add	dx,[ofs]
	in	ax,dx
 }
 return _AX;
}
#endif
Detected encoding: ASCII (7 bit)2