MANUAL FOR 2NDSERIAL (6502 ROM image) This file describes the ROM image 2NDSERIAL which drives the associated second serial port card hardware which contains a 6850 serial chip so the machine can have two ports in use simultaneously. The image requires at least one 2k bank of sideways RAM or to be put onto a ROM to work. The manual and software are (C)2000 SPROW INSTRUCTIONS- At any command line prompt, eg.the BASIC command prompt '>' type ON A MASTER: *SRLOAD 2NDSERIAL 8000 *INSERT where may be 7,6,5,4 ON A MACHINE WITH SWRAM: *LOAD 2NDSERIAL 8000 and press CTRL-BREAK to initialise. On reset the software will claim 3 pages of memory for its private use. One page of this is for new buffer management software and the other two are for serial input/output buffers, which means it cannot be in the 'hidden' workspace on a Master series machine. All of the settings normally associated with the on board serial port such as baud rates, data formats etc... can be controlled. Firstly select the second serial port with *COM2 at the command line, then issue any *FX calls which you require to set up the serial port (referring to the BBC Micro User Guide for details). The serial port on the motherboard is denoted by *COM1 from now on, so to switch back to controlling the built in serial port issue a *COM1 command. So for example, setting baud rates might consist of *COM1 *FX7,3 *FX8,4 *COM2 *FX7,7 *FX8,4 TECHNICAL INFORMATION- The following conditions prevail at power up OSBytes refer to: COM1, the internal port Baud rate: 9600 transmit and receive Parity: None Stop bits: 1 Data bits: 8 The input buffer id is 9 and output buffer id is 10. Events will be generated which may be of interest to the programmer if an RS423 error occurs or a buffer becomes full or empty "RS423 error" - the lost byte is passed in Y, the second serial card's 6850 register is passed in X shifted right by 1 place "Input buffer full" - the unsuccessful byte is in Y and X=9 "Output buffer empty" - enters with X=10 Note that to achieve sustained error free reception at 19200 the ROM should be installed in as high a priority socket as possible, this is to keep to a minimum the time spent passing round the unknown interrupt service call. Too low a priority will typically show up that manual typing at 19200 will be received correctly but file transfers will have bytes missing (alternatively, increase the inter character delay time in the sending application). BUFFER FLUSHING- The two OSByte commands to flush buffers will work regardless of the setting of the *COM1 or *COM2 switch. So *FX15,0 will flush all buffers, including the second serial card's *FX15,1 will flush the current input buffer *FX21,n will flush buffer n, including the second serial card's in the case of n=9 or n=10 SUPPORTED FX CALLS- All of the other OSBytes listed below must be preceded by a *COM2 for them to have any effect on the second serial card. When preceded by a *COM2 command the following OSBytes are listened for by the second serial card firmware. You may either type them directly at the command line with *FX or by calling the OSByte routine from your programs. For calls with A > 165 the operation performed is = ( AND Y) EOR X and returns with A = preserved X = Y = undefined FX 2 (select input stream) Choosing *FX2,0 disables RS423 input interrupts Choosing *FX2,2 enables RS423 input interrupts Note that to read or write bytes from the serial port you must use OSByte 138 to insert bytes into the output buffer and OSByte 145 to get bytes from the input buffer, you cannot use *FX2,1 and *FX3,7 to redirect keyboard and screen activity to the port as this only works with the built in serial interface. FX 7 (set receive rate) Rates between 75 and 19200 baud are possible, this call returns with the X and Y register set to the old ULA contents (see *FX242 below). The default, set with *FX7,0 is 9600 baud. FX 8 (set transmit rate) Rates between 75 and 19200 baud are possible, this call returns with the X and Y register set to the old ULA contents (see *FX242 below). The default, set with *FX8,0 is 9600 baud. FX 156 (read/write 6850 control register plus OS copy) This call writes to the control register of the 6850 chip and the OS copy. By consulting the 6850 data sheet it is possible to implement serial standards other than the "8N1" default. The action of this OSByte is = ( AND Y) EOR X returning with X= and A, Y preserved. FX 181 (determine action on receiving escape/soft key) No expansion of escape or soft keys occur, this location is always 1. FX 191 (read/write RS423 in use flag) This call tests whether the RS423 hardware is busy, returning with bit 7 set if it is free, bits 0 to 6 are undefined. Value 'busy' means that either transmit or receive interrupts are enabled, writes to this location are ignored. FX 192 (read/write 6850 control register OS copy only) This call reads or writes the OS copy of the control register on the 6850 chip. Do no write to this location as it would make the copy inconsistent with the value in the chip. FX 203 (read/write input buffer handshake ceiling) If the number of free bytes in the input buffer falls below the number held in this location the RTS line will go high to stop any further bytes being sent from the other computer. It contains 9 by default on soft and hard resets. FX 204 (read/write serial suppression flag) This controls RS423 suppression. When the location is zero characters are placed in the input buffer as usual, when non zero all characters are discarded. Reception errors are still reported via events. FX 205 (read/write hardware use flag) This location contains &00 if the hardware is used in RS423 data mode &40 if the hardware is used in cassette mode It will always contain 0 for the second serial card. FX 232 (read/write IRQ mask) The IRQ mask is always 255, and handled internally. FX 242 (read/write serial ULA register OS copy only) This call reads or writes the second serial card's serial ULA. The byte is set out as %msrrrttt Where m=motor relay state (always 0, there is no relay on the card) s=system select (always 1, the card is always in RS423 mode) rrr=receive baud rate (see table) ttt=transmit baud rate (see table) The baud rates read from the ULA are %000 = 19200 %001 = 1200 %100 = 9600 %101 = 300 %010 = 4800 %011 = 150 %110 = 2400 %111 = 75 Do no write to this location as it would make the copy inconsistent with the value in the ULA. KNOWN PROBLEMS/FUTURE ENHANCEMENTS- No known problems Sync star command matcher with other ROMs. HISTORY- V0.63 Modified test code to allow it to be run from ROM V0.68 Added OSByte interface V0.69 Altered INSV code, previously if the input and output buffers were far apart the outgoing bytes could end up being put in the incoming buffer V0.72 Added handler to listen for buffer flushing OSBytes too V0.74 Removed redundant zero byte marker from service call table, changed controller base address to &FC60 to account for new circuit boards. OSByte 204 implemented. OSByte 181 and 232 return hardwired results for compatibility.