$COMPACT ROM WORD16 rom_io: DO; DECLARE TOKEN LITERALLY 'SELECTOR', WORD_16 LITERALLY 'WORD', WORD_32 LITERALLY 'DWORD', FALSE LITERALLY '00H', /* * Declare constants for serial channel 1. */ BASE_PORT LITERALLY '03F8H', RBR LITERALLY '0', /* Receive Buffer register */ THR LITERALLY '0', /* Transmitter Holding register */ IER LITERALLY '1', /* Interrupt Enable register */ LCR LITERALLY '3', /* Line Control register */ MCR LITERALLY '4', /* Modem Control register */ LSR LITERALLY '5', /* Line Status register */ MSR LITERALLY '6', /* Modem Status register */ DLL LITERALLY '0', /* Divisor Latch Low */ DLM LITERALLY '1', /* Divisor Latch High */ /* IER values */ NO_INTS_ON LITERALLY '0', /* LCR values */ EIGHT_BIT LITERALLY '3', DLAB LITERALLY '80H', /* Divisor Latch Enable */ /* Encoding for 9600 baud */ BAUD_CODE_LSB LITERALLY '12', BAUD_CODE_MSB LITERALLY '00'; $eject rq$A$physical$attach$device: PROCEDURE( dev_name_p, file_driver, response_mailbox, exception_p) PUBLIC; DECLARE dev_name_p POINTER, file_driver BYTE, response_mailbox TOKEN, exception_p POINTER, char BYTE; /* * Program the baud rate count. */ OUTPUT(BASE_PORT + LCR) = DLAB; /* Select divisor latch */ CALL TIME(10); OUTPUT(BASE_PORT + DLM) = BAUD_CODE_MSB; CALL TIME(10); OUTPUT(BASE_PORT + DLL) = BAUD_CODE_LSB; CALL TIME(10); /* * Program the USART characteristics. */ OUTPUT(BASE_PORT + LCR) = EIGHT_BIT; /* 8-bit no parity */ CALL TIME(10); OUTPUT(BASE_PORT + IER) = NO_INTS_ON; /* Disable all ints */ CALL TIME(10); OUTPUT(BASE_PORT + MCR) = 0; /* Reset modem signals */ CALL TIME(10); /* * Clear all interrupt sources. */ char = INPUT(BASE_PORT + MSR); /* Modem status */ CALL TIME(10); char = INPUT(BASE_PORT + LSR); /* Line status */ CALL TIME(10); char = INPUT(BASE_PORT + RBR); /* Purge Rx buffer */ CALL TIME(10); char = INPUT(BASE_PORT + LCR); /* Check Line Ctrl Reg */ END rq$A$physical$attach$device; $eject rq$A$write: PROCEDURE( connection_t, buffer_p, buffer_size, response_mailbox, exception_p) PUBLIC; DECLARE connection_t TOKEN, buffer_p POINTER, buffer_size WORD_32, response_mailbox TOKEN, exception_p POINTER, buffer BASED buffer_p (1) BYTE, index WORD_32; DO index = 0 TO buffer_size - 1; /* * Wait until Tx buffer is ready, then output character. */ DO WHILE (INPUT(BASE_PORT + LSR) AND 20H) <> 20H; END; OUTPUT(BASE_PORT + THR) = buffer(index); END; END rq$A$write; END rom_io;