CUBE Technical Manual EuroBEEB Single Board Computer Control Universal Limited CONTENTS LIST Revision 5H/1 Introduction ^ The CUBE Range of Industrial Eurocards 1 EuroBEEB/ Euro CUBE— 65 Features 2 Machine Operating System 3 EuroBEEB and EuroCUBE— 65 Differences 4 Part I: Hardware 5 EuroCUBE-65 : Hardware Description 5 Reset Methods 10 Serial Interface 12 General Description 12 RS -423/422 Operation 16 VIA Timer and Calendar Clock 21 EuroBEEB 26 Part II: Using EuroBEEB 27 Developing EuroBEEB via the BBC Microcomputer 27 Some Simple Programs 35 Programming 37 Development 38 Running EuroBEEB in Stand-Alone Mode 42 x Part III: Software 45 Machine Operating System M0SB.3 45 Introduction MOSBe 3 Versions MOSB. 3 Description 45 47 53 Operating System Calls *FX Calls OSBYTE Calls OSWORD Calls Filing System Paged ROMs Interrupts Events Reset 53 53 55 59 61 61 62 63 64 Control BASIC Extension 66 Introduction Channel Identification ON/OFF and Logic Levels Use of the ID Character Control BASIC Extension 66 67 69 70 Words 71 1. Commands with respect to a VIA stack 7 J 2. Analog I/O Commands ^ 3. Real-Time Clock Commands 4. Timing Command Real-Time BASIC ^ OSBYTE /OSWORD Command Summary ii Peripheral Drivers 107 Introduction 107 Operation 109 Effect of RESET 111 The CUBE Monitor 113 Appendixes 1. Memory Decoding 131 I/O Map 135 6502 Input/Output Memory Map 136 2. Memory Configuration 137 3. Software 'Cold Reset' Example 141 4. Serial Software for EuroCUBE-65 142 5. RS-422/423 Application Note 149 6. Interfacing EIA Terminal Equipment to the EuroCUBE-65 Serial Port 161 1 . Clock Software 169 8. Creating BBC BASIC EPROMs for EuroBEEB 181 9. Initialisation Tables 190 10. Link and Line Termination Options 199 11. Connectors 201 12. Brief History of EuroCUBE-65 203 iii Introduction The CUBE Range of industrial Eurocards The CUBE range of Industrial Eurocards is designed to provide cost effective solutions to engineering problems . There is a choice of either 6809 or 6502 CPU cards supported by over 30 peripheral cards. These include the following: * A/D and D/A conversion * two/ four-channel serial interface * industrial digital I/O * high-resolution colour graphics * Teletext display * DFS for disk drives * linear memory extension including DRAM and CMOS RAM * sideways RAM/ROM * keyboard* printer and LCD display interfaces * EPROM programming * ROM/EPROM simulation Both 6809 and 6502 CUBE systems use the machine operating concept whereby a software environment is created that allows all the defined peripherals to be called through standard routines with a standard protocol . PAGE 1 EuroBEEB/EuroCUBE-65 EuroCUBE-65 is a 6502-based CPU and single board computer (SBC) designed in Eurocard format (160mm x 100mm). The processor runs at 1 MHz (a 2 MHz option is also available). A standard DIN 41612 bus connector mak.es the CPU card compatible with the CUBE range of Eurocards. Features * 6502 CPU * on-board real-time calendar clock * a VIA I/O chip providing 16 I/O channels, 4 control lines and 2 timers * CUBE/ACORN bus * four reconf igurable 28—pin memory sockets tnat take RAM or ROM up to 16 kB per device * choice of memory maps * battery back-up for the real-time clock and any CMOS RAM on board * RS-423 serial interface (RS-232 compatible) * RS-422 option for noisy environments * Auto-run feature allowing Turnkey operation (automatic power-up and run) PAGE 2 Machine Operating System The machine operating system used in EuroBEEB and EuroCUBE-65 provides a software environment similar to that of the BBC Micro and can support BBC BASIC (or other languages) if required. In addition the MOS contains the peripheral drivers (software to drive cards such as the Teletext card) and Control BASIC (an extension of BBC BASIC which provides BASIC-type commands for analog and digital I/O. See Software Section for details). Future versions of the MOS will contain the drivers for Control NET, a low-cost control network in which a number of EuroBEEBs/EuroCUBE-65s may be networked under the control of a 'Master' station. PAGE 3 EuroBEEB and EuroCUBE-65 Differences EuroCUBE-65 is supplied with a MOS but without a language ROM or RAM unless requested. The three remaining memory sockets can be configured to the user's requirements by wire-wrapping the headers on each 28-pin memory socket . The user can choose the particular memory map which best suits his application. Further details of this can be found in the sections on memory configuration (Appendix 1 & 2 ). EuroBEEB has the same hardware features as EuroCUBE-65 except that wire-wrap headers are not: required. The PCB tracks are laid so that the four 28-pin memory sockets , MO to M3, will take : MO 16 or 8 kB MOS EPROM Ml 16kB BBC BASIC ROM M2 8kB CMOS RAM or 8kB EPROM (selected by changing a prewired DIL header) M3 8kB CMOS RAM EuroBEEB comes supplied with MOSM. 3 with machine code monitor and Control BASIC, BBC BASIC, and 8 or 16kB CMOS RAM. It would, of course, be possible to configure a EuroCUBE-65 card as a EuroBEEB but this would not be very cost effective! PAGE 4 PAST I: HARDWARE EuroCUBE-65 : Hardware Description Memory The microprocessor's address and data buses are taken round the card, connecting to all the memories and input/output devices . Address decoding is achieved by using fuse link PROMs. These have a very fast access time and can be programmed to give almost any address map. There are 16 selectable address maps (see Appendix 1). The last map can be programmed to customer specification. (This service is available from Control Universal at extra cost.) A deselect feature is included on memory socket MO which can allow input /output devices to be placed in part of the space occupied by the operating system EPROM. This is used to create a 256 byte "hole” in the address decoding. Some of this I/O space is reserved for devices on board the CPU, but some is available for external devices on the same bus. Two address decode lines, "HPAGE" and "LPAGE" , are output on to the bus connector and greatly simplify the use of locations within this hole. In addition, a "block" signal allows the use of this single line to decode a definable 4kB without further circuitry. Further details of these I/O features can be found in Appendix 1. The four memory sockets MO to M3 are configured as 'byte wide'. This means that any of the standard 24 or 28 pin devices can be fitted to the card, including the BBC BASIC ROM. PAGE 5 The memory socket links can be wire wrapped to specify which device is in each socket, while the address decoders give the size of each socket. (Note that a smaller device will work in a larger address space . It will just mirror, i.e. its data will appear within the allocated memory space as many times as its size will go into the allocated space. For example, a 2kB device mirrors four times in an 8kB slot.) Memory maps are shown in Appendix 1. Data retention using CMOS devices is provided for by a battery back-up circuit . I/O Two parallel ports and one serial port are included . The parallel ports are provided by a 6522 VIA. This includes two timers , one shift register , four control lines and the two 8 bit ports. The serial device is a 6551 which has an internal programmable baud rate generator. Buffers are used to give RS-422 and RS-423 specification lines. The serial output lines can be made to go tri-state , so allowing multiple channel serial communication. NOTE: In M0SB.2 and M0SB.3, Timer 1 is used to provide the centisecond clock, so this is not available to the user. See also the note on the use of timers in the section on Control BASIC. PAGE 6 Connectors Three connectors are fitted . The parallel port uses a 26-way IDC connector. The serial lines are on a 7-pin DIN connector, and the bus expansion is through a 64 way Euro connector. Reset Power on, warm, cold and serial resets are possible, and the software supplied allows Auto-run operation. Calendar Clock A battery-supported calendar clock (M3000/3002) has stop watch and alarm registers as well as the normal calendar register . Both the alarm and the stop watch can generate interrupts. Single Rail Supply RS-423 communication requires +/- 5V. If the user has a single rail supply at +5V, then -5V can be generated on board using the optional 5V inverter . PAGE 7 Fig. 1: EuroBEEB - board lay-out PAGE 8 CMOS 8X CMOS MOS RAM RAM/16K 8K/16K EPfWM Fig. 2: EuroCUBE-65 - functional diagram PAGE 9 RESET METHODS 1. Power On This occurs at switch on and is known as a 'cold reset'. It happens approximately 1 second after the supply voltage exceeds 4.5V (+/-0.25V) . Before this happens , the VIA (6522) is independently reset by a separate circuit. The software can test the VIA to see whether the registers are in the reset state. If this is the case , the power has just come on and a software 'cold reset' is done (see Appendix 3 for software example). 2. Manual Reset The reset line is on pin 23 of the parallel port CON 2 (not the VIA itself) or the west pin of link L4. Holding to OV for longer than 1 second will cause a reset . It causes a system reset identical to a Power On, except that the VIA will not be reset . The VIA registers will now be in their initialised state , and the software can now do a 'warm reset'. Issue 7 EuroCUBEs have a pair of hard r eset pins which cause an instantaneous reset. RESET is taken to two on-board SIL pins located adj acent to Pin I of ICII (6522). To use the hard reset option, connect a momentarily closed (but normally open) push switch between these pins . PAGE 10 3. Serial Reset The serial port can be configured to cause a reset for remote applications by fitting link L4. The serial input will produce a reset if the receiver input goes active for a time greater than that given by R3,C6. R2 gives a fast discharge for the normal non-active line. This is equivalent to the BREAK key on terminals , but it can also be activated by on a BBC Micro fitted with the CUBE sideways ROM (*EURO) . See chapter on using EuroBEEB for more details . NOTE : When L4 is fitted the manual reset cannot be used. PAGE 11 SERIAL INTERFACE 1. General Description The serial communication channel is based on a 6551 UART (Universal Asynchronous Receiver Transmitter). Data on this device can be found in a separate Appendix. RS-422/3 drivers and receivers are added to provide a very versatile communications channel. The types of serial communication supported and their attributes are as follows : Spec Voltage swing Maximum distance Maximum data rate RS-422 0 to +5V Diff. 4000 feet 10 Mbaud RS-423 -5 to +5V S/ ended 2000 feet 300 kbaud (RS-232 -12 to +12V S/ended 50 feet 2Qkbaud) Further details can be found in Application Note 1 on RS-423/422 (available on request from Control Universal) . NOTE: From Issue 7 onwards, there is a separate on-board oscillator for the 6551. PAGE 12 The output buffers have tri-state outputs so that 'party lines' can be considered. A series of EuroCUBEs using 'Party Line' configuration can achieve multi-channel communication. Full duplex can also be set up. A future development is scheduled to provide an operating system enhancement to allow multi-processor linking called Control NET. TxD (TRANSMIT DATA) and RxSEADY (BUSY) have output buffers with the tri-state condition controlled from RTS (REQUEST TO SEND). RxD (RECEIVE DATA), TxENABLE (or CTS - CLEAR TO SEND ) have input buffers (see Fig . 3) . The serial connector uses a 7 pin DIN socket. A communications link can be accomplished by simply connecting two serial ports back to back (i.e. Transmit to Receive) . If the receiver can process the data faster than the transmitter is sending it, all will be well. At 9600 baud approximately one character will be arriving at the receiver every 1 ms. If this cannot be dealt with, the next character will be missed or the receiver will be switched on in the middle of a character, thus causing bad data. To avoid this problem, handshaking lines are added. This is effectively a BUSY signal from the receiver telling the transmitter to wait. The transmitter tests whether it is clear to send (TxENABLE or CTS) and flags whether its receiver is ready. PAGE 13 Fig - 3: Functional diagram of port . the RS-423 serial PAGE 14 EuroCUBE uses CA 2 ( f rom the VIA) for the RxREADY (BUSY) output and DSR (Data Set Ready) for the input (see Fig. 3). The 6551 's own RTSxCTS signals are not used directly because the GTS can terminate a transmission in the middle of a byte, and RTS has the side effect of disabling the transmitter interrupt. However, RTS is used as an output enable. See p.18 for 6551 pin usage. The Operating System provides a fully buffered interrupt driven serial channel. A software example for a very simple serial channel can be found in Appendix 4. WARNING: DSR sends out interrupts which should be ignored. Line termination options are shown in Appendix 5. PAGE 15 RS-42.3/422 Operation From Issue 7 onwards. Link 5 includes three options for RS-423/422 operations top Link 5 0-0 O 0 o o 0 o *0-0 o o o o O 0 o~o bus connector (a) Connected to ~5V on the backplane : RS-423 operation (supplied as standard) ( b) Connected to ~5V via the optional 7760 voltage inverter; RS-423 operation (for use with single +5Y supply only) (c) Connected to ground on the backplane; RS-422 operation PAGE 16 Fig. 4: Using the BBC Micro as a terminal to the EuroCUBE. Fig. 5: Linking the EuroBEEB processor card to a standard VDU terminal through the RS-423 (RS-232 compatible) serial port on the EuroBEEB. PAGE 17 NOTES (1) There are a number of ways of linking the EuroCUBE processor card to a standard VDU terminal through the RS-423 (RS-232 compatible) serial port on EuroCUBE. See Appendix 6 for further details. (2) When using a terminal other than the BBC Micro s the serial filing system can be switched off by using *FX183, 255 , so that command LOAD "filename" , for example s will now give 'bad command'. (3) The default conditions for the EuroCUBE serial port match those of the BBC Micro: 9,600 baud 1 Start bit 8 Data bits 1 Stop bit No parity (4) ACXA (6551 ) signal usage on EuroCUBE TxD serial output data RxD serial input data CTS input (tied low) RTS enable TxD output buffer (active low) DSR TxD enable input DCD input (tied low) DTR output (no connection) PAGE 18 (5) VIA (6522) CA2 receiver ready output Note that all other VIA signals are user available. (6) RS-232/RS-423 compatibility Although these two interface standards expect different voltage swings (+/-12V and +/-5V respectively) , in practice the RS-423 interface of EuroBEEB will in most cases work quite happily with RS-232. (7) Baud rate select for input and output This uses an OSBYTE call entered with the Accumulator set to 7 and the X register as follows (see also under MOSB. 3) : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 9600 default 19200 150 300 600 1200 1800 2400 3600 4800 7200 109.92 134.58 50 75 PAGE 19 NOTE: OSBYTE 8 (set RS-423 baud rate for data transmission) is not implemented® If the BBC BASIC interpreter is fitted, the equivalent *FX can be used® See "Advanced User Guide for the BBC Microcomputer" for more details of OSBYTES. PAGE 20 VIA TIMER AND CALENDAR CLOCK 1. VIA Timer The T1 timer on the VIA chip is used for generating the TIME function in BBC BASIC, a facility which is also used by the INKEY command. The user can thus only employ one of the two timers on the EuroCUBE's VIA chip when using BBC BASIC. 2. Calendar Clock The calendar clock found in the EuroCUBE is based on the MEM M3000/3002 ^real-time' clock which features : (a) A CLOCK which gives the time in hours, minutes and seconds (24-hour clock) and a calendar giving the date, month, year, weekday and week number. (b) An ALARM which provides an IRQ output when set to a specific date and time (if enabled). (c) An incremental TIMER which can time events of up to 24 hours duration to the nearest second. The timer can also produce an IRQ output . PAGE 21 The calendar clock is address decoded at &FE18 and appears as a single register. It is driven from a 32.768 kHz crystal and is adjustable by a trimmer capacitor. It will be noted that the clock runs on +5V with power on and from a 2.5V battery with power down. The oscillator is slightly voltage dependent, and when adjusting it, a compromise has to be made. The clock is factory-set assuming a 1:2 on/ off ratio of normal use. Clock a djustme nt is achieved by the time period on pin 15 (PULSE) . This is set to 3906 . 25 +/-0.1 yis which gives an accuracy of better than 1 second per day. The clock register can be regarded in the same way as CMOS RAM. In normal conditions it functions perfectly. However, like CMOS RAM, the clock can be corrupted by power supply transients such as those caused by electrical storms, or by accidental circuit short when the card is removed from the system rack. Control BASIC, which Is part of all MOSB. 3 versions, contains the commands CL0CK$, DATE$, DAY, WEEK for interrogating the real-time calendar clock. The section on Control BASIC gives further details . Alternatively , the clock can be accessed using the new 0 SWORD calls 14 and 15. These calls will read and write to the CLOCK if it is fitted (Issue 5 EuroCUBEs onwards) . The parameter block for passing the clock values is described below. Note that a null value, &FF, can be entered when writing to the CLOCK, in order to leave certain values unchanged. PAGE 22 Calendar clock parameter block Address Data Group Max. Value Operations 0 1 2 3 4 5 6 7 Seconds Minutes Hours Date Month Year Seek day Week no. WATCH 59 59 23 28,29,30,31 12 99 07 53 Time date locations incremented by internal timing circuitry under control of status Bit 0 8 Seconds ALARM 59 Alarm data locations 9 Minutes 59 preset by user A Hours 23 to provide IRQ output B Bate 28,29,30,31 at specified time C Seconds TIMER 59 Timer data locations D Minutes 59 incremented under E Hours 23 control of status Bit 4 F Status STATUS Control NOTE i The data stored in addresses 0 to 14 is in binary coded decimal (BCD) format. PAGE 23 M3000/3002 Status Word The M3000/3002 is controlled by the clock status register which in the EuroBEEB is copied into/from parameter block location 15. Its structure is as follows : "TENS" "UNITS" < , — »¦ PAGE 24 If the Monitor peripheral driver (MOSM. 3) is fitted, the commands *CLQCK and *DAIE will send the current CLOCK time and DATE to the output channel. If MOSM. 3 is not to be used at all in the end application, the data sheet for the M3000 clock chip will be helpful. This is available on request from Control Universal Ltd. See Appendix 7 for clock software. PAGE 25 EuroBEEB EuroBEEB, the BBC-compatible single-board computer , is a 6502-based EuroCUBE with a BBC BASIC II ROM and 8kB or I6kB CMOS RAM memory on board. It is both a low-cost development system and a target system which duplicates the major facilities of the BBC Micro and offers the user the versatility of BBC BASIC in a single Eurocard. The M0SB.3 Operating System supports nearly all the BBC MOS commands, and the BBC BASIC provided on board enables the development and execution of application programs in the familiar software environment of the BBC Micro. The BBC Micro itself can be used as an intelligent terminal and disk file server to EuroBEEB during program development. Files are transferred between disk and the EuroBEEB in target processor mode. Once the application program has been written and tested on EuroBEEB, it can be. disconnected for independent operation in stand-alone mode. Communication to the BBC Micro for both second processor and development purposes takes place through the RS-423 serial port. A 256-byte FIFO buffer has been implemented with an interrupt driven system. For example , characters for output are placed in an output buffer which is emptied under interrupt by the transmitter. PAGE 26 PART II: USING EUROBEEB DEVELOPING EUROBEEB VIA THE BBC MICROCOMPUTER Equipment Required BBC Micro with monitor , DFS and disk drives *EURO 3* 1 EPROM EuroBEEB with MOSM. 3 , BBC BASIC and a minimum of 8k B CMOS RAM Four-slot minirack RS-423 cable (5-pin DIN to 7-pin DIN) Hardware Set-up EUROBEEB PAGE 27 Procedure 1. Turn OFF the power to the system? The mains switch at the back of the BBC computer should in the DOWN position. The mains switch at the back of the mini rack should be in the UP position. 2. Plug the *EURO EPROM into one of the sideways ROM sockets in the BBC Computer. Make sure that the EPROM is in the same orientation as the other ROMs /EPROMs . (The *EURO EPROM contains the software to allow communication between the EuroBEEB and the BBC Computer.) NOTE: *EURO 3.1 is only compatible with MOSB. 3 and its variants. 3. Check the links on the EuroBEEB (this will not be necessary if your card has just arrived from the factory) . On Issue 7 boards these should normally be set as follows : LI not present L2 made L3 made L4 made L5 made in the uppermost position only NRST NOT made PAGE 28 4. The memory sockets should be configured as follows : MO Ml M2 M3 MOSM. 3 (or other series 3 MOS) BBC BASIC II 5565 8kB CMOS RAM (optional but suitable header labelled 5565 should be inserted if this part of the memory is to be used) 5565 8kB CMOS RAM NOTE: All series 3 MOS EPROMs are supplied as 27128 devices. From Issue 7 onwards, memory socket MO on the EuroBEEB is configured for 27128 (2764 compatible). However, if you have an earlier issue of the EuroBEEB board, you will need to make the following modification to MO: Link for 27128 (See page 50) 5. Push the EuroBEEB firmly into the rack so that the edge connector mates firmly into the backplane. 6. Connect the EuroBEEB to the BBC Micro via the RS-423 lead. Make sure that the cut-out in the metal surround of the 5-pin DIN plug is pointing upwards at the BBC end. PAGE 29 7. Turn on the power to the equipment. (Note: if the EuroBEEB is to be powered from the disk power supply outlet of the BBC Micro, the disk pack must have its own power supply.) 8. The command *EURO (or *EU. ) turns the BBC computer into an intelligent terminal, using the RS-423 channel to communicate with the host. Control codes will be interpreted in the same way as the BBC micro's normal VDU channel. 9. When you type in your program on the BBC keyboard it is entered not into the memory of the BBC Micro, but into the memory of EuroBEEB. 10. Other features (a) Editing facilities All the BBC Micro's editing commands, e.g . LIST, RUN, AUTO, etc, as well as the cursor control commands are available. (b) The ESCAPE Key The ESCAPE key works on a BASIC program in EuroBEEB in the same way as it would on a similar program running in the BBC micro. (c) RESET A RESET is transmitted to the BBC by pressing . This will abort the current program in the EuroBEEB and return control to the keyboard. The screen message informs the user that EuroBEEB is still being accessed. PAGE 30 (d) Returning to the BBC Micro Pressing gives a '*' prompt on the monitor screen. Typing BASIC or B. immediately after the '*' prompt returns control to the BBC micro with BASIC as the current language. This action does not affect the program running in EuroBEEB which will run its 'natural' course whether the user is in EuroBEEB or not. (e) The BREAK Key Pressing the BREAK key on the BBC Micro causes a BREAK on the BBC Micro, but this is not transmitted to the EuroBEEB. However, because a 'break' on the BBC micro causes the screen to be cleared, the user may be deceived into thinking that this has had an effect on the EuroBEEB. It has not! (f) Disk Commands The standard BBC DFS commands apply to EuroBEEB, i.e. to load a BASIC program into EuroBEEB, simply type LOAD "filename". In fact, all the disk commands are supported in the normal way. However, before issuing a disk command, the user must ensure that he has first accessed EuroBEEB. For further information on the disk filing system, please consult your DFS manual. The user may note some delay in loading and saving programs from EuroBEEB which is due to the fact that these programs have to be transmitted along the serial connector. PAGE 31 11. When you are satisfied that the equipment is correctly assembled and switched on, type *EURO, and you should see the following start-up messages M0SB.3 #0 8K BASIC > If any other sideways ROMs are present , their start-up titles will also be displayed. If you now type you should see a prompt on the screen. Now type HELP EURO and you should see the following information on the screen: *HELP EURO EURO NET 1 shift function keys: fO BBC computer *command fl Select new stations f 2 Poll all stations f 8 software RESET current stations f 9 hardware RESET all stations PAGE 32 fO - is a link to the BBC operating system * command f 1 - network station select . Prompts the user to type a new station number, 0 - 31. The default station number is 0. f 2 - poll all stations This creates a Mode 7 colour /alphanumeric display showing the status of all stations fitted. f 8 - send software reset to current station only f 9 - send hardware reset to all stations PAGE 33 Note on Developing EuroCUBE-65 If you are developing EuroCUBE-65 via the BBC Micro, ensure that memory socket MO is fitted with the MOS EPROM incorporating the machine code monitor (MOSM. 3) . Typing *EURO will call up the machine code monitor which will enable you to carry out several diagnostic functions (see chapter on the Machine Code Monitor) . PAGE 34 SOME SIMPLE PROGRAMS When you have connected up your EuroBEEB, try a few simple programs . These programs will only function with EuroCUBE-65 if BBC BASIC is fitted* 1. EuroBEEB (with M0SM.3) (a) PRINT TIME Try this a few times* The number currently held in the elapsed time registers will be displayed* Each unit represents 10 ms. (b) *HELP - This will give the MOS version and the PDs present* *HELP CUBE - If the CUBE monitor PD is included, this will list the monitor commands and syntax. *FX 0 - This will give the date and issue number of the MOS-B. PAGE 35 (c) Draw a curve 10 MODE 0 20 FOR X-0 TO 1023 STEP 4 30 MOVE X,0 40 DRAW 1023.X 50 NEXT >RUN (d) Save this to disk >SAVE "curve" (e) Try to load it: >NEW >L0AD "curve" >LIST PAGE 36 PROGRAMMING BBC BASIC is supplied as a 16kB ROM® When fitted to EuroBEEB, all programming facilities are supported* together with such calls to the operating system as can be supported by the hardware available. When used with the EuroBEEB Colour Teletext card* the display is compatible with that of the BBC Microcomputer in Mode 7. A machine code assembler is included in BBC BASIC. However , we strongly recommend the use of ADE for machine code development. This ROM-based package runs in the BBC Micro and provides a full disk-based Assembler and Screen Editor (SYSTEM. Software* Sheffield; ADE - 16K ROM + Manual. Available from Control Universal). PAGE 37 DEVELOPMENT 1. BASIC Program development is carried out in the same manner as on the BBC Micro itself. The main difference is that the program is held in CMOS RAM and will thus be protected during power-down. Nevertheless, it is still good practice to save the program to disk at regular intervals to protect from accidental erasure or overwriting of the program. Special considerations are necessary when designing for an EPROM-based program. With a RAM-based program, BASIC variables are stored immediately above the BASIC program. Thus the first line of any EPROM-based program must use the BASIC command words LOMEM and HIMEM to assign part of the RAM for use by BASIC. PAGE must point to the first EPROM address. Take an example using a standard EuroBEEB fitted with 8K CMOS RAM (0-&1FFF), 8K EPROM (&2000-&3FFF) , BBC BASIC and M0SB.3. On power-up PAGE is automatically set to &0E00. Thus the first commands should be: >PAGE=&2000 >RUN The EPROM-based program will now run. Its first line should be: 10 LOMEM-&OEOO :HIMEM-&2000 PAGE 38 This relocates the BASIC storage area to the 8K RAM. However, every time the system is powered down, it will need the start-up commands entered again via the serial link. This is obviously unacceptable in a stand-alone target application. In this case, the commands will be placed in the Autorun line and executed automatically (see below, and also Appendixes 8 and 9 for more details) . In order to LIST the program in EPROM, HIMM must be relocated above the program text spaces >PAGE=&2000 >HIMEM=&8000 >LIST See Appendix 8 for details of EPROMing a BASIC program. PAGE 39 2. Machine Code The on-board BASIC assembler may be used for small machine code routines . In most cases, however, it will be more efficient to use an Assembler or Cross-assembler running in a host system. The most common configuration for 6502 Assembly language programming would be ADE (SYSTEM Software, Sheffield) fitted to the BBC Micro. The source text would be prepared and assembled in the normal way on the BBC Micro, the assembled object code being sent to a disk file. This may then be down-loaded to EuroBEEB for testing, using *L0AD [
] » PAGE 40 The on-board BASIC may be used to run the machine code using CALL
. Memory locations may be changed and examined using the BASIC indirection operators , ? and ! (see p. 409 of the BBC Micro User Guide). The optional CUBE Monitor PD provides more extensive facilities for testing and debugging machine code on EuroBEEB, including breakpoint handling. The Monitor also contains the driver routines for the CU-PROM EPROM programmer, as well as the immediate commands *CL0CK and. *DATE , which send the current real-time clock value and date to the screen (see chapter on the Machine Code Monitor) . .y r: . NOTE Oi iay t ;, s33v or PA. =&2000 RUN &FF PAGE 43 This will point EPROM at &2QG0, program. As a stored ass to a BASIC program resident in initialise and then run that sequence of hex bytes, it would be 50 41 47 45 3D 26 32 30 30 30 GD (or 50 41 2E 3D 26 32 30 30 30 0D) 52 55 4E 0D FF Any other start-up commands, such as LQMEM and HIMEM, which are necessary to relocate the BASIC variable storage area, should be contained in the first lines of the user^s program. See Appendix 9 for initialisation tables. PAGE 44 PART III: SOFTWARE MACHINE OPERATING SYSTEM MQSB.3 Introduction The EuroBEEB/EuroCUBE Operating System holds the input and output drivers, system subroutine calls, and the serial filing system. Version 3 has been enhanced to contain the drivers required by Control BASIC. This allows the user to access digital and analog I/O from high level 'BASIC' type commands (see section on Control BASIC for more details). The software has been written to provide the necessary environment for the operation of BBC BASIC in EuroBEEB/EuroCUBE. However, the BBC BASIC is not essential, and the user interested in developing his programs in another high level language or In machine code can use the system subroutines by issuing the appropriate calls. The MOS may also contain peripheral drivers which are software modules interfacing a peripheral to the EuroCUBE CPU card. Examples are: 1. System Video Drivers compatible with the language's graphics commands, i.e. drivers for either the high-resolution graphics card CU-GRAPH or the TELETEXT card. 2. Peripheral Drivers to decode external keyboards PAGE 45 Version 3 of the MOS represents a significant enhancement of M0SB.2 which it replaces. MOSB. 3 is supplied in a 16kB 27128 EPROM. A memory map of the 16kB of the address space occupied by MOSB. 3 is shown below. Memory Map arrangement FFFF_ FOO0__ EDOO E000 Machine Operating system version 3 including Control NET* 8 i k [, [,] ] where X and Y are optional and default to zero. PAGE 53 They are accessed from BASIC as shown above, e.g. *FX 3,1 (enable RS-423 driver) . They can also be accessed directly from machine code, using the OSBYTE (&FFF4) passing A, X and Y from the registers of the 6502, e.g. using the same call: LDA#3 : LDX# 1 : JSR &FFF4 PAGE 54 OSBYTE Calls Implemented in MOSB.2/MOSB.3 Summary dec hex function 0 0 Print operating system issue 1 1 User OSBYTE, read/write &281 2 2 Select input channel 3 3 Select output channels 7 7 Select RS-423 baud rate 8 8 as 7 13 D Disable events 14 E Enable events 15 F Flush selected buffers 21 15 Flush specific buffer 0-21 make o ii >-> 22-116 are : not used by OS 119 77 Close any SPOOL or EXEC files 124 7C Clear ESCAPE condition 125 7D Set ESCAPE condition 126 7E Acknowledge ESCAPE 127 7F Check for End of File 128 80 Get buffer status/Analog conversion 129 81 Read input channel within time limit 130 82 Read machine high order address PAGE 55 dec hex function 131 83 Read top of OS RAM (PAGE) 132 84 Read top of program RAM (HIMEM) 133 85 as 132 136 88 Perform *C0DE 138 8A Insert character into buffer 142 8E Enter language ROM 143 8F Issue PAGED ROM service 145 91 Get character from buffer 150 96 Read from I/O &FEOO 151 97 Write to I/O &FE00 152 98 Examine buffer status 153 99 Insert character into input buffer 156 9C Read/Write 6551 Control reg 166- -255 A6-FF Read/write OS RAM variables &236-&28F PAGE 56 The following is a brief summary of the changes between M0SB.2 and MQSB . 3 : *FX22 is a digital bit handler. *FX23 is digital port initialisation. *FX155 , 156 is read/write UART command and control registers respectively. *FX247 contains the station's own number *FX248 contains the network's currently selected station number ^FX249 9 250 3 251 are CMOS battery-backed variables not affected by resets. PAGE 57 The following variable calls have been modified &C0 6551 (ACIA) Control Register &E7 INT. mask for CLOCK &EB CLOCK present flag &F2 6551 (ACIA) Command Register &F3 ROM 16 start page (for peripheral drivers) PAGE 58 OSWORD Calls When subroutines require more than two parameters, the OSBYTE call is inadequate. In this situation the OSWORD call is used. This has a parameter block in RAM which is pointed to by the X and Y registers. The X (low byte) and Y (high byte) form a 16~bit address . The parameter block can contain as much data as is required. The A register again specifies which call is being used. From BASIC DItl block 15 X% = block Y% = block DIV 256 A% = 14 : REM read clock CALL OSWORD Users should consult the User Guide or Advanced User Guide for a full description of OSWORDS, Calls 0 to 4 are Implemented and work as described in the BBC User Guides. Calls 14 and 15 will read and write to the CLOCK if it is fitted (Issue 5 EuroBEEB/EuroCUBE onwards). The parameter block is described in the section on the Real Time Clock. Note that a null value, &FF, can be entered when writing to the CLOCK, in order to leave certain values unchanged. PAGE 59 In M0SB.3 the following QSWQRBs are also implemented i 0 SWORD 5,6 fifth parameter specifies paged ROM number, OSWORD 16 starts sampling sequence, OSWORD 17 reads back a sample, OSWORD 18 write to a D/A converter. PAGE 60 Filing System: Available Commands * SPOOL *EXEC *HELP *FX *LOAD *SAVE *CAT *OPT *CODE Any unrecognised command will be passed back to the BBC Micro for processing*. For examp le , *DRIVE 1 will cause drive 1 to be selected. Paged ROMs M0SB.3 supports Paged ROMs . A new version of CUMEM, CUMEM Selecta, has been developed to provide hardware support for ROM paging. This will allow up to 8 ROM/ RAM devices to be paged into the 16K language space at &8000 to &BFFF. The use of battery-backed CMOS RAM will also be possible. PAGE 61 Interrupts : IRQ Handler Before attempting to use interrupts, the user should be thoroughly familiar with Chapters 12 and 13 of the Advanced User Guide for the BBC Micro. In particular, users should note that interrupt service routine which are initiated by intercepting IRQ IV or IRQ2V: 1 • should not in general end in RTI . This is ¦ handled by the Operating System, so JSR (OLDVEC) is preferred. OLDVEC contains a copy of the original contents of the interrupt vector. 2. should not in general make OS calls. If it is essential to use an OS call, check very carefully what it does before using it . IRQ IV Points to MOS-B IRQ handler which (&204) carries out: 1. Check AC I A receive , transmit , and handshake 2. Check VIA Timer T1 3. Check CLOCK 4. JMP (IRQ2V) IRQV2 Points to RTI (Vector to user IRQ (&206) routine may be placed here) PAGE 62 Events Events provide the user with a pre-packaged interrupt. The Operating System may generate an event (see list below) , and the user is then able to add his own code to the system interrupt service routine. An example of this is given in the Timer program in the Appendix. Event Cause of Event Number 0 1 2 3 4 5 6 7 8 9 output buffer empty input buffer full character enters input buffer ADC conversion complete (not implemented) start V. sync. (not implemented) event timer at zero ESC condition detected RS-423 error detected (lower 3 bits of status of ACIA in X register, serial character in Y register) CLOCK event - status register of CLOCK in X User event PAGE 63 Reset Reset can only be performed on EuroBeeb using which generates a Break condition on the serial input line. The BREAK key on the BBC Micro will have no effect on EuroBeeb, The Reset sequence is as follows : - RTI is placed at &DQQ - SEI is executed - Reset system vectors in RAM - Initialise system variables WARMS tart : OSBYTEs &A6-&EE All flags and pointers except TIME COLDstart : OSBYTEs &A6-&FF All flags and pointers - Initialise OS zero page workspace - Perform software Reset on VIA - Initialise ACIA and reset BUSY line to allow serial data input - Test for CLOCK present and set flag - Initialise Paged ROMs and load type table to RAM, - Make service calls to Paged ROMs and claim workspace - Load startup string to output buffer. - Make initialisation service call to Paged ROMs - CLI is executed - Enter Language ROM WARMstart : Current Language COLDstart : Language with highest socket value PAGE 64 The following are further changes inplemented in M0SB.3: OSARGS and OSGBPB are serial filing commands added. PTRJ, EXT# now work from BASIC. FORTH uses OSGBPB to load screens. Event 5 Y=0 centisecond event Y-&FF event timer crossing zero Keyboard Vector KEYV which is used by the OS for keyboard access is implemented for CU-KEY 99. ROMs Currently Supported BBC BASIC DDFS FORTH (modified Skywave FORTH) EXMON (Beebug) PAGE 65 Control BASIC Extension Introduction Control BASIC is supplied as standard in all MOSB. 3 versions for EuroBEEB and EuroCUBE-65 , i . e. MOSM. 3, MOST. 3 » M0SC.3 and M0SJ.3. It occupies almost 4K of code in the OS EPROM from &E00Q upwards. Simple BASIC type words such as SAMPLE , DELAY, etc, are included in the Control BASIC extension to simplify the interface of high-level language to hardware. Users have appreciated the implementation of "ADVAL" , and these extra words go further along the same line. If the BASIC Interpreter does not recognise a word, it attempts to look it up in the variable list. If the word cannot be found there , it is passed on to the Control BASIC extension. The word is tested to see whether it belongs to the extension. This produces a convenient, if slow, method of extending the BASIC Interpreter. PAGE 66 Channel Identification Control BASIC words work on "channels" of which there are two types: those concerned with digital access and those concerned with analog access. 1. Digital Access The digital commands relate to a Versatile Interface Adaptor (VIA) which can be positioned anywhere within the memory. The ports on this VIA are described in Control BASIC as 'channels' , with Port A representing channels 0-7 and Port B channels 8 - 15. If one or more VIAs are added, up to a maximum of 16, the VIA addressing must be contiguous. The second VIA would take channel numbers 16 to 31, etc. The maximum number of channels is 256 (0 to 255 inclusive). If the VIAs are not contiguous in memory they can still be used, but the pseudo variable BASE, must be redefined if the VIA to be accessed is changed. PAGE 67 2o Analog Access The analog inputs/outputs are treated in a similar manner to the digital inputs/outputs . Analog/ digital conversion Board decode channels 0 - 7 for 1st CUBAN-12 &DCGQ ff 8 - 15 II 2nd CUBAN- 12 &DC20 16 - 23 1! 3rd CUBAN- 12 &DC40 II 24 - 31 II 4th CUBAN-1 2 &DC60 II 32 - 63 (for Integrating CUBAN-12) II 64 - 79 18 1st CUBAN-8 &DBQ0 IS 80 - 95 II 2nd CUBAN-8 &DB40 If 96 _ 111 If 3rd CUBAN-8 &DB8Q If 112 - 127 If 4th CUBAN-8 &DBC0 Digital/analog conversion channels 0 - 3 for 1st CUBAN-12 &DC00 If 4 - 7 f! 2nd CUBAN- 12 &DC20 fl 8 - 11 ff 3rd CUBAN-12 &DC40 If 12 - 15 n 4th CUBAN-12 &DC60 ff 16 - 63 (for Integrating CUBAN-12) If 64 for 1st CUBAN-8 &DBG0 II 65 ff 2nd CUBAN-8 &DB40 13 66 If 3rd CUBAN-8 &DB8Q If 67 If 4th CUBAN-8 &DBC0 PAGE 68 ON/OFF and Logic Levels At RESET, all VIA channels default to input, and their output lines take the 'logic high state' (+5V). To this effect, 5V is defined as OFF (FALSE) and OV is defined as ON (TRUE) . This represents a xogical inversion, but has been implemented In this manner so that all outputs are turned off at RESET. The maximum channel number is recorded, and the error Bad channel' will result if this is exceeded. Summary Logic state Output voltage ON/OFF In Control BASIC TRUE/ FALSE (BASIC) 1 +5V OFF FALSE (0) 0 OV ON TRUE (-1) Scaling All analog values are treated as 16— bit variables and are scaled appropriately. For example, a 12-bit analog input will appear to have a reading between 0 and 65520 (&FFFQ) and will increment in steps of 16. The 8-bit converter input will have the same scale but will increment in steps of 256. The same is true of the analog output channels. This means that the language mathematics is the same for 8-bit and 12— bit operations, since the scaling has already been carried out. PAGE 69 Use of the ID Character Control BASIC words may require an ID character to identify them, depending on the type of statement. This character serves to distinguish the Control BASIC word from a BASIC variable. It can be any non-alphanumeric character such as ( , & X # etc. The ID character is ONLY required when the BASIC extension word is on the left-hand side of an assignment statement, i.e. on the left-hand side of an equals sign. Examples OUT. 4 = 1 DAC//3 = &F0 DATE$~ - "05:3:85" For simplicity and appearance we suggest that the full-stop character " is used. Please note that the underline character , which is often used in procedure names in BBC BASIC, is also treated as an alphanumeric by the Control BASIC extension. Therefore, it should NOT be used as an ID character . If the extension BASIC word is NOT on the left-hand side of an assignment statement, the ID character must NOT be used. Examples C$ = CL0CK$ PRINT WEEK If the ID character is not used, e.g. OUT 4 = l BASIC will assign the value 1 to the variable 0UT4 PAGE 70 Control BASIC Extension Words Control BASIC Extension Words have four variations 1. Commands with respect to a VIA stack 2. Analog I/O commands 3. Real-Time Clock commands 4. Timing command Summary of Extension Words Digital BASE. =
OUTCH INCH TURNON TURNOFF FLIP OUT . = =IN PAGE 71 Analog DAC. = =ADVAL SAMPLE , ,
, { channel) =SAMPLE , Real-time Clock Commands CLOCK? .= DATE? . =» DAY . = WEEK. = =CLOCK? =DATE? =DAY =WEEK Timing Command DELAY PAGE 72 1* Commands with respect to a VIA stack BASE Syntax; BASE. -
set VIA start address Example : BASE. - &FE00 Sets the VIA base address at &FE00 which is the VIA on the CPU card. (This is the default value.) NOTE; (a) An ID character, in this case " , must be used. (b) BASE is a pseudo variable. Statements such as PRINT BASE have not been implemented . PAGE 73 OUTCH Syntax: OUTCH define channels as output Example : OUTCH 0 TO 3 Defines channels 0 to 3 as ouputs . INCH Syntax: INCH define channels as input Examp le : INCH 5,6 Defines channels 5 and 6 as inputs. PAGE 74 TURNON Syntax: TURNON turn ON output channels Example : TURNON 12 Turns ON channel 12 , if defined as an output . This sets the outputs, physically, to OV. See note on logical inversion of digital I/O. TURNOFF Syntax : TURNOFF turn OFF output channels Example : TURNOFF 10,13 TO 15 Turns OFF channels 10,13,14 and 15, i.e. these channels will physically output a nominal output of +5V (i.e. logic high) if defined as outputs. PAGE 75 FLIP Syntax: FLIP invert state of output channels Examp le : FLIP 2 TO 4 Will change the state of channels 2, 3 and 4 from ON to OFF or vice versa. PAGE 76 OUT Syntax: OUT. = write TRUE or FALSE Examples : OUT. 12 = TRUE OUT. 12 = 1 OUT. 12 = &FF All three statements turn ON channel 12 if the channel is defined as an output . OUT. 13 = Valve% Will turn channel 13 ON or OFF depending on the value of the variable Valve%. If Valve% is zero (or FALSE), the channel will be turned OFF (output voltage set high). If Valve% does not equal zero (TRUE), the channel will be turned ON (output voltage OV) . Note the use of the ID character with OUT. PAGE 77 IN Syntax: = IN read TRUE or FALSE Example : Switch-state% = IN 3 The variable Switch-state% takes the value of -1 (TRUE) if the input channel 3 is ON (physically OV on the input). Alternatively, the variable Switch-state% takes the value of 0 (FALSE) if the input channel is in the OFF state (nominally +5V). PAGE 78 NOTES: (a) All channels default to inputs. (b) can refer to individual channels, a group of contiguous channels , or a combination of both. (c)
refers to a decimal number. Hex numbers must be prefixed with . (d) Use of the VIA ports Users should note that when a channel is defined as an output, the output takes the value of whatever happens to be in the corresponding bit of the output register ORA or ORB at the time. The contents of these registers are not changed if the port is changed to an input, since the input registers IRA and IRB are physically distinct from the output registers ORA and ORB. Therefore it is sound practice to define the output registers before defining a channel as an output . For example, the sequence 2000 TURNOFF 0 TO 7 2010 OUTCH 0 TO 7 would be preferable to sequence 2000 OUTCH 0 TO 7 2010 TURNOFF 0 TO 7 PAGE 79 because in the latter sequence , after the execution of the OUTCH statements the outputs are temporarily unknown, unless the program has kept track of the state of the outputs. Depending on the actual hardware configuration, this could be highly undesirable if not actually disastrous. (e) Only Port A and Port B in the VIA are supported. Summary of VIA address and channels Name VIA offset Channels Port A 1 0 to 7 Port B 0 8 to 15 VIAs are assumed to be at &10 intervals up to a maximum of BASE 4- &FQ PAGE 80 Analog I/O Commands DAC Syntax: DAC. = write analog value Example 1: DAC. 3 = &F0 will send the hex value FO to the digital to analog converter which in this case will be on the first CUBAN --12. The actual output voltage will be scaled to a 16 bit variable (max &FFF0) as a fraction of the reference voltage. Example 2: DAC. 5 = output-voltage will cause the DAC to output a voltage whose value depends on the BASIC variable output-voltage. PAGE 81 ADVAL ADVAL is a BBC BASIC statement that allows analog readings to be read into BASIC variables . It has been implemented for CUBAN-8 and CUBAN-12, the CUBE 8-bit and 12-bit analog to digital converter cards, and uses the OSBYTE 128 call. Syntax: = ADVAL read analog value where can be any BBC variable and is the channel number on the device in question . Example: Depth%= ADVAL(64) will read the scaled value of the analog input to channel 64 (1st channel of CUBAN-8 at &DB00). ADVAL in BASIC is equivalent to: OSBYTE 128 read ADC channel where X = channel 0 - 127 Y is ignored PAGE 82 This returns a 16-bit converter value in X,Y (X - LSB s Y = MSB) read from the channel specified by X. Channels 0 to 31 provide access to four CUBAN-12 cards, and channels 64-127 to four CUBAN-8 cards. Channels 32 to 63 are not used. The address decode on the CUBAN-8 or CUBAN-12 must be set as follows: CUBAN-12 DC 00 channels 0-7 DC20 88 8-15 DC 40 88 16-23 DC60 88 24-31 CUBAN-8 DB10 88 64-79 DB50 88 80-95 DB9G 88 96-111 DBEO 89 112-127 To write to an analog output channel OSWORD 18 is used. PAGE 83 SAMPLE Syntax : SAMPLE , ,
, {TO } defines parameters and starts Sampler Example; SAMPLE 1QQG, 1024 s &2000, 3 will read 1000 samples at intervals of 1024 microseconds from channel 3® These values will be stored in memory starting at location &20Q0. The readings are stored as 2 byte integers. Syntax: = SAMPLE , read back a sample Example: Temperature= SAMPLE 204, 3 assigns the value of the 204th sample taken on channel 3 to the variable Temperature. PAGE 84 NOTES 1. Sampling takes place as a background task, i.e. the main program continues and the samples are fed into the appropriate memory locations as they are taken under interrupt. For a complete description of the sampling process refer to the OSBYTE/OSWORD command summary. 2. Samples may be stored in sideways RAM using either CY-DRAM or CUMEM Selects. Please refer to the OSBYTE summary for further details. PAGE 85 3. Real-Time Clock Commands CLOCK$ Syntax: CLOCK$. = sets the real-time clock (hours, minutes and seconds) Example : CLOCK$.= "23:9:30" sets the clock to 23 hours 9 minutes and 30 seconds . Syntax: =CLOCK$ reads the real-time clock (hours, minutes and seconds) to a BASIC string variable Examples : PRINT CLQCK$ prints a string in the form hh:mm:ss representing the current time. PRINT LEFT $ ( CL0CK$ , 2 ) ; " hours" PAGE 86 DATE$ Syntax; DATE$ . = sets the current date as date, month, year Example ; DATE$. ="04: 11:85" sets the date to the 4th of November 1985=, Syntax: =DATE$ reads the current date into a string variable Example: Year% = EVAL (RIGHT $ (DATE $ , 2 ) ) PAGE 87 DAY Syntax: DAY.= sets the current day in the week in the real-time clock Examp le : DAY«= 3 Syntax : =DAY reads a number representing the current day in the week from the real-time clock Examp le : 10 DIM day$(7) 20 FOR I%=1 TO 7 30 READ day$(I%) 40 NEXT 50 PRINT TAB (20,0) ; "Today is 11 % day $ (DAY) ; "day" 60 END 70 DATA Mon , Tues , Wednes , Thurs , Fr i , Satur , Sun >RUN Today is Friday > PAGE 88 WEEK Syntax: WEEK. = Example: WEEK. =23 makes the current week number 23, as stored in the real-time clock. Syntax: = WEEK assigns the value of the WEEK register in the real-time clock to a BASIC numeric variable. Example : This-week=WEEK NOTE: The ALARM function is not implemented. PAGE 89 4 . Timing Command DELAY Syntax: DELAY causes a delay of a given number of centiseconds Example : DELAY 250 causes a delay of 250 centiseconds (or 2.5 seconds) before the next instruction is executed. PAGE 90 Real-time BASIC For critical applications, we strongly recommend the use of Real-time BASIC which is a fully tokenised extension. The new statements and functions found in Control BASIC are also found in Real-time BASIC so that programs written in Control BASIC can easily be converted to run in Real-time BASIC with the advantage of a much higher speed of execution. The typical execution time of a statement in Control BASIC is 18 ms, whereas in Real-time BASIC this is reduced to 1.8 ms - virtually indistinguishable from BBC BASIC itself. As the title suggests. Real-time BASIC also offers time-related statements such as WHEN clock$ = "5: 30 i 00" PROCgohome WHEN KEY = 13 PROCcarriage-return Real-time BASIC is available only as a sideways ROM. Sideways ROMs may run either on CUMEM Selecta (a sideways RAM/ROM board) or Doublestore (a floppy disk controller card with a sideways facility) . PAGE 91 OSBYTE/OSWORD Command Summary OSBYTE 22 (&16) digital channel control X = channel Y register contains a number specifying the action required; 0 turn OFF 1 turn ON 2 def ine channel as input 3 define channel as output 4 invert channel 5 read a channel When asked to 'read a channel', X returns TRUE (1) or FALSE (0). PAGE 92 OSBYTE 23 (&17) define VIA base On entry, X, Y point to an address which is the base address of a VIA, allowing the VIA to be placed anywhere in memory. OSBYTE 128 (&80) read analog input (equivalent to ADVAL in BASIC) Syntax: = ADVAL X = channel 0 - 127 Y ignored Returns 16-bit converter value in X,Y (X = LSB, Y - MSB) . PAGE 93 0 SWORD 16 (&10) start a sample sequence SAMPLE N%,R%,S%,K% 0 SWORD 16 calls up the Sample Vector SAMPLV to initialise the sample sequence when Timer 1 is loaded with the correct interval and interrupts are enabled. The sampling itself takes place under interrupt . The sample Vector is called with A=2 (take a sample). On return the number of samples is compared to the total required. The working counter is incremented unless it is equal to the number of samples required, in which case the sampling sequence is complete. The sample data can be read with OSWORD 17. For example: SAMPLE 1000, 100,&4000, 3 Sample Channel 3 1000 times at an interval of 100 /is and store the results from starting address &4000. PAGE 94 Parameter block Integer byte no. XY integer N% integer R% 0^ 1 2 number of samples (0 to 32,000 with CY-DRAM) 3 J o' 1 2 ’ 3 . sampling interval (100 - 2*31 /is) integer S% 0 * 1 p 2 3„ start address for data channel specifiers K % 0 first channel no. for ADC 1 last channel N% number of samples 0 - N% inclusive N%, the number of samples, can be from 0 to 2,147,483,647. Please note that each sample requires 2 bytes of RAM for data storage. The maximum number of samples is therefore determined by the total RAM. For example, for 16K of RAM, N% could be 0 to 8192. When using one CY-DRAM, this number could be up to 32K. PAGE 95 R % sampling interval The interval can be programmed to values from 100 us to 2 '’'31 /is (approximately 30 minutes). The sample program works in two modes. Intervals greater than, or equal to, 1024 /is produce a background sampling operation using interrupts. For example, if the program specified that 1000 samples be taken at an interval of 1 second, the task would take more than 15 minutes to complete. However, because the task is being performed under interrupt, the main program can continue to run. OSWQRD 18 provides a method of testing for end of sampling sequence (see under 0 SWORD 18). The 'Bad rate' error is produced on the screen if the interval for a single channel is LESS than 100 /is. 'Bad rate' is also produced if more than one channel is specified AND the sampling interval is LESS than 1024 /is. Intervals exceeding 1024 /is would probably be used for data acquisition, where data is collected at periodic intervals for later analysis. If the intervals are programmed to be less than 1024 /is, the Sampler carries out its task immediately, disabling interrupts. For example, if 1000 samples are taken at 1000 /is intervals, the program will stop for 1 second while the samples are being taken. During this time, all other interrupts will be ignored, BASIC TIME will be stopped, and any information coming in from the serial port will be missed. PAGE 96 Also, when the interval is less than 1024 /us, the converter always fills up the memory to a RAM page boundary, starting a new page every time 128 samples have been collected. Intervals of less than 1024 /is are used for high-speed waveform sampling. A rate of 10 kHz (100 /is) should allow speech to be sampled. For example, 32000 samples collected at an interval of 100 /is would produce 3 seconds of speech. Minimum Times against Number of Channels 0-1023 /is 1 1024 /is 2 2048 /is 4 4096 /is 8 channel channels channels channels will NOT allow more PLEASE NOTE: Less than 1024 /is than one CY-DRAM card to be used. The above restrictions are physical limitations of the 1 MHz 6502 microprocessor, and the speed at which it is able to execute instructions. PAGE 97 S % start address for data 1= Normal RAM start address 0-&FFFF normal 6502 memory space data saved at address address is incremented after each sample For example. Save 200 samples into &4000 N% =200 Start address = &4000 The address will increment up to &4000 + 200*2. PAGE 98 2. CY-DRAM Available only on the following MOS versions: MOSM.3-0, MOST. 3-0, MOSC.3-0, and M0SJ.3-Q. CY-DRAM is a paged RAM existing from &40Q0-&7FFF. For each CY-DRAM card, four 16K blocks are present. These can be individually switched into the above memory space. The sampling software automatically deals with the CY-DRAM switching. The extra memory is defined as starting at &1Q0Q0. &1Q0QQ - &1FFFF first CY-DRAM (switch at 0) &20000 - &2FFFF second CY-DRAM (switch at 1) etc « For example, save 32000 readings in CY-DRAM: SAMPLE 32000, 100 ,& 10000, 3 N% = 32000 R% = lOO^is sampling interval S % = &100Q0 start at beginning of CY-DRAM The Sampler always leaves the CY-DRAM pointing to its first 16K block (e.g. &10000-&14000) . This can be used as normal RAM (e.g. &4000-&7FFF) , if the Sampler is only used from &14000 onwards. Only one CY-DRAM can be used for intervals of less than 1024 ^lis. PAGE 99 3. Sideways RAM Sideways RAM on CUMEM Selecta (sideways RAM/ROM board) exists from 8000-BFFF. Using option 0, CUMEM Selecta can take eight 8kB RAMs which appear as four 16kB blocks. With SW2 set to position 0, these 16kB blocks appear as Pages 0,1,2, 3. The sampling software automatically deals with the CUMEM Selecta switching. The extra memory is defined as starting at &10000. &10000 - &1FFFF first 16kB block &20000 - &2FFFF second 16kB block etc. For example, save 32000 readings in CUMEM Selecta; SAMPLE 32000, 100, & 10000, 3 N% = 32000 R% = lOOjis sampling interval S % = &10000 start at beginning of CUMEM Selecta. PAGE 100 K% channel specifiers For example: channel = 5 SAMPLE 1000,100,6.4000,5 (a) K%?0 (byte 0) first channel number for ADC The peripheral driver actually calls the ADVAL (OSBYTE 128) command when taking a sample. The channel number is the same for ADVAL. ADVAL is a utility that allows the BBC BASIC command ADVAL to operate with CUBAN-8 and CUBAN-12 (see under ADVAL) . (b) K%? 1 (byte 1) last channel For example: First channel = 5 Last channel = 7 SAMPLE 1000,1024,6.4000,5 TO 7 If the last channel is less than or equal to the first channel, only the first channel is sampled. For example, if T%?1=0, the last channel is ignored. If the last channel is greater than the first channel and the interval exceeds 1024 /is, multi-channel sampling will occur. The readings from the first to the last channel inclusive will be stored from the start address at sampling times. PAGE 101 NOTES As discussed , the 'Bad rate' error is produced if more than one channel is specified, and and the sampling interval is less than 1024 jis. Consequently, high frequency multi-channel sampling is NOT possible. In any case, the 6502 microprocessor would not be able to cope with that speed. In practice, five channels can be sampled at 1024 ^is , ten at 2048, etc. PAGE 102 0 SWORD 17 (&1 1 ) read back a sample Sets A = 1 and calls SAMPLV (read a sample). X,Y points to the OSWORD' s parameter block. Syntax: = SAMPLE N% , XY N% channel result% If a reading has not been taken, resuit% will equal -1 (&FFFFFFFF) . For example, if 200 samples were being taken at 1 second intervals, one could test for the end of conversion by calling OSWORD 17 with N% — 200, until the result% becomes positive. If N% equals 7 and OSWORD 17 was called, result% would equal -1 for the first 7 seconds. The result would become valid once the seventh sample had been taken. The readback channel is compared with the specified channels when the sampler was invoked. An error message 'Bad channel' will result if the channels do not match. sample required 0 - 2 T 31 reading returned in result% PAGE 103 Examples: (a) SAMPLE 1000, 100, 6.4000, 3 = SAMPLE 24,3 (b) SAMPLE 1000,2000,6.4000,3 TO 4 = SAMPLE 50,3 = SAMPLE 50,4 If the user wishes to call the 0 SWORD directly, he must set up the parameter block, i.e. : .block EQUD 6. 00 00 00 80 ; number of samples EQUD & 00 00 06 00 ; sampling interval (ps) EQUD 6. 00 00 20 00 ;start address EQUD 6. 00 40 ; channel 64 = start LDX # block MOD 256 LDY # block DIV 256 LDA # 6.10 JSR 0 SWORD RTS The sampling itself takes place under interrupt . PAGE 104 0 SWORD 18 (&12) analog output channel Syntax; DA C# = Parameter block: XY 0 channel 1 least significant data to be output 2 most significant data to be output DAG channels 0-3 " " 4-7 " " 8-11 " 12 - 15 " 64 - 67 for 1st CUBAN-12 for 2nd CUBAN-12 for 3rd CUBAN-12 for 4th CUBAN-12 for 1st to 4th CUBAN-8 If the OSWORD is used, the user must set up the parameter blocks For example, to write to the DAC on CUBAN-8 in 6502 machine code: LDX # block MOD 256 LDY # block DIV 256 •data EQUB &64 EQUB &00 EQUB &FF LDA # &12 JSR OSWORD ; channel number ;low data byte ;high data byte PAGE 105 SAMPLE VECTOR, S AMPLY The Sample Vector, SAMPLV (equivalent to INDV1 on the BBC), is used in conjunction with OSWQRBS 16 and 17® SAMPLV indirects through &230. Its action depends on the accumulator contents on entry i.e. A=1 Read a sample where X,Y point to a parameter block defined for OSWORB 17® A=2 Take a sample X, Y point to SAMBLK (described above in OSWORB 16). A=3 initialize a sample sequence X, Y point to SAMBLK (described above in OSWORB 16). PAGE 106 PERIPHERAL DRIVERS Introduction The EuroCUBE-65 CPU can drive a number of peripherals, thus giving the user a wide choice for his applications. Examples of popular peripherals include: CU-GRAPH (high-resolution graphics display) Teletext (a simpler text display with chunky graphics ) CU-KEY (QWERTY keyboard) Although this flexibility is desirable from the user's point of view, it poses problems for the designer of the machine operating software. To cater for all the possible hardware combinations, the same number of combinations would have to be provided for in the operating system, which would then require more EPROM space than there is available. This problem can be overcome by standardising the operating system software for the CPU card and separating out the software modules controlling the individual peripherals. These software modules are known as peripheral drivers. PAGE 107 The following are standard options: 1) Machine Code Monitor (MGSM.3 1 & 2 MHz) 2) CU-GRAPH 4- CU-KEY 99 (M0SC.3 1MHz) 3) Teletext 4- CU-KEY 99 (MOST. 3 1 & 2 MHz) 4) Viewline/Rackprint/ CU— KEY 25 (MQSJ.3 1 & 2 MHz) All versions include drivers for the CUBAN-8 and CUBAN-12 ADC boards, invoked by the ADVAL(x) command in BASIC. The operating system and the peripheral drivers together provide the interface between the language (in this case BBC BASIC) and the hardware present. The advantage for the user is that he can write his application software in a manner that is largely independent of the hardware. PAGE 108 PERIPHERAL DRIVERS Operation Commands not understood by the operating system are passed to the peripheral driver(s) for action. The following example will serve to illustrate the sequence of events in response to a command to evaluate the voltage in Channel 3: e.g. volts = ADVAL (3) Sequence : 1) The language has interpreted ADVAL, evaluated the channel and called the operating system, using the OSBYTE call with A=128 X=channel (in this case 3) 2) The operating system looks up this OSBYTE call; cannot find it and so offers it to the peripheral driver. 3) The peripheral driver recognises it and actions it. 4) The hardware converts the voltage in channel 3 into a digital 16 bit word. 5) The peripheral driver reads the resulting word and returns the word back to the operating system. PAGE 109 6) The operating system returns the words back to the language. 7) The language makes volts = returned word. PAGE 110 The Effect of RESET When EuroBEEB is reset (using SHIFT f 9) , the peripherals are also given hardware reset signals. However, they may also be given software reset signals. Peripheral cards are tested for their presence and flagged back to the operating system. The flags are then used to stop calls being made to non-existent cards. The reset gives the peripheral the chance to claim RAM space, set up its variables and modify any operating system vectors, e.g. the VDU Vector (VDUV) in the case of CU-GRAPH. The peripheral driver software is implemented using the standard Paged ROM structure (see Chapter 15 of the Advanced User Guide for the BBC Microcomputer for more details); 00 No operation - used to accept call 01 RAM claim 02 Private RAM claim 03 Initialise peripheral 04 Unrecognised command 05 Unrecognised interrupt 06 BRK inform 07 Unrecognised OSBYTE 08 Unrecognised OSWORD 09 HELP 0A Static workspace 0B NMI release 0C NMI claim 0D Onward for filing system For example, ADVAL uses 3 and 7, the Monitor uses 4 and 9 . PAGE 111 Peripheral drivers can also intercept calls from any of the other system vectors, e.g. 1) Gall any standard operating functions or calls 2) Divert output stream, e.g. unrecognised VDU channel 3) Insert values into keyboard buffers 4) Modify system variables and vectors PAGE 112 The CUBE Monitor The CUBE Monitor is designed to help users develop machine code programs. It can be used to examine memory contents and the state of I/O ports. The CUBE Monitor, supplied in MQSM.3, comes as standard with EuroBEEB and EuroCUBE-65 unless another M0SB.3 variant is specified. Only M0SM.3 contains a machine code monitor. If a monitor is required with any of the other MOSB. 3 variants, then the Monitor is also available as a Paged ROM (2764) called SIDEMON (see chapter on MOSB. 3). The presence of the Monitor PD can be verified by typing *HELP when you have accessed the EuroBEEB. The following message should be displayed: *HELP Control BASIC Analogue CUBE Monitor 3.1 CUBE M0SM.3 #0 8K The Monitor has a language entry point as well as a service entry point. It uses service calls 03, 04 and 09 : 03 Initialise 04 Unrecognised command 09 HELP Initialise deals with the breakpoints and gives warm and cold breakpoint initialisation. PAGE 113 The HELP call gives access Co the Monitor commands . Type *HELP CUBE (or the abbreviation and you should see the following list of Monitor commands on the screen: HELP CUBE MEX SP [,] " ["] H hold CR next - previous RDUMP CRC , RTEST ./ FILL , [ , ] RCOPY / RVERIFY , , GO SUB / GOTO / CALL [] BREAK [] [ , ] ] REGS / BRKS REG A X Y P ST PC MOFF NMI PROM / MON CLOCK / DATE In order to function, all these commands must prefixed by *, e.g. *MEX. All commands can abbreviated , and the minimum abbreviation is given for each command listed. PAGE 114 Definition of parameters; hex address source address destination address 1 or 2 digit hex byte any number of alphanumeric characters; any character is acceptable but will terminate the string same as 4-digit hex length single digit number one of the four 6502 Registers Spaces and commas act as delimiters. The provision of data in square brackets is optional. Whenever incorrect data or non-hex numbers are entered, a 'Syntax?' error message is displayed on the screen. A range specified by two addresses is inclusive of those two addresses. PAGE 115 *MEX Memory examine Minimum abbreviation *ME. This displays the specified address and its contents in binary, ASCII and hexadecimal, and waits for a subcommand to be given. (NOTE; It is not necessary to include leading zeroes in the address, e.s. you can type in &MEX5A instead of &MEXQ05A) . For example, if you type *MEX3000 you might see someting like this; 3000 01000100 D 44 The expected subcommands may be any of the following; (1) SP [ ,] Press SPACE bar and enter new hex byte. (2) " ["] Enter the desired string preceded by a quotation mark, and press to terminate it. (3) - (minus) Step back to previous location. (4) CR (CARRIAGE RETURN) Step on to next location. Press to exit from the *MEX command. PAGE 116 (5) H (hold) The function of hold is best demonstrated on the VIA timer. You can display the location of the VIA timer by typing in *MEXFE05. This will show you the address of the VIA and its status in binary and in hexadeximal, e.g. FE05 00011001 0B However, the status of the timer is continually changing, and if you wish to examine this change you can press H to display the current status at that time. If you want to obtain a record of the status changes on the screen, press continuously. Press to exit. PAGE 117 *RDUMP Mini muni abbreviation *RDU. This displays a screenful of memory from the specified address in hexadecimal and ASCII format. If you change to a higher resolution screen mode, e.g. Mode 0, and then type *RDUMF, this will use the greater area to display more memory. This is because *RDUMP first ascertains the screen mode by sending an OSBYTE to the BBC Micro via the serial port . *CRC , Cyclic Redundancy Check Minimum abbreviation *CR. This allows you take the 'signature' of an EPROM. For example if you type in *CRC 8000 BFFF there will be a short delay before you see the signature =4274 of the BBC BASIC ROM. PAGE 118 * PILL , [ , Minimum abbreviation *FI. This command fills the specified memory block with the specified data. For example *FILL 1000 1FFF 3 *RDUMP 1000 fills the specified memory block with threes and then displays the result. PAGE 119 *RTEST ,[ , Destructive RAM test Minimum abbreviation *RT. This writes through the whole area of RAM to be tested with the chosen byte and then verifies what it has done. This process is carried out in a total of six write and verify cycles. In the first write cycle, the first and every subsequent third byte are inverted. In the second write cycle, the second and every subsequent third byte are inverted. In the third write cycle the third and every subsequent third byte are inverted. For example: *RT. E00 1FFF 55 AA 55 55 AA 55 55 AA 55 55 etc. 1st write cycle 55 AA 55 55 AA 55 55 AA 55 etc. 2nd write cycle 55 55 AA 55 55 AA 55 55 AA etc. 3rd write cycle The test byte is then inverted and the test is rerun: 55 AA AA 55 AA AA 55 AA AA etc. AA 55 AA AA 55 AA AA 55 AA etc. AA AA 55 AA AA 55 AA AA 55 etc. If no test byte is specified, zero is assumed. Zero is recommended for testing for noise, particularly in dynamic RAM, while test byte 55 is suitable for testing bits. PAGE 120 *RCOPY ,, Minimum abbreviation *RCOP • This copies the area of memory (specified by ) from the source address to the destination address inclusive. *RVERIFY ,, Minimum abbreviation *RV. This compares the specified area of memory from the source address with that at the destination address. If there is a discrepancy between the two areas of memory , the locations in questions will be displayed on the screen. PAGE 121 * BREAK [ [ , Minimum abbreviation *BR. This commands sets the specified breakpoint at the desired address. For example; * BREAK 3 3002 will set breakpoint 3 at &3002 . To clear the breakpoint again, type: * BREAK 3 (i.e© without an address) Breakpoints are placed when the commands *G0T0 , *G0SUB and *CALL are entered. They are removed on return from a ^GOSUB or on a warm restart© Even if the program 'crashes', the breakpoints will be removed on 'warm' reset to enable testing to continue by reloading the object code file. *BRKS Minimum abbreviation *BRK. This command displays the current saved breakpoints: 0 0000 1 0000 2 0000 3 0000 4 0000 PAGE 122 *REGS Minimum abbreviation *RE. This will print out the 6502 saved registers: A X Y P ST PC 00 00 03 00 F4 0000 To specify the registers: *A *X *Y *ST *PC Accumulator Index Register X Index Register Y Processor Status Register Stack Pointer Program Counter *REG will put the specified hex data into a specified register 9 i.e. *REG A B5 will put the hex value B5 into the accumulator. PAGE 123 *GOTO [] Minimum abbreviation *GOT. This takes all saved registers, loads them into the microprocessor and starts executings For example, if there was a machine code routine resident at &3000, *GOTO 3000 would load the processor's registers , go to the specified address and. start executing the machine code routine until it reached a breakpoint. At this point the monitor will display the current state of the program registers and return to the monitor prompt. It will be noted that the program counter now contains the address of the breakpoint. The program can be made to continue from here by simply typing *G0T0 (without an address). The display registers will be loaded into the microprocessor as before, and the program will continue from the address in the program counter. The facility to continue after a breakpoint is provided by an intelligent breakpoint handler in the monitor which only places the breakpoints when the command *GOTO is typed. It also removes them when a breakpoint is reached or when the reset button is pressed. In this way the machine code program under test should remain intact. If the GOTO address is the same as a breakpoint address the breakpoint is not loaded, thus making it possible to continue with the program. PAGE 124 *GOSUB [] Minimum abbreviation *G. This works in the same way as *G0T0 9 except that it does not load the stack pointer (ST). It loads the value required to return to the monitor when the machine code instruction RTS is executed. In this way subroutines can be tested. If a breakpoint is encountered s the monitor behaves the same as with the *GOTO command,, and it is possible to continue with the program as described above. *CALL [] Minimum abbreviation *CAL. This is the same as *GQSUB. However , when a breakpoint is encountered , the monitor displays the registers and automatically continues. In this way all five breakpoints can be displayed in one test. *CALL prints out a breakpoint and continues* whereas *GOTO stops at a breakpoint. PAGE 125 The Use of Breakpoints: Example *MEX1000 1000 ........... _A9 , 00 ; LDA #0 1002 ........... _A2, 01 ; LDX #1 1004 ........... __A0, 02 ; LDY #2 1006 ........... _38 ; SEC 1007 ........... _18 ; CLC 1008 _60 ; RTS This simple program loads the A, X and Y registers with 0, 1 and 2 respectively and then sets and clears the carry flag. set registers A, X, Y and P to FF PC = 1000 * BREAK 0 1002 *BREAK 1 1004 * BREAK 2 1006 *BREAK 3 1007 *BREAK 4 1008 *A FF *X FF *Y FF *? FF *PC 1000 PAGE 126 *BRKS will display set breakpoints *REGS will display processor registers *G0T0 the monitor will first breakpoint display the A X Y P ST PC 00 *G0T0 FF FF 7F F4 continue 1002 A X Y P ST PC 00 01 FF 7D F4 1004 etc . Now reset the registers A and X to FF: *A FF *X FF Try *CALL 1000 Note that it is optional whether you specify the address in *G0T0 , *G0SUB or *CALL other than by using the program counter . All the breakpoints will be displayed; A X Y P ST PC 00 FF FF 7F F4 1002 00 01 FF 7B F4 1004 00 01 02 7D F4 1006 00 01 02 7D F4 1007 00 01 02 7D F4 1008 PAGE 127 *MOFF/*MON Minimum abbreviation Monitor off /Monitor on This command will rarely be used in practice, but it enables the user to switch off the monitor in cases where the Monitor commands conflict with, say, the DFS commands. *mi If the processor NMI line is connected to ground through a normally open switch, *NMI allows the inspection of registers after a crash. The command *NMI is entered from the keyboard. If a crash subsequently occurs during program development, then making the switch will cause the processor registers to be dumped on to the screen. PAGE 128 *PROM Minimum abbreviation *PR. This command calls up the EPROM programmer and should display the following information on the screen ; Eprom Programmer 1.0 (C) ATPL DEVICE ?__ When you have entered the number of the device you wish to use, e.g, 2764, the screen will display: SELECT 21 VOLTS .... fit link K BLOW : READ : VERIFY : CLEAR Enter initial letter Further information can be found in the documentation accompanying the EPROM programmer. PAGE 129 *CLOCK/*DATE These commands send the current time and date to the output channel . If you have set the clock with the BASIC program provided in Appendix 4 or on the utilities disk, try displaying the time and date continuously by typing in the following program: 5 CLS 10 REPEAT 20 PRINTTAB ( 1 2 , 1 0 ) ; : *CL0CK 30 PRINTTAB (12,11);: *D ATE 40 IF INKEY 100 50 UNTIL FALSE >RUN PAGE 130 APPENDIX Is MEMORY DECODING Standard Maps M4 and 1/02 Two fusable link PROMs are used to decode the processor address lines® For the 6502 EuroCUBE these are labelled 'M4' and *1/02'® Great effort has been made to provide a wide variety of address maps® A table of standard maps is shown overleaf: PAGE 131 I/O Block I/O Page Typical Dse o < 4J CQ u 03 H O 4J o 03 y & M < O Prf 3 Ed O Ed O o a) fa •H t-2 00 iJ 00 H Q w fa vO fa vO <5 fa Ed Ed Ed Ed Ed fa Pd Ed Ed Ed Ed w Ed Ed Ed Ed Pd Ed Ed Ed Ed Ed O O © O O O o O o o o o pa Ed Ed Ed Ed Ed fa Ed Ed Ed Ed fa Id Ed Ed Ed Ed Ed Ed Ed Pd fa Ed Ed Ed Ed Ed Pd Ed Q Q G3 Ed Ed Ed O O O O O © O O O o o o o o o o o o o Q Q Ed ea Ed g Ed ON ©1 Ed Ed O Pm © Pm Ed PS Ed erf Ed Ed CO Ed CO Ed Ed "d Ed vO Ed v© •M Ed t Ed 1 Ed 1 AJ Ed Ed '**' i-3 fa O O O kJ 1 . 1 . 1 O PQ O PQ O Ed O Ed rH © <5 O CO O CO O CO O CO O CO e3 o co O o CJ o u o cd CO o so O to O Q ¦K X * X * x 33 w a Ed X Em pa X u y y > X X X > •H o © o •H a erf erf erf c 13 © Ed CJ Ed CJ Ed CJ Ed Ed «— i fa Ed M Pm W Pm Ed o fa Ed CO Pd CO o r-. fa fa . PQ < 33 so Erf 3 O Erf O vD CH © Erf CM CO fa r— X > r— ! M S'""* X 1 s* 8 c 3 NOT empty 6 1 DSR HIGH = NOT ready 0 DSR LOW = ready Transmission occurs when: (a) DSR = LOW, i.e. the other (receiver) terminal is ready. (b) Transmitter Data Register is NOT empty. In MOSB . 1 the receive/transmit software is programmed as above. In MOSB. 2 and MOSB. 3 the receive/transmit software is a fully buffered, interrupt-driven module. PAGE 148 APPENDIX 5 USE OF THE Am26LS29, 30, 31 and 32 QUAD DRIVER/RECEIVER FAMILY IN ESA RS-422 AND 423 APPLICATIONS By David A. Laws ercS Roy J. Levy INTRODUCTION Today's high-performance data processing systems de- mand significantly faster data communications rates than are possible with the EIA RS-232 specifications in use for the past ten years. Two new standards prepared by the Electronic Industries Association address this need. EIA RS-423 is an unbalanced, polar voltage specification designed to interface with RS- *.32C, while greatly enhancing its operation. It permits the communication of digital information over distances of up to 2000 feet and at data rates of up to 300 Kilobaud. EIA RS-422 is a balanced voltage digital interface for com- municaton of digital data over distances of 4000 feet or data rates of up to 10 megabaud. Advanced Micro Devices has developed a family of monolithic Low-power Schottky quad line drivers and re- ceivers to meet the requirements of these specifications. The Am26LS29 and 30 line drivers and the Am26LS32 re- ceiver meet all requirements of RS-423 while the Am26LS31 differential line driver and the Am26LS32 re- ceiver meet the requirements of RS-422. A second receiver element, the Am26LS33 is available for use in high common mode noise environments, exceeding the common mode voltage requirements of RS-422 and RS- 423. This application note reviews the use of these devices in implementing the new standards. Emphasis is given to the EIA RS-422 balanced interface. EIA STANDARD SPECtFIGATOfSS Two basic forms of operation are available for transmission of digital data over interconnecting lines. These am the single ended and differential techniques. The single-ended form uses a single conductor to carry the signal with the voltage referenced to a single return conduc- tor. This may also be the common return for other signal conductors. Figure la. The single-ended form is the simplest way to send data as it requires only one signal line per circuit. This simplicity, how- ever, is often offset by the inability of this form to allow discrimination between a valid signal produced by the driver, and the sum of the driver signal plus externally in- duced noise signals. A solution to some of the problems inherent in the single- ended form of operation is offered by the differential form of operation. Figure 1b. This consists of a differential driver (essentially two single-ended drivers with one driver always producing the complementary output signal lev®! to the other driver), a twisted pair transmission line and a differen- tial line receiver. The driver signal appears as a differential voltage to the line receiver, while the noise signals appear as a common mode signal. The two signals, therefore, can be discriminated by a line receiver with a sufficient common mode voltage operating range. The Electronic industries Association, EIA, has defined a number of specifications standardizing the interface be- tween data terminal equipment and data circuit terminating equipment based on both single-anded and differential op- eration. Page 149 Use of the Am26LS29, 30, 31, and 32 The most widely used standard for interfacing between data terminal equipment and data communications equipment tod 3 y, is EIA RS-232C, issued in August 1969. The RS-232C electrica. interface is a single-ended, bipolar-voltage, unter- minated circuit. This specification is for serial binary data interchange over short distances (up to 50 feet) at low rates (up to 20 Kilobaud). It is a protocol standard as well as an electrical standard, specifying hand shaking signals and functions between terminal and the communications equipment. As already noted, single-ended circuits are sus- ceptible to all forms of electromagnetic interference. Noise and cross talk susceptibility are proportional to length and bandwidth. RS-232C places restrictions on both. It limits slew rate of the drivers (30V/yxs) to control radiated emission on neighboring circuits and allows bandwidth limiting on the receivers to reduce susceptibility to cross talk. The length and slew rate limits can adequately control reflections on unterminated lines, and the length and bandwidth limits are more than adequate to reduce susceptibility to noise. Like EIA RS-232C, the new EiA RS-423 is also a single ended, bipolar-voltage unterminated circuit. It extends the distance and data rate capabilities of this technique to distance of up to 4000 feet at data rates of 3000 baud, or at higher rates of up to 300 Kilobaud over a maximum distance of 40 feet. EIA RS-422 is a differential, balanced voltage interface capa- ble of significantly higher data rates over longer distances. It can accommodate rates of 100 Kilobaud over a distance of 4000 feet or rates of up to 10 megabaud. These performance improvements stem from the advantages of a balanced con- figuration which is isolated from ground noise currents. It is also immune to fluctuating voltage potentials between sys- tem ground references and to common mode electromag- netic interference. Figure 2 compares the driver output waveforms for the three EIA standard configurations, while Table I compares the key characteristics required by drivers and receivers intended for these applications. Since RS-232C has been in use for many years, RS-422 and 423 parameter values have been selected to facilitate an orderly transition from existing designs to new equipment. a) EIA RS-232C Generator Output. b) EIA RS-422 Generator Output. R|_ = 3KQ to 7Kn V ss min. = ±5V; V S s max. = = Time duration of the unit interval at the applicable modulation rate = O.Hq when to 3= 200ns = 20ns when to < 200ns c) EIA RS-423 Generator Output. V ss = Difference in steady state voltages Vss = |v, - V,| V ss min. = 2V; V ss max. = 6V Vss - |Vt - V,| V ss Difference in steady s;ate voltages V55 min. = ±3.6V; Vss max. = ±6V Figure 7 Driver Output Waveforms. Page 150 Use of the Am26LS29, 30, 31, and 32 TABLE f KEY PARAMETERS OP EIA SP£C!HCATtO«S Characteristics EIA RS-232C ESA RS-423 ESA RS-422 Units Form of Operation Single Ended Single Ended Differential Max. cable length 50 2000 4000 Feet Max. data rate 20K 300K 10M Baud Driver output 6 volts voltage, open ±25 ±6 between Volts (Max.) circuit* outputs Driver output 2 yolts Voits (Min.) voltage, Loaded ±5 to ±15 ±3.6 between output* outputs Driver output resis- Ro = 30011 100/i.A between 1G0,u,A between Min. j tance power off Driver output short -6 to +6V +6 and -,25V circuit current 1 S q ±500 ±150 ±150 mA (Max.) Driver output slew 30 V//x sec Max. Slew rate must be No control rate controlled based necessary upon cable length and modulation rate Receiver input 3K to 7K Ik* •*? A\ / 5=4K 11 resistance Rj n Receiver input -3 to +3 -0.2 to +0.2 -0.2 to +0.2 Voits (Max.) thresholds Receiver input voltage -25 to +25 -12 to +12 -12 to +12 Volts (Max.) ± indicates polarity switched output. INTEGRATED CIRCUIT CHARACTERISTICS Most semiconductor manufacturers offer integrated circuits designed to satisfy the old RS-232C standard. A number of them have designs in progress to meet the new EIA specifica- tions. Products available from Advanced Micro Devices to meet these needs are shown in Table II. The Am26LS29, 30, 31 and 32 are a family of quad drivers and receivers designed specifically to meet the new EIA stan- dards. These products utilize Low-Power Schottky technol- ogy to incorporate four drivers or four receivers, together with control logic, in the standard 16-pin package outlines. T he Am26LS29/30 and the Am26LS32 are driver and receiver s designed to implement the single-ended EIA RS-423 ‘•'•^andard. The Am26LS31 is a differential line driver designed for use with the Am26LS32 receiver in a differential mode to meet EIA RS-422. Am26LS29 AMD Am26LS30 QUAD RS-423 LINE DRIVERS The Am26LS29 and 30 consist of four single-ended line driv- ers designed to meet or exceed the requirements of RS-423. The buffered driver outputs are provided with sufficient source and sink current capability to drive 50 ohm to a virtual ground transmission line and high capacitive loads. The Am26LS29 has a three-state output control while the Am26LS30 has a Moae Control input that allows it to operate as a dual RS-422 driver (with suitable power supply change- s). Figure 3. Each of the four driver inputs, as well as the Enable/Mode Control input is a PNP Low-Power Schottky input for reduced input loading, one-half the normal fan-in. Since there are two inverters from each input to output, the driver is non- inverting. When operating in the RS-423 mode, the Am26LS29 and 30 require both + 5V and -5V nominal value power supplies. This allows the outputs to swing symmetri- cally about ground - producing a true bipolar output. The Mode Control (Pin 4) of the Am26LS30 should be Hi or tied to TABLE » ADVANCED MICRO DEVICES' EIA COMPATIBLE DEVICES ESA Standard Drivers R@©®8¥@rs RS-232C Am 1438 Quad Driver Am9616 Triple Driver with logic control Am2616 Quad Driver also specified for CCITT V. 24 and MIL-133C Am 1489, 143SA Quad Receivers with response control pin AmS617 Triple Receiver with optional hysteresis Am2617 Quad Receiver specified over MIL range RS-422 Am26LS31 Quad Differential with three-state control gating Am26LS32 Quad Differential Driver single-ended Receiver RS-423 Am26LS29 Quad Driver with three-state output Am26LS30 Quad Driver with slew rate control Am26LS32 Quad single-ended/ Differential Receiver Page 151 Use of the Am26LS29, 30, 31, and 32 V cc Each output is designed to drive the RS-423 load of 50 ohms with an output voltage equal or greater than +3.6 volts in the HI state and —3.6 volts in the LO state. Each output is current limited to 150mA max. in either logic state. A Slew Rate control pin is brought out separately for each output to allow output ramp rate (rise and fall time) control. This pro- vides suppression of near end cross talk to other receivers in the cable. Connecting a capacitor from this node to that driver's respective output will produce a ramp (10% to 90%) of 50ns typical for each picofarad of capacitance in that capacitor. RS-423 establishes recommended ramp rates ver- sus length of line driven and modulation rate. Figure 4. The Am26LS30 can be used at low data rates as a dual EIA RS-422 driver with three-state outputs by connecting the V EE supply and the mode control input to ground. Page 152 Use of the Am26LS29, 30, 31, and 32 Am2@LS31 QUA© RS-422 DRfVBl The Am26LS31 is a quad differential line driver designed to meet the RS-422 specification while operating with a single +5 volt supply. A common enable and disable function con- trols all four drivers. Figure 5. The driver features high speed, de-skewed differentia! outputs with typical propagation de- lays of 12ns and residual skew of 2ns. Both differential line outputs are designed for three-state operation to allow two-way half duplex and multiplex, data bus applications. Table III is a summary of the essential requirements of the RS-422 standard. Section A describes the key characteristics satisfied by the Am26LS31 driver. The balanced differential line driver consists of two halves, each of which is similar to a Low-power Schottky TTL gate with equal source and sink current capability. The two halves are emitter coupled in a differential input configuration. One h© of the input circuit is tied to a fixed TTL bias threshold J the other side is tied to a sink diode in normal DTL/TTL '^rashion. This configuration offers complementary outputs with very low skew, dependent only upon component match- ing, a necessity to meet RS-422. Figure 4. Data Modulation Rate or Cable Length Versus Risetime for E1A RS-423. The circuit diagram of the driver is shown in Figure 6. The emitter-coupled input circuit is formed by 02 and 03, which are biased by a current source. This source is a current mirror, formed by 01 which supplies the current, and 08 which is diode connected transistor matched to Q1 . The # lx®d bias for 03, formed by D5 and D8, is 2V g£ . A 2Vgg bias, lees the D2 Schottky diode drop, provides tfo® normal L©«f-fj©w©r Schottky TTL threshold, V tL = 0.7V. R19 provides a boost to 0.8V for a full 400mV TTL noise margin. The differential outputs of the emitter coupled stage, A and A, drive emitter followers Q14 and Q15, which provide the required speed and matching characteristics. The emitter followers, drive phase splitters Q4 and 05, which in turn drive totem-pda outputs. The outputs at the line interface are of standard Low-power Schottky TTL configuration, except that circuit values are modified to provide high sourcing capability. The outputs are designed to source or sink 20mA each, so that they can generate a voltage of at least 2.0V across a 100 ohm load, as required by RS-422. Additional circuitry has b@en included to make the line outputs three-state for two-way bus applications. The Am26LS31 meets the RS-422 require- ment that the driver not load the line in the powered down condition {l x lOO^tA) or if the power supply to that device should fail. Am26LS32 QUAD RS-422 Am 423 RECEIVER The Am26LS32 is a quad line receiver which, operating from a single 5 volt supply, can be used in either differential or single-ended modes to satisfy RS-422 and 423 applications respectively. A complementary enable and disable feature, similar to that on the driver, controls all four receivers, Figure 7. The device's three-state outputs, which can sink 8mA, incorporate a fail-safe input output relationship which keeps the outputs high when the inputs are open. The Am26LS32 meets the receiver input specification of Table ill, a 200 mV threshold sensitivity with common mode rejection exceeding the supply line potentials, (greater than 7 volts). The same design feature of the input circuit which provides the common mode rejection also insures excellent power supply ripple rejection, which is important whan switching the high currents involved in a system's interfaces. Furthermore, unlike operational amplifiers, where the DC common mode and power supply rejection ratios roll off with open loop gain, the full rejection capability of this line receiver is maintained at high frequencies. The receiver hys- teresis of typically 30mV, provides differential noise immuni- ty. Signals received on long lines can have slow transition times, and without hysteresis, a small amount of noise around the switching threshold can cause errors in the re- ceiver output. INPUT INPUT INPUT INPUT ENABLE ENABLE D C B A Figure 5. Am26LS31 Logic Diagram. Page 153 Use of the Am26LS29, 30, 31, and 32 TABLE SIS SUMMARY OF EIA RS-422 STANDARD FOR A BALANCED DIFFERENTIAL INTERFACE A. Line Driver Open Circuit Voltage (either logic state) Differential |V d0 | =s 6.0V Common Mode |V C mol 555 3.0V Differential Output Voltage (across 100 ohm load) Either logic state |V d | 3= max (0.5V do , 2.0V) Output Impedance Either logic state Rq « 100 ohms Mark-Space Level Symmetry (across 100 ohm ioad) Differential |V dS | - |V dM | 0.4V Common Mode |V cm sl - l v cmMl ^ 0.4V Output Short Circuit Current (to ground) Either Output |l sc ]« 150mA Output Leakage Current (power off) Voltage Range -0.25V =s V x +6.0V Either Output at V x |lxi 100/i.A Rise and Fall Times (across 100 ohm load) T = Baud interval (t r , tf) =£ max (0.1T, 20ns) J Ringing (across 100 ohm load) i Definitions Vdss = V d (steady state) V S s = V dS -V dM (steady state) Limits (either logic state) Percentage iV d - V dSS | =s 0.1V S s Absolute 2.0V |V d | 6.0V B. Line !R@csiv@s- Signal Voltage Range Differential |V d | « 6.0V Common Mode |V c m! ^ 7.0V Single-Ended Input Current (power ON or OFF) Either Input at V x I V x |= 10V Other Input Grounded |iv| ^ 3.25mA Single-Ended Input Bias Voltage (other input grounded) Either Input Open Circuit ' |V B | 3.0V Single-Ended Input Impedance (other input grounded) Either Input R|_ ^ 4000 ohms Differential Threshold Sensitivity Common Mode Voltage Range |V cm | 52 7.0V Either Logic State |V T | ^ 200mV Absolute Maximum Input Voltage Differential |V d | 12V Singie-Ended |V X | « 10V Input Balance (threshold shift) Common Mode Voltage Range |V cm | « 7.0V Differential Threshold (500 ohms in series with each input) Either Logic State |V t | 400 mV Termination (optional) Total Load Resistance (differential) Rj > 90 ohms Multiple Receivers (bus applications) Up to 10 receivers allowed. Differential threshold sen- sitivity of 200mV must be maintained. Hysteresis (optional) As required for applications with slow rise/fall time at receiver, to control oscillations. Fail Safe (optional) As required by application to provide a steady MARK or SPACE condition under open connector or driver power OFF condition. C. Interconnecting Cable Type Twisted Pair Wire or Flat Cable Conductor Pair Conductor Size Copper Wire (solid or stranded) 24 AWG or larger' Other (per conductor) R « 30 ohms/1000 ft. Capacitance Mutual Pair C =s 2QpF/ft. Stray C *£ 40pF/ft. Pair-to-Pair Cross Talk (balanced) Attenuation at 150KHz A 3= 40dB Page 154 Use of the Am26LS29, 30, 31 , and 32 Figure 6. Am26LS31 Circuit Diagram (Only one driver shown). The balanced differential line receiver is a three-stage circuit. The input stage consists of a low-impedance differential cur- rent amplifier with series resistor inputs to convert line signal voltage to current and provide a moderate input impedance, input resistors provide an impedance greater than 6K on input, power on or power off, which exceeds the re- quirements of RS-422 and RS-423. This is one advantage of the current amplifier input circuit. Another advantage is that is can operate with immunity to common mode voltages above V C c and below ground. The differential threshold sensitivity of this circuit is 200mV, as required by RS-422. The second stage is a differential voltage amplifier, which inter- faces to the single-ended output stage through an emitter follower. The output stage is a standard Low-power Schottky TTL totem-pole output with three-state capability. The full circuit is shown in Figure 8. Resistors R 20 and R 21 / which connect the non-inverting input to Vcc and the invert- ing input to ground, provide the fail-safe feature, which guarantees a HIGH logic state for the receiver output when there is no signal on the line. The differential voltage amplifier in the second stage is formed by Q6 and Q3 which are biased by current source G9. The hysteresis in the re- ceiver switching characteristic is provided by Q4 and Q5, a differential pair biased by current source Q6, whose collec- tors are connected in positive feedback to the input pull-up circuits. A small amount of current is switched by Q4 and Q5, which must be overcome by the different voltage signal, resulting in the hysteresis. The output stage is driven from one side of the differential second stage by emitter follower Q17, which is a multiple emitter transistor, the second emit- ter is the control point for the three-state output.Q17 drives the phase splitter Q12, which in turn drives the three-state totempole output. The remainder of the circuit is the output enable control logic. This three-state capability on t&e re- ceiver TTL side of the interface is a useful feature for mod- ularizing two-way bus design. A mask option of the input resistors (R^ R 2 , R 20 and R 21 ) modifies the receiver characteristics to improve operation in high common mode noise environments. This device, known as the Am26LS33, has these resistors at twice the value of the Am26LS32. An input differential or common mode voltage range of ± 1 5 volts is achieved at the expense of a minor decrease of input threshold sensitivity, to : 500mV from t-200mV. Page 155 Use of the Am26LS29, 30, 31, and 32 Figure 7. Am26LS32 Logic Diagram. Page 156 Use of the Am26LS29, 30, 31, and 32 APPLICATIONS m m > CEO RS-232 AND 422/3 SYSTEMS A system implemented with the RS-422 differential output cannot be used to drive an RS-232C system directly. An RS-423 single-ended, driver, such as the Am26LS29 or Am26LS3Q, may be used provided certain precautions are observed. 1. Although the RS-423 driver output specification of be- tween 4 to 5V does not meet the RS-232C specification of 6V, operation is usually satisfactory with RS-232C receiv- ers. This is achieved because the short cable lengths per- mitted by RS-232C cause very little signal degradation and because of the low source impedance of the RS-423 driver. 2. RS-232C specifies that the rise time for the signal to pass through the ±3.0V transition region shall not exceed 4% of the signal element duration. RS-423 requires much '-v . slower rise times, specified from 10% to 90% of the total signal amplitude, to reduce cross talk for operation over longer distances. Therefore, the RS-423 driver in the equipment must be waveshaped. This is achieved by selection of a capacitor value for the Am26LS30 to simul- taneously meet the requirements of both RS-423 and RS- 232C for data rates covered by RS-232C. 3. RS-423 specifies one common return ground for each direction of transmission, RS-232C requires only one for both directions of transmission. Care must be taken to insure that a return ground path has been created when interfacing between the two systems. 4. RS-232C does not require termination, while it may be necessary for RS-422 and 423. Detailed consideration of termination is covered in the next section. Note that RS-422 and RS-423 specifies that receivers should not be damaged by voltages up to 1 2V, while RS-232C allows drivers to produce output voltages up to 25 V. The A m26LS32 receiver has been designed to avoid this hazard and can withstand input voltages of ±25 volts. RS-422 TRANSMISSION LINE FEATURES Any time a receiver and transmitter are connected with more than a few inches of a wire, problems due to reflections can arise if care is not exercised to terminate the line correctly. RS-422 describes the cable as a twisted pair of approximately 120H impedance terminated in a resistor Ry. Ry is not pecified because there are two extreme values which may - be chosen for the two following general classes of usage: (1) single direction transmission; and (2) multi-direction and multiple source transmission (party line). Considering the cable impedance only, the termination should equal the cable impedance of 12011. However this reduces the termi- nated cable resistance as seen by the driver to only 6011, with resulting loading of the output signal. This loading causes a reduction of S/N ratio at the received terminal due to the decrease in signal voltage swing. The solution lies in a com- promise between an Ry of 12011 which provides maximum power transfer at a reduced S/N ratio or Ry of 24011 which causes a mis-match of 2-to-1 but no S/N reduction. The choice is left to the user as it is system dependent. Both schemes will work for an average line length and should only approach the margins at maximum line length and maximum bit rates. Electronic Industries Association, when preparing EIA Stan- dard RS-422 conducted their tests with 24 gauge twisted pair wire. The resulting length vs. data rate, is published m a guideline in RS-422 (Figure S). This shows two important results: (1) Unmodulated baseband (NRZ) signalling is not recommended at distances greater than 4000 feet; (2) At data Figure 9. Data Rate Versus Cable Length for Balanced, Twisted Pair Cable (From ESA RS-422). rates above about lOOKHz, the maximum cable length for acceptable signal quality is inversely proportional to data rate. Result (1 ) above is due to the DC resistance of the cable. For a 4000 foot cable with a DC resistance of 30 ohms/1 000 feet, the DC series loop resistance is 24011. The minimum allowable terminated differential load impedance is 9011. The DC vol- tage attentuation is 90/(90 — 240) = 1/4(6db), which is arbitrar- ily chosen as the maximum allowable limit. Result (2) is due to line losses. Laboratory tests using the 26LS31 Line Driver connected to the 2SLS32 Line Receiver by 800 feet of ordinary 20 AWG twisted pair (Beidon #8205 plastic-jacketed wire), terminated in its characteristic impe- dance of 1001! were evaluated. The input waveform was a 500KHz square wave with (10% to 90%) rise and fali times of less than 10ns. The output waveform produced rise and fali times which together accounted for approximately one-half the period (t r + t f = 500ns). This was due to line loss and constant capacity. The energy per cycle of the output waveform is approximately 25% lower than that of the input. The input rise and fali times are not a function of line length, assuming matching termination. The output rise and fall times are dependent upon length in a complex manner. Furthermore, it can be shown by observation that they build up along the line. Many good reference sources are available on the subject of transmission lines (References 1, 2, 3 and 4). These will provide background information to the following discussion. Seshadri in Reference (1) has analyzed a line with series resistance losses and has shown that rise time varies with the square of the length. This shows series resistance to bea function of the square root of frequency. However when one tries to use this result in combination with the previous result, it becomes apparent just how difficult the problem is. In Reference (2), the authors point out that skin depth implies a frequency dependent series inductance as well as resis- tance, and that one cannot be considered without the other. Page 157 Use of the Am26LS29, 30, 31, and 32 They go on to show how this leads to the same result; namely that rise and fall times vary with the square of dis- tance. No attetr.pt will be made to explain here why Figure 5 shows maximum length varying inversely with frequency rather than with the square of frequency. Certainly many complex factors are involved. Our laboratory observations showed a dependence somewhere in between linear and square law. The Am26LS31 Quad Line Driver and the Am26LS32 Quad Line Receiver are capable of good, clean operation to the distance limits and data rate limits of RS-422. SYSTEM APPLICATIONS The Am26LS30, 31, 32 and 33 can be combined in various signaling networks. Using Am26LS29, Am26LS3Q and Am26LS32, Figure 10, a unidirectional RS-423 communica- tion can be constructed. Allowing for the voltage variation described earlier, RS-232C requirements can be satisfied. It should be noted that the Am26LS29 or Am26LS30 is used above to meet the bipolar requirements. If a single-ended line, Figu re 1 1 , is required without a bipolar requirement, the Am26LS31 can be used by biasing the reference terminal of the receiver to approximately 1.5 volts. Note that additional resistors will enhance fail safe operation. Figure 1 2 shows the use of the Am26LS31 and Am26LS32 to meet a balanced line, single direction RS-422 application. If bidirectionality is required, an additional termination should be added as shown in Figure 13. Figure 11. Single-Ended Line Without Bipolar Requirement. TWISTED PAIR a) RS-422 Application. b) Improved Fail-Safe Margin. Figure 12. Page 158 Use of the Am26LS29, 30, 31, and 32 Figure 14. Party Line Configuration. a) Full Duplex Four-Wire Data Communication RS-422 Interface (with Data Modem). Am26LS30/32 Am26LS30/32 Am26LS3Q/32 Am26LS30/32 Figu.u 15. Page 159 Use of the Am26LS29, 30, 31, and 32 The high speed capability of RS-422 has attracted the in- terest of many computer designers for use in the party line mode (Figure 14). The most common usage is that of a four wire full duplex exchange system (Figure 15). This mode of operation involves two pairs of wires each han- dling a single direction of traffic. The outgoing direction consists of one driver (Am26LS30 or Am26LS31) and n receivers (Am26LS32 or Am26LS33). The incoming direc- tion consists of one receiver (Am26LS32 or Am26LS33) and n drivers (Am26LS30 or Am26LS31). This seems ex- tremely simple to organize. However, problems arise when system ground is considered. If the network of re- ceiver and driver span a moderate to long physical dis- tance, ground loop noise or differences are developed changing the voltage that appears at the terminals of ail receivers and drivers except for the one driver that is ac- tive. It remains the system reference as long as it is ac- tive. This induced or system developed voltage is referred to as Common Mode voltage (CMV) and as such must be considered as a device parameter. All manufacturers specify CMV capability of their receiver in compliance with RS-422 (approx. 7 volts plus signal) but there is no specification for drivers. If the dimensions of the system are short compared to 1/4 wave length of the maximum date rise and fall times, the CMV can be assumed to be minimal and drivers with single voltage supply and lim- ited negative CMV can be used, i.e., Am26LS31. If the sys- tem dimensions are large, the CMV will cause problems in that the driver will clamp to the ground the moment the collective or apparent voltage swings below minus 0.5 volts relative to the driver ground, causing a short in the line and increasing level shift and noise. The clamping is caused in part by conduction of the l/C substrate diode. The problem can be avoided by using a driver with an output common mode range (Am26LS30). The Am26LS30 guarantees an output CMV range of ±10 volts about the driver ground reference. New international standards are under consideration to specify this mode of operation. In conclusion, a good system of 4 wire full duplex for data communication would use as an outgoing pair an Am26LS30 line driver and up to 12 - Am26LS32 line re- ceivers, with a termination at the near and far ends of the cable. The same system would use as an incoming pair an Am26LS32 line receiver and up to 32 - Am26LS3Q line drivers with only one enabled at a time and all others in three-state mode with cable termination at both near and far ends of the cable. Many other applications are possible using this family of devices. Although the designs are based on the require- ments of the EIA data communications specifications, they are not limited to these situations. Aircraft buses and internal equipment interconnections will benefit from the features offered by these products. REFERENCES 1. Seshadri, S. R., Fundamental of Transmission Lines and Electromagnetic Fields, (U. of Wisconsin), Addison-Wesley, Reading, Mass., 1971. 2. Adler, R. 8., L. J. Chu, and R. M. Fano, Electromagnetic Energy Transmission and Radiation, (MIT), John Wiley & Sons, New York, 1963. 3. Matick, R. E., Transmission Lines for Digital and Communication Networks, (IBM), McGraw-Hill, New York, 1969. 4. Reference Data for Radio Engineers, (ITT), Fifth Edition, Howard W. Sams & Company, Indianapolis, 1974. 5. Electronic Industries Association, 2001 Eye Street, N.W. Washington, D.C., RS Standard Proposal, RS-232C, August, 1969. 6. Electronic Industries Association, 2001 Eye Street, N.W. Washington, D.C., RS Standard Proposal 1220, Rev. RS-422, September 21, 1976. 7. Electronic Industries Association, 2001 Eye Street, N.W. Washington, D.C., RS Standard Proposal 1221, Rev. RS-423, September 21, 1976. Page 160 APPENDIX 6s INTERFACING EIA TERMINAL EQUIPMENT TO THE EuroCUBE-65 SERIAL PORT Introduction The following information will be of use to Control Universal customers who wish to utilise the integral serial port to generate customised asynchronous serial links to their own EIA terminals , or terminal equipment . EuroCUBE-65 may be used in RS-423 mode, which is inter connectable with RS-232. The protocol is asynchronous, i.e. one character at a time using start and stop bits , and an optional parity bit . The ACIA may be reprogrammed for various baud- rates , character length , and parity. Due consideration must be given to the ACIA software drivers on EuroCUBE-65 , whether the drivers are specialised designs or whether the user elects to utilise the standard routines provided in the MQSB.3 EPROM. Serial communications software drivers will be the subject of a future application note. This document explains the physical/ functional interface (level 1 protocol) . PAGE 161 DCE DTE Fig. 8: Typical EIA interface with use of handshake lines ^ 7 \ — -7 CO 3 ' 4 M cd M 0) 4J 0) 4-J O cd 4~i CO M P CO *H ¦U •H 50 pi 50 -*. CO ^ p CO Not Used BCD PIN 8 i Short as DTR PIN 20 required Protective PIN 1 ^ % r Ground PAGE 166 1.2 Euro CUBE (In RS-423) EuroCUBE (In RS-423) Signal EIA DIN Signal Name Connector Connector Name Rx-Data PIN 3 — PIN 1 Tx-Data TX-Data P!N 1 — PIN 3 Rx-Data CTS P!N 5-——“” -—PIN 4 BUSY (RTS) BUSY (RTS) PIN 4 _»__ — PIN 5 CTS OV PIN 2 ————— — PIN 2 OV PAGE 167 2. Interconnection with by-passed handshake 2.1 Terminal Equipment EuroCUBE Signal | EIA Name j Connector DIN Connector Signal Name Rx-Data PIN 2 — — Tx-Data PIN 3 — — CTS PIN 5 1 RTS PIN 4 Signal Ground PIN 7 — — DSR PIN 6 — — - DCD PIN 8 — DTR PIN 20 PIN 1 — — PIN 3 PIN 4 L — - PIN 5 — — PIN 2 Tx-Data Rx-Data BUSY (RTS) CTS OV 2.2 EuroCUBE EuroCUBE Signal EIA DIN Signal Name Connector Connector Name Rx-Data PIN 3 — — — — PI N 1 Tx-Data TX-Data PIN i — _ — PIN 3 Rx-Data CTS PIN 5 “| | PIN 4 BUSY (RTS) BUSY (RTS) PIN 4 ~ J ' — pin 5 CTS OV P!N 2 — — PIN 2 OV NOTE: Pin 1 on RS-232 EIA connectors is termed 'Protective Ground' , and is normally connected to the cable shield (when available) and to the equipment ' Chassis Ground hence to 'Mains Earth' . PAGE 168 APPENDIX 7: CLOCK SOFTWARE Control BASIC contains high-level commands to write to and read the real-time clock. If the user wishes to access the clock via the Operating System, the OSWORDs 14 and 15 can be used. For a clock READ operation the accumulator must contain 14 (&GE) , and the X and Y registers must contain the low and high bytes respectively of the parameter block address . A typical READ operation in BASIC would be: 10 DIM data 15 :0SW0RD=&FFF1 20 X%= data MOD 256 30 Y%= data DIV 256 40 A %= 14 50 CALL 0 SWORD The parameter block itself may be read using the indirecton operators, i.e. 100 PRINT "seconds ",~?data 110 PRINT "minutes ",~data?l 120 PRINT "hours ",~data?2 etc. If you are unfamiliar with these indirection operators, refer to the BBC User Guide p.409. If you are using assembly language routines , these parameters can be accessed by way of indexed addressing. PAGE 169 For a WRITE operation the 0 SWORD call would be made in the same way, except that (1) the equivalent of line 40 in the READ program would become A%=15, (2) the new values to be written into the clock would be. put in the parameter block before the OSWORD call. In a program to change the minutes and seconds but not the hours or date, the parameter block loading routine might look like this : 90 REM load parameter block 100 ?data=00sREM 0 seconds 110 data?l=&30 :REM 30 minutes 120 FOR D%=2 TO 15 130 data?D%=&FF :REM rest unchanged 140 NEXT 150 160 X%=data MOD 256 170 Y%=data DIV 256 180 A%=15 190 CALL OSWORD PAGE 170 NOTE; In the M3000 an update cycle occurs every second and lasts for a maximum of 6 ms. If a READ is performed during the update cycle, the data on the four output pins of the M3000 go high, giving 'F' (1111), The software in the MOS allows for this and waits for the update to be completed. Interrupts are enabled during this waiting period. The clock chip has a complicated data hold time specification during write cycles . During factory testing, any chips failing to write after 20 successive attempts are rejected. For a valid WRITE operation, the data should be read back after the WRITE to ensure that the data has actually been transferred to the clock. See demonstration programs "Clock" and "Timer" for the implementation of this . PAGE 171 Interrupts There are two possible sources of interrupts from the clock, namely the Timer and the Alarm. The Timer produces an interrupt when it changes from 23:59:59 (hours, minutes and seconds) to 00 : 00 : 00 . The Alarm produces an interrupt when the Watch time coincides with that of the Alarm time. This interrupt has to be enabled by setting bit 1 in the status word. Both interrupts are indirected through the event vector (EVNTV) at &220. The relevant event number for both interrupts is 8, enabled using OSBYTE 14 with X set to 8. The response of MOSB. 3 to these interrupts is: 1 . to copy the 4 least significant bits from the status register into the X register. 2. to clear the interrupt flags in the status word. Control then passes to the user's routine via EVNTV. The user can then identify the source of the interrupt from the X register. PAGE 172 Demonstration Software Two programs are supplied to illustrate the programming of the real-time clock. These programs will, of course, only run successfully on the EuroBEEB, not on the BBC Micro. 'Clock"’ allows the watch to be set and then displays the date and time, updating the time every second. This program will run with MOSB. 2 or any version of MOSB. 3. 'Timer-plot' draws a graphics display and at the same time displays a real-time clock which is updated every 5 seconds. This program will NOT run on MOSB. 2. PAGE 173 1 OREM: TITLE ...... Clock. ..... 20 3 OREM CONTROL UNIVERSAL DEMONSTRATION PROGRAM 4 OREM Program displays calendar and clock 50 60X=9 : Y=ll 7 OOSWORD=&FFF 1 :X=9:Y=11: @%=1 80DIM day$ (7) ,month$ (12) ,data (15) , check (15) 90 100FORC=1TO 7: READ day$(C):NEXT 1 1 OFORC= 1T012: READ mont h$ ( C ) : NEXT 120 CLS 130 IN PUT" CHANGE TIME "ans$ 140trys=0 150IF LEFT$(ans$, 1)="Y" PROCsettime 160IF trys>19 PRINT"Write data fault": END 170 180VDU 23; 1 1 9 0; 0; 0; 0:REM cursor OFF 190CLS 200A%=14:REM read clock 210X%=data: Y%=data DIV 256 2 2 ORE PEAT 230S=?data :RE PEAT CALL OSWORD: UNTIL ?data<>S 240 250PRINTTAB (X, Y)"Time 26 OFORC= 2TO OSTEP- 1 : PRO C t ime ( da t a ? C ) 27 OIF C PRINT" : 2 8 ONE XT 290 300PRINTTAB (X, Y+l ) day $( data ?6 ) 310 3 2 OPRINTT AB ( X , Y+2 ) ; 330PROCtime(data?3) 340PRINT" " ; month $ (VALSTR$~'(data?4) ) ; " 19"; 350PROCtime(data?5) 360 PAGE 174 370PRINTTAB(X,Y+3) "Week number "~data?7 380UNTILFALSE 390END 400 410DEF PROCtime(X) 420PRINTX DIV 16;X MOD 16; 430ENDPROC 440 450DEF PROCsettime 460FORC=0TO14 470wr=&FF: IF 07 wr=&80 480C?data=wr sNEXT 490data? 15=1 500PRINT"Week no. 5 1 QPRINT" Week day 520PRINT"Year 5 30PRINT"Month 540PRINT"Date 55 OPRINT" Hours 560PRINT"Minutes 5 70PRINT" Seconds 580 5 9 ORE PEAT : PROCinput ( 7 ) : PROCinput (6) : PROCinput (5 ) : PROCinput (4) : PROCinput (3) : PROCinput (2) i PROCinput ( 1 ) ; PROCinput (0) 600A%=15 : X%=data : Y%=data DIV256 610CALL 0 SWORD 620A%=14 s X%= check :Y%= check DIV256 630CALL 0 SWORD 640F%=1 650FOR C=0 TO 15 660IF data?C<>255 AND data?C<>check?C F%=0 670NEXT 680trys=trys+l 69QUNTXLF% OR trys>19 700ENDPROC 710 720DEF PROCinput (Z) PAGE 175 730INPUTans$ 7 40 IF ans$<>"" data ? Z=E VAL ( "&"+ans $ ) 750IF Z=4 data?Z=EVAL(ans$) 760ENDPROC 770 780DATA Monday, Tuesday, Wednesday 790DATA Thursday , Friday , Saturday , Sunday 800DATA Jan , Feb ,Mar ,Apr ,May , Jun 810DATA Jul , Aug, Sep, Oct , Nov, Dec PAGE 176 10 REM TITLE ...... Timer-Plot 20 30 REM CONTROL UNIVERSAL DEMONSTRATION PROGRAM 40 REM Program produces a graphics display 50 REM and displays the time under real-time 60 REM clock interrupt control. 70 REM Program runs on Euro-BEEB 80 REM (with MOS C.3, J.3,M.3 or T.3) 90 REM with BBC as a terminal. 100 REM Will run on CU-GRAPH if PLOT 85, . . 110 REM is changed to PLOT 5...... 120 130 MODEO 140 PROCdef ine 150 PROCassemble 160 CALL init :CALL start 170 CLS : PROCtime 180 PROCdisplay 190 END 200 210 220 DEFPROCdef ine 230 REM Enable event #8 (Real-time clock event) 240 *FX14, 8 250 0SW0RD=&FFF 1 : evntv=&220 260 VDU23, 1 , 0; 0; 0; 0 ; : REM cursor off 270 @%=2 : REM define number field 280 DIM day$ (7) ,month$(12) ,code 80 290 FOR C=1 TO 7 : READ day $(C): NEXT 300 FOR C=1 TO 12: READ month$ ( C ) : NEXT 310 : 320 DATA Mon , Tues , Wednes , Thur s s Fr i , Satur , Sun 330 DATA January , February , March, April 340 DA.TA May, June, July, August s September 350 DATA October, November , December 360 ENDPROC PAGE 177 370 380 390 DEFPROCassemble 400 FOR PASS% = 0 TO 2 STEP 2 410 P%=code 420 [ OPT PASS% 430 \ Set up clock parameter block 440. block 450 460 470 480 490. flag EQUD &FFFFFFFF EQUD &FFFFFFFF EQUD &FFFFFFFF \ Time-out at 5 seconds EQUD &1 1235955 EQUB 0 500 510 \ Load event vector 5 20. ini t LDA #intrv MOD 256 530 540 550 560 570 580. start 590 600 610 620 630 640 650 660 670 STA evntv LDA # intrv DIV 256 STA evntv+1 \ Set up timer in the Real-time clock LDX # block MOD 256 LDY //block DIV 256 LDA #15 JSR 0 SWORD RTS \ Interrupt service routine \ X contains the 4 Isb's of \ the clock status reg. 680. intrv TXA 690 AND #&08 \ Timer event? 700 STA flag 710.retrn RTS: ] 720 NEXT 730 : PAGE 178 740 ENDPROC 750 760 770 DEFPRQCtime 780 CALL start :REM reset timer 790 time$=CLOCK$ 800 hour s=VAL (LEFT $ ( time$ , 2 ) ) 810 minutes=VAL (MID$ ( time$ , 4, 2 ) ) 820 seconds= (VAL (RIGHT $ ( time$ , 2 ) ) DIV 5) *5 830 af ternoon=hours DIV 12 840 hours =hours MOD 12 850 IF hours=0 hours=12 860 : 870 PRINT " " : REM Remove last time 880 REM Now send time to screen 890 PRINT TAB (0,0); hours;":"; 900 PRINT minutes ; " : " jseconds ; 910 IF afternoon PRINT " PM " ELSE PRINT " AM 1 920 PRINT day $ (DAY) ; "day " 930 PRINT (LEFT $ (DATE $, 2) ) ; " 940 PRINT month$ (VAL(MID$ (DATE$, 4, 2) ) ) ; 950 PRINT " 19"; VAL (RIGHT $ (DATE $» 2) ) 960 970 ?flag=0 : REM Clear the BASIC flag 980 ENDPROC 990 1000 1010 DEFPRQCdisplay 1020 W=PI/15:V=PI/8 1030 GCOL3.1 v ' — 1040 MOVE 640,932 1050 ; 1060 : 1070 FOR Cycle%=0 TO 4 1080 READ A,B :W=PI/A: V=PI/B 1090 K%=A*B*2 1100 FOR Times%=0 TO 1 PAGE 179 1110 MOVE 640,932 1120 FOR I%=Q TO K% 1130 PLOT 85 , 640+480*SIN (W*I%) ,512+420*COS (V*I%) 1140 IF ’flag PROCtime 1150 NEXT 1160 NEXT Times% 1170 NEXT Cycle% 1180 RESTORE 1190 : 1200 : 1210 DATA5 ,7, 15 ,16 ,7, 13, 19, 7,17, 6 1220 ENDPROC 1230 END PAGE 180 8. CREATING BBC BASIC EPROMS FOR EUROBEEB Memory Usage with BBC BASIC: &7FFF HIMEM STACK POINTER LQMEM TOP PAGE BASIC STACK i DYNAMIC VARIABLE STORAGE PROGRAM AREA WORK SPACE PAGE, LOMEM and HIMEM are standard pseudo-variables . BASIC PAGE 181 RAM Storage Definition It can be seen that all variable space sits between LOMEM and HIMEM and furthermore that by default LOMEM is immediately above TOP. Both LOMEM and HIMEM can be easily changed by standard BASIC statements: LOMEM=&xxxx HIMEM=&yyyy This is necessary when the BASIC program is in EPROM since LOMEM will otherwise exist in the EPROM space . When planning to relocate the variable space it is necessary to know how much RAM will be required . As this is dif f icult to calculate , the following method of determination is suggested. Let us assume that RAM exists between &E00 and &1FFF. The program should be run with the first statement (during the development of the application program): HIMEM=LOMEM+& 1200 PAGE 182 This limits the RAM usage to that available when the program is in EPROM. If the 'no room' error is not encountered on running the program, all will be well . However , if the 'no room' error does appear, it will be necessary to compact the BASIC program by using the minimum number of variables , integer numbers instead of floating-point numbers wherever possible , and multi-statement lines separated by EPROM Def inition The M2 memory socket on EuroBEEB is addressed at : &2000 - &3FFF using Map 0 (normally supplied) &40QQ - &7FFF using Map 1 The Maps are memory decoding options and these are described fully in Appendix 1. By default the BASIC variable PAGE is set to &E00„ This is the normal program start. If the application program in EPROM is now located at &2QQ0, PAGE must first be changed to &2000 before the program can RUN. So that this can happen automatically, MOSB . 3 allows the user to program an Autorun line. This is equivalent to typing an instruction on the keyboard . A maximum of 20 characters can be programmed into this line. To provide automatic power-up and run, for example, the Auto run line should contain: PAGE =&2 000 RUN PAGE 183 Programming the EPROMs 1. Application program When the application program is finally developed and de-bugged, it is advisable to commit it to EPROM. Two types of EPROM programmer are available from Control Universal s CU-PROM and ' Sof tlif e" . To program the EPROMs the following procedures are used: (a) CU-PROM The following description applies both to the CU-PROM used with the BBC Micro and to the System CU-PROM which works in conjunction with EuroBEEB. The latter uses software contained within the MOSM. 3 which must , of course, be present. First of all the application program must be loaded from disk into either the BBC micro or the EuroBEEB. This will normally be located at &GEQG on a EuroBEEB and at &1900 on the BBC micro. This is the ' buffer address' requested by the EPROM programmer software. Full instructions on how to use this software are provided in the User Manual accompanying the CU-PROM. PAGE 184 (b) Softllfe This EPROM programmer only works in conjunction with the BBC micro. The only prerequisite with this programmer is that the required application program is held on disk. For full instructions consult the User Manual accompanying the Sof tlif e programmer. 2. Programming the Autorun line This can again be done on the EuroBEEB or the BBC micro and requires 8K of RAM to hold the M0S-B.2 copy. Initially the M0S-B.2 ROM software should be saved to disk using the normal *SAVE command, e.g. *SAVE M0SB.3 C000 0000 Then, in either the EuroBEEB or the BBC Micro , run the program called SFTLFE1 which is included on the utilities disk. This program amends the EPROM file so that it now contains the Autorun line. Finally, the EPROM programmer is used to blow an EPROM copy of L.MOSB. 3 which contains the Auto run line . PAGE 185 Installation of the EPROM The application EPROM should be fitted to memory socket M2. In Issue 5 EuroCUBEs/EuroBEEBs , M2 is supplied linked for a 5565 8K RAM. The following modifications must be carried out to convert to a 2764 8K EPROM; (a) Issue 5 with wire-wrap pins PD At 3 o o © <> p o <> o o «> tJLJLJL? 5565 o © « a © © PAGE 186 ( b) Issue 5 with the standard interconnections tracked on to the board Modifications to fit 2764 in M2 IC4 M3 M2 1. Link A to B to C 2. Drill out hole D to 1 mm (no larger) 3. Cut track E (c) In Issue 7 boards, M2 is fitted with an 18-pin socket into which the user can plug one of two headers supplied with the board. This obviates the need for board modif ications and allows the user to change from CMOS RAM to EPROM with only a moment's work. PAGE 187 Special Consideration for the Serial Port At switch-on, the operating system sends the following ASCII codes to the serial output ports &QC (clear screen) MQSB.3 &0D (carriage return) (Peripheral driver software may extend this message. ) This is the normal reset message, and this will be placed in the RS-423 serial output buffer. If the serial handshake line is active high (+5V on pin 5 of the 7 pin DIN connector) , this message will be transmitted . If the line is off (i.e. low -5V) , the message will remain in the buffer. If this start-up message needs to be suppressed, there are two ways to remove it. The first is to use a 'flush buffer' command at the start of the program using *FX15 ( ' flush all buffers' ) . In practice , the system may have already transmitted the 'clear screen' and probably the 'M' . PAGE 188 (This page has been left blank intentionally) PAGE 189 9. INITIALISATION TABLES The initialisation tables provided below are designed for users with advanced applications . They enable the user to change the values of the variables so that their value at reset will be different. Probably the two main variables are the input type found at &FG5A and the output type found at &FQ95 . For example 5 an application using the serial port to connect to another machine may require the reset message to be suppressed. This can easily be achieved by specifying no output channels in the table, i.e. &F095 = 06 (normally 07), which will cause any message to be sent nowhere. Remember to switch on an output channel in the application program if you want to use the serial port with *FX3,7 (for output definition of OSBYTE 3 see BBC User Guide and Advanced User Guide) . PAGE 190 Address OSBYTE Initial Imple- Description in decimal EPROM value mented F000 OF Start-up byte F001 F1A7 Language entry vector Turnkey Line F003 Vector Table FFFF, ...... FF Turnkey line. F019 Y USERV user vector F01B Y BRKV BRK vector F01D Y XRQ1V primary interrupt vector FO IF Y IRQ2V Unrecognised interrupt vector F021 Y COMM command line interpreter F023 Y BYTEV FX/OSBYTE vector F025 Y WORDV 0 SWORD vector F027 Y WRCHV write character vector F029 Y RDCHV read character vector F02B Y FILEV load/save file vector F02D Y ARGSV file argument vector F02F Y BGETV byte get vector PAGE 191 F031 Y BPUTV byte put vector F033 GBPBV group byte put/get vector F035 Y FINDV open or close file vector F037 Y FSCV file system control vector F039 Y EVNTV event vector F03B UPTV user printer vector F03D NETV network vector F03F VDUV unrecognised VDU vector F041 KEYV keyboard vector F043 Y INSV insert into buffer vector F045 Y REMV remove from buffer vector F047 Y CNPV count/purge buffer vector F049 IND1V F04B IND2V F04D IND3V PAGE 192 Variable table F04F 166 0190 Y Read start address of OS variables F05 1 168 0D9F Y Read address of ROM pointer table F053 170 02A0 Y Read address of ROM information table F055 172 0000 Read address of key translation table F057 174 0300 Y Read start address of OS VDU variables F059 176 00 Read/write CFS timeout counter F05A 177 01 Y Read/write input source F05B 178 00 Read/write keyboard semaphore F05C 179 0E Y Read/write primary OSHWM F05D 180 OE Y Start of language RAM F05E 181 00 Y Read/write RS-423 mode F05F 182 00 Read key explosion state F060 183 00 Y Read/write cassette/ROM filing system switch F06 i 184 0000 Read RAM copy of video ULA control register PAGE 193 F062 185 Read RAM copy of video ULA palette register F063 186 00 Y Read/write ROM number active at last BRK (error) F064 187 FF Y Read/write number of ROM socket containing BASIC F065 188 04 Read current ADC channel F066 189 04 Read/write current maximum ADC channel number F067 190 00 Read ADC conversion type F068 191 FF Read/write RS-423 use flag F069 192 IE Y Read UART control register F06A 193 19 Read/write flash counter F06B 194 19 Read/write mark period count F06C 195 19 Read/write space period count F06D 196 32 Read/write keyboard auto-repeat delay F06E 197 08 Read/write keyboard auto-repeat period F06F 198 00 Y Read/write *EXEC file handle F070 199 00 Y Read/write *SPQ0L file handle PAGE 194 F07 i 200 00 Ft) 72 201 00 '0/3 202 20 F074 203 09 F075 204 00 F076 205 00 F077 206 00 F078 207 00 F079 208 00 F07A 209 50 F07B 210 00 F07C 211 03 F07T) 212 90 F07E 213 64 Y Read/write ESCAPE, BREAK effect Read/write keyboard disable Read/write keyboard status byte Y Read/write RS-423 handshake extent Read/write RS-423 input enable Read/write cassette/RS-423 selection flag Read/write Econet OS call inter- ception status Read/write Econet OSRDCH inter- ception status Read/write Econet OSWRCH inter- ception status Read/write speech suppression status Read/write sound suppression status Read/write BELL channel Read/write BELL envelope number/ amplitude Read/write BELL frequency PAGE 193 F07F 214 06 Read /write BELL duration F080 215 81 Y Start up error F081 216 00 Read/write length of soft key string F082 217 00 Read/write number of lines printed since last page F083 218 00 Read/write number of items in VDU queue F084 219 09 Read/write TAB character value F085 220 IB Y Read/write ESCAPE character value F086 221 D001 222 8001 223 224 F08A 225 8001 Read/write function key status 226 Read/write SHIFT + function key status 227 Read/write CTRL + function key status 228 Read /write CTRL + SHIFT + function key status FOSE 229 00 Y Read/write ESCAPE key status F08F 230 00 Y Read/write flags determining ESCAPE effects PAGE 196 F090 231 FFFF Y Read/write IRQ bit mask for clock 232 Y Read/write IRQ bit mask for 6551 233 Y Read/write IRQ bit mask for system 6522 F093 234 00 Read flag indicating Tube presence F094 235 00 Y Read flag indicating clock F095 236 07 Y Output type RS423 F096 237 00 Y Read/write cursor editing status F097 238 0000 Read/write location &27E, not used by OS 1.20 239 Read/write location &27F, not used by OS 1.20 240 Read/write location &280, not used by OS 1.20 241 Read/write location &281» used by *FX 1 F09B 242 05 UART command register F09C 243 E0 Y ROM 16 Page address F09D 244 FF Read/write soft key consistency flag F09E 245 01 Read/write printer destination flag PAGE 197 F09F 246 OA Read/write character ignored by printer FOAO 247 0000 Read/write first byte of BREAK intercept code 248 Read/write second byte of BREAK intercept code 249 Read/write third byte of BREAK intercept code F0A3 250 0000 Read/write location &28A„ not used by OS 1.20 251 Read/write location &28B S not used by OS 1.20 F0A5 252 Y Read/write current language ROM number F0A6 253 Y Read/write last BREAK type 254 Y Read/write available RAM 255 Y Read/write startup options PAGE 198 APPENDIX 10: Link and Line Termination Options (1) Links L2, 3 connects zero voltage to the negative inputs of the diffential serial inputs. This allows the positive inputs to work in ' single ended' mode for RS-423 specification (for RS-232 operation, see Appendix 6). (2) Fail safe resistors: lkB input resistors are fitted on all inputs. These improve the internal biasing of the input devices so that an open circuit line will present a non-active signal to the UART (6551). (3) Slew rate limiting: CIO to C13 can be fitted to provide slew rate limiting of the output drivers. In most applications these can be ignored. On badly 'ringing' lines slower edges will stop the 'ringing' at the expense of a reduced baud rate. (4) The board has provision for line terminating resistors. As supplied, these load resistors are not fitted. If you are using long lengths of serial cable, you will need to consider fitting them. R9 terminates CTS TxENABLE R14 terminates RxD Receiver input (RECEIVE DATA) PAGE 199 For a cable with a characteristic impedance of 12GR» Duplex connection requires a resistor at the receiving end (e.g. 120R) . However, party line configuration requires a resistor at both ends (e.g. 24QR). These values are for guidance only, and in a large system experimentation may be required. The solution lies in a compromise between 120R which provides maximum power transfer at a reduced signal to noise ratio, or 240R which causes a mismatch of 2:1 but no signal to noise reduction. NOTE Link 1 is not used on Issue 5 and later boards. -5V INVERTER EuroCUBE is normally supplied with link L5 made and no -5V inverter (7660) fitted. L5 connects the expansion bus pin 4b to the serial buffers. If the ~5V inverter is fitted with its two capacitors C24 and G25, L5 will need to be broken. The maximum output current of the inverter is 20mA, at which point the voltage will drop to -4V (see p.16 for more details). PAGE 200 APPENDIX 11: Connectors Bus Connector B A +5V 1 +5V +12V 2 A15 -12V 3 A14 ~5V 4 NWDS +15V 5 NRDS -15V 6 RESET HPAGE 7 A8 A23 8 A7 A22 9 A6 A21 10 A5 A20 11 A4 A19 12 A3 A18 13 A2 A17 14 A1 A16 15 AO D15 16 D7 D14 17 D6 D13 18 D5 D12 19 D4 Dll 20 D3 DIO 21 D2 D9 22 D 1 D8 23 DO 24 A13 25 A12 26 All RDY 27 A10 IRQ 28 A9 NMI 29 phase 2 clock SYNC 30 R/W LPAGE 31 BLK AGND 32 DGND PAGE 201 VIA Connector GND 26 25 GND nc 24 23 RESET CAl 22 21 CA2 PAO 20 19 PA1 PA2 18 17 PA3 PA4 16 15 PA5 PA6 14 13 PA7 PBO 12 11 FBI PB2 10 9 PB3 PB4 8 7 PB5 PB6 6 5 PB7 CB1 4 3 CB2 4-5 V 2 1 4-5V Serial Connector socket view PAGE 202 APPENDIX 12 Brief History of EuroCUBE-65 (Issues 1-7) Issue 1 This was a production prototype of which very few are in existence. The board had no solder resist, and there was a paging latch where the clock chip now resides. The serial buffers used were different from the current issue and would only work single ended, not differential. The memory decoder Ml provided only one map for M0S-B.1. Issue 1 EuroCUBEs cannot be upgraded to the current standard. Issue 2 Main production started with Issue 2 boards. The boards were basically the same as Issue 1 but with solder resist. Issue 2 boards used GTS and RTS from the UART and different serial buffers (26LS30 and 26LS32 ) . Boards were modified to use CA2 on the VIA. for handshaking output and DSR for handshaking input. Wiring for the MOSTEK clock was present, but no chip could be fitted because the MOSTEK clock chip was suddenly withdrawn. The memory decoder was changed to M2 1/01 with eight maps. There was a fault with the CMOS 5565 RAM. Issue 2 EuroCUBEs cannot be upgraded to the current standard. PAGE 203 Issue 3 This production board replacing Issue 2 corrected the fault with the CMOS 5565 RAM and used the M3000 clock chip instead of the MOSTEK one. However, modifications still had to be made to the board in order to make the clock function correctly. The CB2 language select was cut and linked to disable. The memory decoder M2 1/01 remained the same as for Issue 2 boards. Issue 3 EuroCUBEs can be . upgraded to the current standard. Issue 4 Issue 4 EuroCUBEs were pre-production boards only and never went into full production. The fault which had previously necessitated modifications for the proper functioning of the clock was corrected. The memory decoder was upgraded to M3 1/02. M3 had some different internal maps, and 1/02 had an active high clock strobe. Issue 5 The current issue went into production in May 1984. The memory map decoder M4 1/02 represents a complete redefinition with 16 maps. The CPU divider has been removed and replaced with a -5V Inverter. EuroBEEB, the EuroCUBE-65 with BBC BASIC on board, was released simultaneously; it represents an Issue 5 board with an overlay for 5565 5565 27128 2764 memory pin-outs. PAGE 204 Issue 7 Issue 7 boards are fitted with two hard reset pins, giving the user the option to fit a hard reset button. Link 5 now includes three options for RS-423/422 operation. Memory socket MO is configured as standard for a 16kB 27128 device. Memory socket M2 is supplied with an 18— pin header socket to facilitate the change between CMOS RAM and EPROM. A separate on-board oscillator is provided for the 6551 ACIA. PAGE 205