Python commands

Oren Tirosh oren-py-l at hishome.net
Thu Apr 3 10:43:46 EST 2003


On Thu, Apr 03, 2003 at 02:37:26PM +1000, Paul Dexter wrote:
>     Hi all,
>                 I have just discovered Python and I was wondering if anyone
> could help me find an equivalent command in Python for the "OUT" and "INP"
> commands in Qbasic. I wish to convert a Qbasic program to Python.
>     The following snippet is an example of the task I wish to perform;
> 
> base0 = &H378:
> 
> interface:
> OUT base0, &HA0
> OUT base0, &H80
> OUT base0 + 2, &H8
> 
> V = (INP(base0 + 1) AND &H10) * &H8
> 
>     The base address is 378 (lpt) and the "interface" subroutine outputs
> data to the port (378) and "V" is the input data statement I have used. I
> also use the "GETKEY", "LOCATE" and "DRAW" commands in Qbasic
> 
>     Does anyone know how to perform the same tasks/commands in Python or are
> they even available. I have come across other Basic computer language
> variations that do not support the commands I require.
> 
>     Thankyou for any help,

Direct access to I/O ports is usually reserved for device drivers. 

You can try WinIO from http://www.internals.com - it's a library that 
installs a driver to let you poke your hardware directly from user mode.
You can call this library from Python using calldll, ctypes, SWIG and 
similar tools.

    Oren





More information about the Python-list mailing list