|
|
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: 1673 (0x689)
Types: TextFile
Notes: UNIX file
Names: »test.c«
└─⟦f27320a65⟧ Bits:30001972 Commodore 900 hard disk image with partial source code
└─⟦2d53db1df⟧ UNIX Filesystem
└─⟦this⟧ »hr/src/port/test.c«
/*
** ZCIO1 base address
*/
#define ZCIO1 0x0000
#define PKBD 0x0205 /* keyboard enable port */
#define KBDEN 0x02 /* keyboard enable bit */
#define PC2 0x04
#define PC3 0x08
/*
* Control register addresses
*/
#define MICR 0x01 /* master interrupt */
#define MCCR 0x03 /* master configuration */
/*
* Register addresses for Port A
*/
#define PACAS 0x11 /* port a command and status */
#define PAMS 0x41 /* port a mode specification */
#define PAHS 0x43 /* port a handshake spec */
#define PADPP 0x45 /* port a data path polarity */
#define PADD 0x47 /* port a data direction */
#define PASIOC 0x49 /* port a special io control */
#define PAPP 0x4b /* port a pattern palarity */
#define PAPT 0x4d /* port a pattern transition */
#define PAPM 0x4f /* port a patterm mask */
#define PAIV 0x05 /* port a interrupt vector */
#define PADATA 0x1b /* port a data */
/*
* Register addresses for Port C
*/
#define PCDD 0x0d /* port c data direction */
#define PCSIOC 0x0f /* port c special io control */
#define PCDPP 0x0b /* port c data path polarity */
#define PCDATA 0x1f /* port c data */
struct ptable
{
unsigned paddr;
char *pname;
};
struct ptable ptable[] =
{
PACAS, "PACAS",
PAMS, "PAMS",
PAHS, "PAHS",
PADPP, "PADPP",
PADD, "PADD",
PASIOC, "PASIOC",
PAPP, "PAPP",
PAPT, "PAPT",
PAPM, "PAPM",
PAIV, "PAIV",
PADATA, "PADATA",
PCDD, "PCDD",
PCSIOC, "PCSIOC",
PCDPP, "PCDPP",
PCDATA, "PCDATA"
};
main()
{
int fd;
struct ptable *p;
fd = open("/dev/port", 2);
if ( fd < 0 )
return;
for ( p=ptable ; p<ptable+(sizeof(ptable)/sizeof(ptable[0])) ; p++ )
printf("%s\t0x%x\n", p->pname, inb(fd, p->paddr) & 0xff);
printf("\n");
}