|
|
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: 1276 (0x4fc)
Types: TextFile
Notes: UNIX file
Names: »port.c«
└─⟦f27320a65⟧ Bits:30001972 Commodore 900 hard disk image with partial source code
└─⟦2d53db1df⟧ UNIX Filesystem
└─⟦this⟧ »hr/src/port/port.c«
/*
* Commodore Z8000-HR console
*/
#include <coherent.h>
#include <con.h>
#include <io.h>
#include <uproc.h>
#include <errno.h>
#include <sched.h>
#include <sgtty.h>
#include <signal.h>
#include <stat.h>
#define MAJOR 9 /* major device # of the console */
#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 */
};
int ptioctl( ),
ptload,
ptuload,
nulldev();
CON ptcon = {
DFCHR,
MAJOR,
nulldev,
nulldev,
nulldev,
nulldev,
nulldev,
ptioctl,
nulldev,
nulldev,
ptload,
ptuload
};
ptload()
{
printf("PTload\n");
}
ptuload()
{
}
ptioctl( dev, com, args)
dev_t dev;
int *args;
{
register unsigned self;
struct pio pio;
self = minor( dev);
if ( com != PIOINB && com != PIOINW && com != PIOOUTW && com != PIOOUTB )
return;
ukcopy(args, &pio, sizeof(pio));
if ( u.u_error )
return;
if ( com == PIOOUTW )
{
out(pio.paddr, pio.pdata);
return;
}
else if ( com == PIOOUTB )
{
outb(pio.paddr, pio.pdata);
return;
}
else if (com == PIOINB )
pio.pdata = inb(pio.paddr) & 0xff;
else
pio.pdata = in(pio.paddr);
kucopy(&pio, args, sizeof(pio));
}