to make soft interrupt with AX registers in linux? - Linux

This is a discussion on to make soft interrupt with AX registers in linux? - Linux ; Hi. I'd like to know to send to printer port, I did like this on DOS... I used to use int86 () function to make soft interrupt... I'd like to know how to make soft interrupt with AX registers in ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: to make soft interrupt with AX registers in linux?

  1. to make soft interrupt with AX registers in linux?

    Hi.

    I'd like to know to send to printer port, I did like this on DOS...
    I used to use int86 () function to make soft interrupt...

    I'd like to know how to make soft interrupt with AX registers in linux?

    But this kind of using is it possible in linux ?


    sendcharToPrinter ( char ch )
    {
    union REGS printer;

    printer.h.ah = 0;
    printer.h.al = ch;
    printer.x.dx = 0x378
    int86( 0x17, &printer, &printer );
    }

    Thanks..



  2. Re: to make soft interrupt with AX registers in linux?

    "google-rambo88" wrote:
    >
    > I'd like to know to send to printer port, I did like this on DOS...
    > I used to use int86 () function to make soft interrupt...
    >
    > I'd like to know how to make soft interrupt with AX registers in linux?
    >
    > But this kind of using is it possible in linux ?


    Not that way. Software interrupts are only available in 16-bit code.
    However:

    > sendcharToPrinter ( char ch )
    > {
    > union REGS printer;
    >
    > printer.h.ah = 0;
    > printer.h.al = ch;
    > printer.x.dx = 0x378
    > int86( 0x17, &printer, &printer );
    > }


    What you're doing here is writing one byte to the printer port. That can
    be done without using software interrupts by using outport:

    outportb( 0x378, ch );

    However, you will have to be root, and you will have to use ioperm to set
    the I/O permission mask.

    On the other hand, there are almost certainly better ways to do what you
    want. Your standard parallel port will probably be exposed as a special
    file, /dev/lp0. You can send bytes to it just by writing to this file.
    --
    Tim Roberts, timr@probo.com
    Providenza & Boekelheide, Inc.

  3. Re: to make soft interrupt with AX registers in linux?

    On Jul 17, 5:55 am, "google-rambo88" wrote:
    > Hi.
    >
    > I'd like to know to send to printer port, I did like this on DOS...
    > I used to use int86 () function to make soft interrupt...
    >
    > I'd like to know how to make soft interrupt with AX registers in linux?
    >
    > But this kind of using is it possible in linux ?
    >
    > sendcharToPrinter ( char ch )
    > {
    > union REGS printer;
    >
    > printer.h.ah = 0;
    > printer.h.al = ch;
    > printer.x.dx = 0x378
    > int86( 0x17, &printer, &printer );
    > }
    >
    > Thanks..


    No, it doesn't work like that on any UNIX-like operating system.
    Sorry.

    DS


  4. Re: to make soft interrupt with AX registers in linux?

    what does "send to printer port" means?

    If you want read/write some data from/to some io port. first get
    permission of directly access io port (using ioperm or iopl system
    call), then use inb/outb to do io port input/output

    see:
    man iopl
    man inb

    Good luck


  5. Re: to make soft interrupt with AX registers in linux?

    In article , "google-rambo88"
    writes:

    > I'd like to know to send to printer port, I did like this on DOS...
    > I used to use int86 () function to make soft interrupt...
    >
    > I'd like to know how to make soft interrupt with AX registers in linux?
    >
    > But this kind of using is it possible in linux ?
    >
    > sendcharToPrinter ( char ch )
    > {
    > union REGS printer;
    >
    > printer.h.ah = 0;
    > printer.h.al = ch;
    > printer.x.dx = 0x378
    > int86( 0x17, &printer, &printer );
    > }


    As noted elsewhere, you probably don't want to do things this way
    if you can avoid it.

    If you're trying to actually print to a printer, just use the
    lp/lpr commands or at least use the /dev/... pseudo-file.

    If, on the other hand, you are trying to access a special device
    that just happens to be attached to the parallel port, your options
    go something like:

    1) First, try to use the /dev/... device. You should be able to
    both read and write to/from it.

    2) There have generally been a few device drivers for the parallel
    port that provide more general access. You might try a net
    search to see if one of these will satisfy your purposes.

    3) Linux (at least earlier versions) has the ioperm(2) call on
    x86-based systems. This will give you access to execute x86
    IO instructions. (Assume that there are lots of warnings here
    about why this is dangerous to the health of your system.)

    4) I'm fairly sure that I've noticed that some of the MS-DOS
    emulators have the ability to also simulate INT instructions
    and control real hardware devices. I've never personally used
    one, however.

    Note that any method that provides access beyond use of the lp/lpr
    commands will require the program to have elevated privileges of
    some form.

    - dmw

    --
    .. Douglas Wells . Connection Technologies .
    .. Internet: -sp9804- -at - contek.com- .

+ Reply to Thread