RE: Direct i/o with blackbox?

From: Hof, Philipp <"Hof,>
Date: Tue, 21 Sep 2004 17:16:26 +1200

----boundary-LibPST-iamunique-215906961_-_-
Content-type: text/plain

Hi René,

Thanks a lot. Works fine!
And I learned something too:)

Cheers, Philipp

-----Original Message-----
From: René Dorta [mailto:rene{([at]})nowhere.xy
Sent: Wednesday, 8 September 2004 5:02 p.m.
To: Hof, Philipp
Subject: Re: Direct i/o with blackbox?

Here is a simple version I was using long time ago:

MODULE Puertos; (* Do NOT name "Ports" this module! *)
IMPORT SYSTEM;

CONST (** to be changed according the configuration of your computer *)
    COM1* = 03F8H;
    COM3* = 03E8H;
    PRN* = 0378H;
   
PROCEDURE [code] In* (port: SHORTINT): BYTE (* read a BYTE from "port" *)
    08BH, 0D0H (* MOV DX, AX *),
    0ECH (* IN AL, DX *);
   
PROCEDURE [code] Out* (port: SHORTINT; c: BYTE) (* write BYTE "c" into
"port" *)
    08BH, 0D0H (* MOV DX, AX *),
    058H (* POP AX *),
    0EEH (* OUT AL, DX *);
   
END Puertos.

Greetings, René Dorta.

Hof, Philipp wrote:

>Hello all,
>
>Has anyone implemented a module that allows direct i/o?
>
>Something equivalent to the
>SYSTEM.PORTIN
>SYSTEM.PORTOUT
>functions in Oberon System 3
>
>or equivalent to the following Pascal code snippets:
>
>procedure outportb(portid : integer; value : BYTE);
>Begin
> asm
> mov edx,portid
> mov al,value
> out dx,al
> end;
>end;
>
>function inportb(portid : integer) : byte;
>Var value : byte;
>Begin
> asm
> mov edx,portid
> in al,dx
> mov value,al
> end;
> inportb := value;
>end;
>
>
>Thanks, Philipp
>--------------------------------------------
>
>To unsubscribe from this mailing list, send a message containing the word
"unsubscribe" to:
> blackbox-request{([at]})nowhere.xy
>
>To get a list of valid e-mail commands and instructions on their usage,
send a message containing the word "help" to the above address.
>
>Send any problem reports or questions related to this email list to the
list owner at
> owner-blackbox{([at]})nowhere.xy
>
>Current posting policy:
>
>a) To post you should use the same address by which you are subscribed to
the mailing list. That way, the list server will recognize you as subscriber
and forward your posting immediately, without creating any overhead.
>
>b) If, for some reason, you cannot post from the address, by which you are
subscribed, your message will be moderated to avoid spam. Please understand
that moderation will often cause some delay, in particular over weekends or
holydays.
>
>
>
>

--------------------------------------------

To unsubscribe from this mailing list, send a message containing the word "unsubscribe" to:
   blackbox-request{([at]})nowhere.xy

To get a list of valid e-mail commands and instructions on their usage, send a message containing the word "help" to the above address.

Send any problem reports or questions related to this email list to the list owner at
   owner-blackbox{([at]})nowhere.xy

Current posting policy:

a) To post you should use the same address by which you are subscribed to the mailing list. That way, the list server will recognize you as subscriber and forward your posting immediately, without creating any overhead.

b) If, for some reason, you cannot post from the address, by which you are subscribed, your message will be moderated to avoid spam. Please understand that moderation will often cause some delay, in particular over weekends or holydays.


----boundary-LibPST-iamunique-215906961_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"

e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzc1xmY2hhcnNldDAgQXJpYWw7fQ0Ke1xmMVxmbW9kZXJuIENvdXJpZXIgTmV3O30NCntcZjJc
Zm5pbFxmY2hhcnNldDIgU3ltYm9sO30NCntcZjNcZm1vZGVyblxmY2hhcnNldDAgQ291cmllciBO
ZXc7fX0NCntcY29sb3J0YmxccmVkMFxncmVlbjBcYmx1ZTA7XHJlZDBcZ3JlZW4wXGJsdWUyNTU7
fQ0KXHVjMVxwYXJkXHBsYWluXGRlZnRhYjM2MCBcZjBcZnMyMCBIaSBSZW5cJ2U5LFxwYXINClxw
YXINClRoYW5rcyBhIGxvdC4gV29ya3MgZmluZSFccGFyDQpBbmQgSSBsZWFybmVkIHNvbWV0aGlu
ZyB0b286KVxwYXINClxwYXINCkNoZWVycywgUGhpbGlwcFxwYXINClxwYXINCi0tLS0tT3JpZ2lu
YWwgTWVzc2FnZS0tLS0tXHBhcg0KRnJvbTogUmVuXCdlOSBE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