|
|
DataMuseum.dkPresents historical artifacts from the history of: Commodore CBM-900 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Commodore CBM-900 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 1007 (0x3ef)
Types: TextFile
Notes: UNIX file
Names: »plib.c«
└─⟦f27320a65⟧ Bits:30001972 Commodore 900 hard disk image with partial source code
└─⟦2d53db1df⟧ UNIX Filesystem
└─⟦this⟧ »frankh/src/plib.c«
└─⟦this⟧ »hr/src/port/plib.c«
/*
** inw(fd, paddr) - input a word
** inb(fd, paddr) - input a byte
** outw(fd, paddr, pdata) - output a word
** outb(fd, paddr, pdata) - output a byte
**
** fd: file descriptor of special port driver
** paddr: port address
** pdata: output data
*/
#define PIOINW 1 /* input word */
#define PIOINB 2 /* input byte */
#define PIOOUTW 3 /* output word */
#define PIOOUTB 4 /* output byte */
struct pio
{
unsigned paddr; /* port address */
unsigned pdata; /* port data */
};
inw(fd, paddr)
int fd;
int paddr;
{
struct pio pio;
pio.paddr = paddr;
ioctl(fd, PIOINW, &pio);
return pio.pdata;
}
inb(fd, paddr)
int fd;
int paddr;
{
struct pio pio;
pio.paddr = paddr;
ioctl(fd, PIOINB, &pio);
return pio.pdata & 0xff;
}
outb(fd, paddr, pdata)
int fd;
int paddr;
{
struct pio pio;
pio.paddr = paddr;
pio.pdata = pdata;
ioctl(fd, PIOOUTB, &pio);
}
outw(fd, paddr, pdata)
int fd;
int paddr;
{
struct pio pio;
pio.paddr = paddr;
pio.pdata = pdata;
ioctl(fd, PIOOUTB, &pio);
}