Re: DLLs & SYSTEM.PUT/GET

From: Dr. Lutz König <"Dr.>
Date: Fri, 18 Aug 2000 11:43:25 +0200


"Treutwein; Bernhard" wrote:

> >
> > 2. I try to read and write to an ADC-Card (Win95), which uses I/O 290H
> > to 297H. If I try to read and write these registers using SYSTEM.GET/PUT
> >
> > (290H, value), I always get a trap "nil dereference read". What am I
> > doing wrong?
> >

> the following might help (although it is a bit old), I fetched it from
> Guy Laden's site:
>
> Subject: Access to peripheral on a PC from Oberon/F
> Oberon Version: Oberon/F
> Underlying OS: Windows
> By: irbosch{([at]})nowhere.xy
>
> For those who have to work on a PC, here is a small module to read/write bytes
> to peripherals.
>
> WARNING : depending if you have to access the peripheral as a byte or a word,
> you should have to add 1 to the op-code. By example 0EDH instead of 0ECH for
> in ax,dx. Even after reading the assembly instruction documentation from Intel
> several time I do not understand the difference. If somebody can make this
> clear to me, I will appreciate.
>
> MODULE Periphio;
>
> IMPORT
> Out,
> SYSTEM;
>
> CONST
> AssemblyCode = 1;
>
> PROCEDURE [AssemblyCode] PortOutputByte*(
> Value : INTEGER;
> PortAddress : INTEGER
> )
> 05AH, (* pop dx *)
> 0EEH; (* out dx,ax *)
>
> PROCEDURE [AssemblyCode] PortInputByte*(
> PortAddress : INTEGER
> ) : INTEGER
> 08BH, 0D0H, (* mov dx,ax *)
> 0ECH; (* in ax,dx *)
>
> PROCEDURE Test*();
> VAR
> I : INTEGER;
> Val : INTEGER;
> BEGIN
> FOR I:=0 TO 10-1 DO
> (*
> PortOutputByte( I, 220H );
> Out.String( "Output" ); Out.Int( I, 4 ); Out.Ln();
> *)
>
> Val := PortInputByte( 220H );
> Out.String( "Input" ); Out.Int( Val, 4 ); Out.Ln();
>
> END;
> END Test;
>
> BEGIN (* Periophio *)
> END Periphio.
>
> Bernhard Treutwein Tel. 089/2180-2774
> Bernhard.Treutwein{([at]})nowhere.xy

Sehr geehrter Herr Treutwein,

vielen Dank für Ihren Tip. Es hat funktioniert.

Mit freundlichen Grüßen

Lutz König




Received on Fri Aug 18 2000 - 09:43:25 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:27:45 UTC