SB BBC @ GBR Oldie hints/tips #171-174 Hints and tips from the archives of Wakefield BBC Micro User Group... 171. Negative INKEY code (for Master) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The code numbers for negative INKEY commands are given on pages D.2-39 and D.2-40 of the Master Reference Manual Part I. The list given omits to tell you that the code for the decimal point is -77 on the keypad, (-104 on the keyboard). 172. Another calendar function ~~~~~~~~~~~~~~~~~~~~~~~~~ This Function will calculate the Julian Day Number which starts at midday on the Gregorian date specified, eg PRINT FNjulian(25,12,1987). Keen astronomers will know the significance of the Julian Day Number, but it has a more mundane use too. It provides a very simple way of calculating the exact number of days between two dates, taking full account of all Leap Years; you simply subtract the two Julian Day Numbers. eg: PRINT FNjulian(25,12,1987)-FNjulian(28,5,1951) . One small point; 1987 had a 'Leap Second' added to it to allow for the fact the Earth's rotation has slowed very slightly. Do not throw your Quartz watches away! Note that I have split line 1010 to make it look tidier; it is actually all one continuous line. 1000 DEFFNjulian(d%,m%,y%) 1010 =367*y%-7*(y%+(m%+9)DIV12)DIV4-3*((y%+(m%-9)DIV7)DIV100+1)DIV4 +275*m%DIV9+d%+1721029 173. ROM problems ~~~~~~~~~~~~ This is a fairly typical tale, and illustrates how careful you have to be in solving strange compatibility problems, and how careful you have to be in fitting upgrades. Ray Chand upgraded his BBC B with a Watford solderless ROM Socket Board, (very similar to the ATPL Sidewise board). First, the connections on the underside of the board contacted the top of the metal crystal sticking up near the rear of the BBC main board. PVC tape didn't help too much, as the sharp connections soon punctured it. I suggested using a double-sided sticky pad on the top of the crystal, with the protective strip left on the upper surface. Secondly, the leads to the S21 link pins stuck up too high, preventing the ROM board from seating properly; no choice here but to bend them out of the way. Finally, when the OS ROM was transferred to the ROM board, it prevented the keyboard from seating properly; spacing washers under the keyboard can help here. I have had similar problems with various makes of ROM boards on certain versions of the BBC - component heights and layouts do vary between production sub-contractors and between board version numbers. After overcoming the physical problems, Ray found that several discs, including Mini-Office II wouldn't behave unless either Wordwise-Plus or SpellMaster was removed. The reason is that SpellMaster 'grabs' one page of memory, when it detects WordWise or View - ie PAGE goes up by &100 (256) bytes. The solution was to type *WORKOFF followed by to disable SpellMaster. An ATS ROM was causing similar problems for much the same reason. All was then well until he swapped the Acorn 1.20 DFS ROM for a Watford 1.42 DFS. *WORKOFF produced an error message, and so did *CWORKOFF, (you can prefix Computer Concepts' commands with a C, and Beebug's with a B, to avoid clashes with other ROMs). This still didn't work, but putting the DFS ROM in a lower priority socket to SpellMaster did cure the problem. It appears that the Watford DFS *WORK command was clashing, though it strictly speaking shouldn't have done. The lesson to be learned from this tale must be that patience and a methodical approach will usually overcome such problems in the end, and that it is worth persisting. 174. Decimal-Hex-Binary converter ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This is a simple program which enables you to enter a decimal, hexadecimal or binary number, and it then prints out the same number in all three formats. It is intended for decimal numbers from 0 to 255, hex numbers from &00 to &FF, (just prefix the number with "&"), and binary numbers from 00000000 to 11111111, (you must type 8 digits). Thus, typing in "70", "&46" and "01000110" should all produce exactly the same results, but note that there is little trapping against silly inputs. A nice refinement of the program would be for it to also print out the equivalent ASCII character, and to allow a single ASCII character input as an alternative to the ASCII code. There isn't enough space here, and anyway you can do that for yourself, CAN'T YOU? 10 REPEAT 20 INPUT"Number : "A$:IFLENA$<4THENA%=EVAL(A$)ELSEA%=FNbindec(A$) 30 PRINT;A%" &";~A%" ";FNdecbin(A%)' 40 UNTILFALSE 50 : 100 DEFFNbindec(A$):LOCALA%:IFLEN(A$)<8THENRUN 110 FORB%=7TO0STEP-1:A%=A%+VAL(MID$(A$,8-B%,1))*2^B%:NEXT 120 =A% 130 : 200 DEFFNdecbin(A%):LOCALA$ 210 FORB%=7TO0STEP-1:A$=A$+STR$((A%AND2^B%)DIV2^B%):NEXT 220 =A$ 73 Rick G4BLT @ GB7WRG