gwyn@BRL.ARPA (Doug Gwyn, VLD/VMB) (05/21/87)
In an accompanying message is a C header file I use on my Apple IIGS to define macros for using the Zilog 8530L Serial Communications Controller that controls access to the "printer" and "modem" ports. That file is heavily commented and gives references for further details. The following is a portion of the C source for a program that uses the header file in order to directly control the printer port, as an example of usage of the macros. /* example of "scc8530.h" usage -- taken from a printout utility */ #include "scc8530.h" static void prinit() { char warned = 0; SCCA_ctrl( 9, WR9_RSTA ); SCCA_ctrl( 10, WR10_NRZ | WR10_MIDLE ); SCCA_ctrl( 11, WR11_RXTAL | WR11_RBRG | WR11_TBRG ); SCCA_ctrl( 12, X16_9600 ); SCCA_ctrl( 13, X16_9600 >> 8 ); SCCA_ctrl( 15, 0 ); SCCA_ctrl( 0, WR0_RUND | WR0_RERR ); SCCA_ctrl( 1, WR1_RIDIS ); SCCA_ctrl( 4, WR4_X16 | WR4_1SB ); SCCA_ctrl( 14, WR14_DPLL | WR14_BREN ); SCCA_ctrl( 3, WR3_R8B | WR3_SCLI | WR3_RXEN ); SCCA_ctrl( 5, WR5_T8B | WR5_TXEN | WR5_RTS ); while ( (SCCA_stat( 0 ) & RR0_CTS) == 0 ) if ( warned == 0 ) { write( 2, "\007printer off-line\n", 18 ); ++warned; } } static void prc( c ) int c; { while ( (SCCA_stat( 0 ) & (RR0_CTS | RR0_EMPTY)) != (RR0_CTS | RR0_EMPTY) ) ; /* wait until transmitter ready */ SCCA_out( c ); }