[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Perl



Tom,

Gary's method is pretty much the way it is done.  It's best to
build big programs out of layers of littler programs.  Write a
very simple program that only gives access to your hardware,
Write another one that calls the first but makes the interface
"cleaner" or at a higher level.  Write another that provides
a nice user interface, Writing a set of simple programs is easier
than writing one big one and when you are done the result is
more usfull.  Perl is not
at it's best when used at the bottom of these layers.

For example, Someone could write a small program called 
"Check_Mk_IV_Ready_Bit" in about 8 lines of "C".  You could
call it from a Perl program or directly from the command line.

If you want to access hardware in a UNIX environment you should
be thinking about a device driver. Once you have a driver for the
device you can access it any way you want.  The driver's job is to
make the device "look" like a normal disk file.  So anything (like
Perl) that can get at disk files can get at the device.  

There are a few special cases
where a "user level driver" might work.  Say for a device where
timing is not critical and it is so specialized that only one
program could ever need access to it.  The Mk IV RAM card is a
good example of this.  To do this you just make a system call that
in effect says "give me I/O Port #300.  Next you do what you 
want with it.  But you need a language that has I/O port
instructions.  Just one small routine in "C" would be enough.
You would then call it from Perl, Tcl or whatever.

In the UNIX world, You will find "C" is the foundation layer.
That's what the OS is written in.

Don't forget QBASIC.  I know first hand your QBASIC code runs on
a Linux box.  In many ways it runs better under Linux then it
does in DOS because Linux will multi-task and do networking while
also running the BASIC program.  Also when the DOS program crashes
inside dosemu it does not take Linux down with it - you save a lot
of re-boots.  Linux's "DOS Box" is called "dosemu" or "xdosemu" and
works well.  

Dosemu does the "give me port xxx" system call for you based on
a config file where you tell dosemu what you want.  So when you
are in DOS you have access to not the whole PC but just the parts
of it you asked for in the config file.

If you are going to use Perl.  Get to know this web site
  http://www.cpan.org/
One of Perl's fest features is that there are thousands of
"Perl Modulls" that do just about anything.  




--- "Gary W. Billings" <obs681@telusplanet.net> wrote:
> >Can I get directly at the hardware under perl?  The thing I still
> like 
> >about QBasic is that I can do operations on the ISA bus.  I can also
> read 
> 
> >and write to the serial port.  As a hardware guy, these are things
> that I 
> 
> >like to do.  So can I get to the PCI, ISA, and the serial ports
> under 
> >perl?  I am quite willing to assign them permanently to one user.
> >
> >Tom Droege
> 
> I'm not sure, and don't have my reference materials available.  I
> think the
> answer is "no".  
> 
> However, I was looking at a similar problem a little while ago, and
> the route
> that I planned to take (but didn't proceed) was to write
> daemon/drivers in C,
> that *could* talk to hardware, and have them communicate with a
> user-friendly
> GUI interface (written using perl/Tk) via sockets (perl has all the
> infrastructure
> for this).  This gave the added advantage that the driver and the GUI
> do not
> have to be on the same machine, or run on the same OS.  For me, this
> was attractive
> as I was going to use a lightly-loaded low-end machine to talk to
> hardware,
> and put the GUI and image / data manipulation on another workstation.
> 
> 
> Gary Billings
> 


=====
Chris Albertson 
  Home:   310-376-1029  chrisalbertson90278@yahoo.com
  Cell:   310-990-7550
  Office: 310-336-5189  Christopher.J.Albertson@aero.org

__________________________________________________
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/