Ancient Parallel Port PIC Programmer - support under newer versions of Wine?

Alex Henrie alexhenrie24 at gmail.com
Sun Sep 25 15:25:50 CDT 2016


2016-09-24 20:18 GMT-06:00 Bob Wya <bob.mt.wya at gmail.com>:
> Can anyone help out with this user question on the WineHQ Forums?
> forum.winehq.org/viewtopic.php?f=8&t=27503
>
> Since the programmer used to work - with older versions of Wine - I presume
> that it might still be possible to get it working?
> Perhaps starting with parallel port device symlinks in
> "${WINEPREFIX}/dosdevices" ...
>
> Any thoughts?

If the program is calling CreateFile("COM1", ...) then symlinks should
work fine. If the program is trying to read from or write to the
address of the parallel port in memory, you can write a small wrapper
to call ioperm and execvp. For example, the following "ioperm" program
grants access to the system speaker and calls the "beep" program which
plays a tone for 1 second:

---ioperm.c---
#include <stdio.h>
#include <sys/io.h>
#include <unistd.h>

int main(int argc, char* argv[])
{
    if (ioperm(0x42, 0x61 - 0x42 + 1, 1) == -1)
    {
        perror("ioperm");
        return 1;
    }

    if (execvp(argv[1], argv + 1) == -1)
    {
        perror("execvp");
        return 1;
    }

    return 0;
}

---beep.c---
#include <stdio.h>
#include <unistd.h>

int main()
{
    __asm__("movb $0xB6, %al\n"
            "outb %al, $0x43\n"
            "inb $0x61, %al\n"
            "orb $0x03, %al\n"
            "outb %al, $0x61\n"
            "movb $0x64, %al\n"
            "outb %al, $0x42\n"
            "movb $0x01, %al\n"
            "outb %al, $0x42\n");
    sleep(1);
    __asm__("inb $0x61, %al\n"
            "andb $0xFC, %al\n"
            "outb %al, $0x61\n");
    return 0;
}

---compile and run---
cc ioperm.c -o ioperm
i686-w64-mingw32-cc beep.c -o beep.exe
sudo setcap cap_sys_rawio=ep ioperm
./ioperm wine beep.exe

I hope this helps.

-Alex



More information about the wine-devel mailing list