8-Bit Software Online Conversion

BEEB -> PC COMMUNICATIONS ___________________________ Simon Godfrey (K5U) Jul95 Slightly revised documentation for program version 1.2 Last year I had to transfer some wordprocessor files between my BBC model-B and an IBM PC. In order to do this I had to find out how the serial/comms ports worked on each machine. This took hours of trial and error before I got it sussed. I hope this article will be of help to anyone else wishing to embark on similar project. I'm not sure what serial ports Archimedes or Apple Macs have but the comms lead described in this article should(?) be compatible with ANY computer with an RS232 port. Incidentally, if you need to connect your Beeb to a modem, this requires almost the same lead. On the RS232 connector just swap-around the Request-To-Send / Clear-To-Send wires and the Transmit-Data / Receive-Data wires. (I think this will do the job) BACKGROUND TO THE RS232 / RS423 =============================== The standard serial port on most computers is the RS232 which typically has 25 pins, which send or receive different signals to enable the computer to communicate with other devices. As many of the pins are only used for very specific tasks (and some of them serve no purpose at all), over the past few years a cut-down version of the RS232 has become more popular, using just 9 pins. The BBC has an RS423 port which is designed to do the same job as the RS232 but has only 5 pins, which can sometimes be rather limiting. One such limitation is encountered when connecting the BBC to a modem. Modems send signals such as "the phone is ringing" and "another computer has connected" to pins in the RS232 port, and these are then interpreted by the computer at the other end. If, however, there is a Beeb at the other end then such signals cannot be made use of as they aren't catered for in the RS423. Some modems were designed to combat this problem by redirecting some of the RS232 pins to the beeb's User-Port but this I feel can just complicate matters further... Problems such as this arose in connecting the Beeb to a PC, as the PC's serial/comms port 'expects' signals the BBC can't send via the RS423. Anyway... enough of the problems, here is the cure: NOTE ==== I'm afraid I've only made a cable for the 9-pin RS232 as this was the type on the PC I was using and most PCs nowadays use this type. My diagram for the 25-pin RS232 is an educated guess and may or may not work. 8BS and myself accept no responsibility for loss of data, time, life or anything caused by the project described in this article. MATERIALS ========= I was able to buy all of the materials from a local electronics shop (Tandy) for under 5.00. Presuming you have access to all the necessary tools - soldering iron, wire strippers etc, all you need is: * 1.5m of 6-core (or more) colour-coded cable * a male 5-pin domino-type DIN plug (for the Beeb) * a female 9-pin or 25-pin RS232 serial connector (for the PC) * plastic casing for the RS232 connector Tandy actually stocked a ready-made cable but I was unsure whether this would do the full job (as I didn't know whether or not it would 'trick' the PC-end as mine does - explained later). It was called an RS423/RS232 null modem lead or something like that. THE CABLE ========= You could use any length of cable, but the longer it is the more risk you run of your data getting corrupted. Multicore phone extension cable does the trick. I shall refer to the colour of the cable's wires as follows: K=Black, Y=Yellow, W=White, B=Blue, G=Green, R=Red. Such cables are probably not all exactly the same, so my apologies if yours has wires of different colour. RS423 CONNECTOR - BBC END ========================= This view of the RS423 pins is from the back of the BBC computer looking-in: ---TOP--- 1 - Signal Ground / B W \ 2 - Clear To Send | 5 4 | 3 - Transmit Data \ R | 4 - Receive Data / 1 | 5 - Request To Send | G Y | \ 2 3 / Solder the wires to the --------- pins according to their colour. Also solder the Black wire to the metal tube of the casing. The indented notch in the plug's metal tube (here shown on the left) can be on either the left or the right. I have shown it on the left to correspond with a diagram in the BBC User Manual. It is important to make a mark on the top of the plug to denote which way up it should be inserted into the computer, as it is possible to insert it upside down. RS232 9-PIN CONNECTOR - IBM PC END ================================== This view of the RS232 pins is from the back of the PC computer looking-in: 1 - Carrier Detect --------------------------- 2 - Receive Data \ % Y W % R / 3 - Transmit Data \ 1 2 3 4 5 / 4 - Data Terminal Ready \ / 5 - Signal Ground \ % G B . / 6 - Data Set Ready \ 6 7 8 9 / 7 - Request To Send ----------------- 8 - Clear To Send 9 - Ring Solder the wires to the pins according to their colour. Also solder the Black wire to the metal casing. The pins marked % should be joined together by two short pieces of wire. ie. connect the ends of one wire to pins 1 and 4 and the other wire to pins 1 and 6. As mentioned earlier, the BBC cannot provide certain signals the PC will need. These wires marked % will trick the PC into thinking, "there IS something properly connected to the other end of this wire" and, "it IS sitting ready for action". RS232 25-PIN CONNECTOR - IBM PC END (alternative) =================================== This view of the RS232 pins is from the back of the PC computer looking-in: ------------------------------------------------------------ \ . . . . . % R % B G Y W K / \ 13 12 11 10 9 8 7 6 5 4 3 2 1 / \ / \ . . . . . % . . . . . . / \ 25 24 23 22 21 20 19 18 17 16 15 14 / -------------------------------------------------- 1 - Protective Ground 12 - Data Signal Rate Detect DCE 2 - Transmit Data 15 - Transmitter Signal Element 3 - Receive Data 17 - Receiver Signal Timing 4 - Request To Send 20 - Data Terminal Ready 5 - Clear To Send 22 - Ring Indicator 6 - Data Set Ready 23 - Data Signal Rate Detect DTE 7 - Signal Ground 24 - Transmitter Signal Element 8 - Carrier Detect I have included details of all the assigned pins but for the purpose of this project you need only regard the nine that are marked. (...I think) Solder the wires to the pins according to their colour. The pins marked % should be joined together by two short pieces of wire. ie. connect the ends of one wire to pins 6 and 8 and the other wire to pins 8 and 20. COMMUNICATIONS SOFTWARE ======================= The easiest way I've found of transferring files between the two computers is by using simple comms software. Such programs were designed primarily for use with modems for uploading or downloading files from bulletin boards but Beeb to PC transfer is in effect the same thing. Xmodem seems to be the most popular file transfer protocol in BBC comms programs, which sends data as blocks and when receiving, checks for mistakes (corrupt data) after each one - If it detects any, the program will ask the other computer to re-transmit the previous block again. This way you are more or less guaranteed 100% error-free data. I'm not sure what the easiest to use comms package is for PCs, I use either RIPterm or Terminal (which comes as part of Microsoft Windows). There are however many good public-domain comms packages available for the Beeb. I personally prefer 'Quercus' but there are quite a few others in the 8BS pool - two such programs are on the Mad Rabbit Comms Disk (TBI-59-1). Any 'terminal' or 'scrolly' package worth its salt should support Xmodem transfers. There will probably be transmit/receive settings that you can adjust when the comms software is running. These should be set to the same values on both computers. I tend to stick to full duplex, 8 bits, no parity, 1 stop bit (shorthand: 8N1). If this sounds like complete gobbledy-gook don't worry, chances are the comms programs will default to these settings anyway. The higher the baud rate, the faster data will be transmitted/received. I use 9600 as the next speed up of 19200 tends to be very easily corrupted unless you have a very short comms lead connecting the two computers. If there are 'modem initialization strings', 'auto-dial' or 'AT' commands set in your comms programs (which is usually the case with PC-based programs), these should be set to blank as they only apply when you have a modem connected. Once you have the computers connected and the software up-and-running you can test the link by typing something on one of the computers. What you type should appear on the screen of the other computer. To transfer files, you just start an upload on one computer and start a download on the other. If you are using Xmodem then the upload & download must be in this order - otherwise the transfer may not engage properly. CONVERSION - UNDERLINES, LINEFEEDS AND BITMAPS ============================================== Of course, what use is file transfer if you can't use the files once they've been transferred? Some Beeb Wordprocessors such as Wordwise use very few 'hidden' codes within the text (apart from the green 'embedded commands' you insert yourself). Other wordprocessors hide codes (such as 'underline on', 'justified text on' etc) within the text and if these are transferred, for example, from a Beeb running InterWord to a PC running WordPerfect, the PC will not understand the codes and will output an 'incompatible file format' error message. It is therefore very rare that you can transfer a wordprocessor file from the Beeb directly to a PC (or vice-versa) and use it straight away. Most wordprocessors offer a 'spool to file', 'save as generic WP' or 'output as DOS text' option. These options will strip the document of any underlines, bolds, etc which would otherwise make the file difficult for other wordprocessors to read. It may be necessary for you to use one of these. 'Save as Generic WP' is highly recommended - it's by far the best as it leaves the paragraphs intact rather than splitting them with a 'return' after each line. Another incompatibility is that of the Beeb's and PC's handling of the 'Return' character at the end of lines and paragraphs. Here it is important to understand the difference between 'carriage return' and 'linefeed'. On the BBC the return key is stored as ASCII character 13 (carriage return), which sends the cursor to the far left hand side of the screen or printed page. On reaching one of these characters the BBC automatically inserts a 'linefeed' to take the cursor down one line. On PCs, the return key is stored as both 'carriage return' AND 'linefeed' together. (linefeed is ASCII character number 10). Without the 'linefeed' characters, you can't use the DOS 'TYPE' command on PCs to type a text-file to the screen, nor can you load these text files into some of the more fussy PC-based wordprocessors. If a document which includes the 'linefeed' characters is loaded into a Beeb wordprocessor, the linefeed characters are often converted into peculiar characters such as % signs. The other main incompatibility I've come across is between the BBC's UK-standard ASCII character set and the PC's MSDOS extended-ASCII character sets. On the BBC the (pound) sign is stored as character number 96 while on the PC it is stored as 156 and character 96 is a left ' quotation mark. All other characters from number 32-126 appear to be the same. THE CONVERSION PROGRAM - TEXT ============================= To combat these problems in particular, I have written a small conversion program which will convert either way from a BBC-format text file to a PC-format text file. It basically strips the file of any characters which are not a-z, 0-9 or punctuation marks; converts pound-signs, *bullet-points and 'quotation-marks'; and either adds or deletes linefeeds to carriage-return codes whenever necessary. The BBC-text option will convert from most BBC wordprocessor systems (WordWise Plus, View, etc). The InterWord option will additionally miss-out 'file-header' information and will convert various characters Interword uses into standard ASCII characters. There have been similar conversion programs in back-issues of 8BS. A View-to-ASCII converter can be found in issue 19. This program re-appeared with several other text-utilities in issue 20. An Interword-ASCII converter was in 8BS issue 23. You may or may not find these programs useful. If you are transferring a long WP file from a PC to the Beeb you may later need to use an ASCII file splitter to cut the file down to chunks small enough for BBC wordprocessors to handle. There's one in 8BS issue 31. Other Split and Join programs also appear in 8BS issue 40. Trial-and-error is the only way you'll find the best solution for you and the particular systems you use. Once you've figured how to do it once, you'll be able to do it a hundred times. I tried converting from WordPerfect 5.1 on a PC to Interword on my Beeb. Using 'Save as Generic Text' on the PC and the conversion program on the Beeb was the most successful method. Without using the Generic Text option I ended up with four pages of rubbish at beginning, weird codes at the start of each paragraph and the occasional page or two that had become underlined. Converting the other way (InterWord to WP51) I only needed to run my program on the Beeb and the file was ready to use on the PC. THE CONVERSION PROGRAM - GRAPHICS ================================= I have also provided options for converting between BBC mode-0 screens and Windows .BMP bitmap-images. The program relies on BBC screens having been saved by *SAVE filename 3000 8000 and Windows bitmap screens being Black & White and 640x256 in size. Other BBC screen modes and different sizes of bitmap screens are not supported. If you wish to convert BBC screens from anything other than mode 0, you'll have to first use a program to convert your screen into mode 0 and then run the BBC-to-WindowsBitmap conversion. Such a conversion program can be found in 8BS issue number 28. If you wish to convert different sized Windows bitmaps to BBC mode-0, you can use a windows-based picture editor such as 'Paint'. CUT an image from a bitmap picture using the PICK tool, then edit the IMAGE ATTRIBUTES to be 640x256 black&white, start a NEW picture and then PASTE-in what you had cut from the previous picture. More help with 'Paint' can be found in any Windows manual. When converting graphics between a Beeb and a PC you must note that the BBC's pixels in mode-0 are twice as high as they are wide. This will cause BBC mode-0 pictures to look somewhat squashed when transferred to a PC, and likewise a picture from a PC will look stretched when transferred to a Beeb. The best way I have found of getting round this problem is to either stretch or squash the image on the PC before or after the conversion. THE CONVERSION PROGRAM - GENERAL NOTES ====================================== Standard BBC filenaming syntax applies. I've found it very helpful to keep the BBC versions of files on one side of a disk and the PC versions on the other. For example, to convert a file called 'BBCORIG' on side-0 of a disk and write the converted version on side-2 under the name 'PCVERS' you would enter the Source Filename as :0.BBCORIG and the Destination Filename as :2.PCVERS It is worthwhile compacting your conversion disks every so often using the *COMPACT command. This will reduce the risk of 'Cannot extend' errors during file conversion. The conversion program is rather slow when working with text files as it reads-and-writes every character in turn. I wrote the program merely as a means to an end. If any 8BS members could write a faster version, in assembly perhaps, your efforts would be very much appreciated. GOOD LUCK! SJG, 8BS member K5U FURTHER INFORMATION =================== 8BS Issue 33 - Joining 2 Computers Part 1 (S.Flintham) 8BS Issue 33 - What Next? (C.Richardson) 8BS Issue 34 - Joining 2 Computers Part 2 BBC User Guide - Using Printers - Serial Port (p406) BBC User Guide - FX Calls (p421) BBC User Guide - ASCII character set (p490)