Technical notes on ICS Advent 82C55A cards

Top  Previous  Next


Datasheet is 1143.pdf or PCDIOxB-P_1143.pdf. Manual is 00431231.pdf or "PCDIOB Series_00431231_rev2C.pdf".


Drivers are very simple (but potentially dangerous); you peek and poke the registers of the 8255 controller chips. For a 24-line card (the only kind we're using), the following register assignments apply. Base address + 0 = Port A (read/write); base address + 1 = Port B (read/write); base address + 2 = Port C (read/write); base address + 3 = control register (read/write). For cards with >24 lines, new 8255s are addressed from (base address + 4) onwards.


In a DOS system, the manual suggests checking IO address availability by running DEBUG.EXE and typing (for example) I 300, which should return "FF" (0xFF) if the address if free; in our example, you'd need to check addresses 300-303 in turn and ensure they're all free.


To control this card, we need to refer to the 82C55A data sheet...


The control register has the following bits.




D7 (MSB)

mode set flag (1 = active)

D6 and D5

Group A - mode selection (00 = mode 0; 01 = mode 1; 1X = mode 2)


Group A - Port A (1 = input, 0 = output)


Group A - Port C, upper half (1 = input, 0 = output)


Group B - mode selection (0 = mode 0, 1 = mode 1)


Group B - Port B (1 = input, 0 = output)

D0 (LSB)

Group B - Port C, lower half (1 = input, 0 = output)


We always want mode 0 (basic input/output), not mode 1 (strobed input/output) or mode 2 (strobed, bidirectional bus input/output).


From the information on the "Peek and Poke driver" from ICS Advent:

(extract from "PCDIOB Series_0431231_rev2C.pdf")


The Peek and Poke driver for Windows 95/NT allows developers to write Win32 programs that access hardware I/O ports and physical memory on ICS Advent products. This driver simplifies the testing of hardware components because they can be accessed without using a specific driver for each product.


Caution. The Peek and Poke driver gives application-level access to areas of the hardware and memory that can crash the operating system or corrupt data. Take care to access only known memory or I/O ports.


Under Windows NT, pplibnt.lib and pplibnt.dll are the drivers (pplibnt.lib for C++ static linking; pplibnt.h is the header).


Note: To make sure that libraries are thread safe, you must use the ics_pp_open() call in your initial thread, before creating any other threads. Then make sure that all other threads are terminated before calling ics_pp_close().


BOOL ics_pp_open(void)

Opens the Peek and Poke driver. Returns TRUE if successful. This must be called before any calls are made to other library functions.


void ics_pp_close(void)

Closes the driver. Should be called before the application exits.


void *ics_pp_make_pointer(int page, int length)

This function allows access to a particular region of physical memory by a Win32 application. page is the starting page of the physical memory; length is the size of the region in pages. For example, for a pointer to a region of physical memory starting at 0xA000 and 64k long, use void *ptr = ics_pp+make_pointer(0xA),0x10); [note misprint there; need to be v. careful when testing this!] The pointer can then be treated as a standard C/C++ pointer (see below). Note: Be sure to release this memory region back to the system as follows: ics_pp_release_pointer.

[Another version of that excerpt:] For example, for a pointer to a region of physical memory starting at 0xA0000 and 64k long: void *ptr = ics_pp_make_pointer (0xA0, 0x10);


void ics_pp_release_pointer(void *address, int length)

This function releases a memory mapping made with ics_pp_make_pointer. You must release such pointers back to the system. Failure to do so could affect the way the system runs even after the application has exited. address is the address returned by the ics_pp_make_pointer function; length is the size of the mapped region in pages.


int ics_pp_outp(USHORT port, int data)

USHORT ics_pp_outpw(USHORT port, USHORT data)

ULONG ics_pp_outpl(USHORT port, ULONG data)

These functions output data to the given port. Use ics_pp_outp for byte width, ics_pp_outpw for word width, and ics_pp_outpl for double word width.


int ics_pp_inp (USHORT port)

USHORT ics_pp_inpw (USHORT port)

ULONG ics_pp_inpl (USHORT port)

These functions return data input from the given port. Use ics_pp_inp for byte width, ics_pp_inpw for word width, and ics_pp_inpl for double word width.