SB BBC @ GBR Oldie hints/tips #041-046 Hints and tips from the archives of Wakefield BBC Micro User Group... 41. User key editor ~~~~~~~~~~~~~~~ This is a short program which lists all the current user-key definitions, and not just the red ones. You can then edit them, if you wish, using the cursor and keys as usual. The number of bytes used up by the definitions is displayed; 239 is the maximum available. This was adapted from an original which I think was published in "Acorn User". You can omit all spaces in the listing, if you wish, except those inside quotes. This applies to the BBC B (& B+ ?) but not the Master or Compact. 100 MODE7:@%=&902:M%=0:PRINT'"Keylist":FOR K%=0 TO 15 110 PRINT'" *KEY"K%" ";:A%=K%?&B00:B%=256:FOR T%=0 TO 15 120 S%=T%?&B00:IF S%>A% AND S%<=B% THEN B%=S% 130 NEXT:IF B%=256 THEN 170 140 FOR G%=A% TO B%-1:H%=G%?&B01:M%=M%+1 150 IF H%>31 THEN VDU H% ELSE VDU 124,H%+64 160 NEXT 170 NEXT:@%=&90A:PRINT'';M%;" bytes used." :REM max is 239 42. User key definitions ~~~~~~~~~~~~~~~~~~~~ Some members may not know that, having programmed the red 'soft' keys, you can SAVE the definitions directly with the command *SAVE KEYS B00 C00 or *SAVE KEYS B00+100. The definitions can then be reLOADed at any time, (even if you have a BASIC program in memory, or if you are using View or Wordwise), with *LOAD KEYS. Disc users can conveniently incorporate this command in the !BOOT file. This applies to the BBC B (& B+ ?) but not the Master or Compact. 43. Wordwise and the user keys ~~~~~~~~~~~~~~~~~~~~~~~~~~ When you exit from Wordwise with *BASIC, you will find that the red keys do not work properly. You can cure this by pressing , but you can also restore normal key operation with *FX225,1 followed by *FX227,144. plus red keys seems to work normally on current versions, but just as a precaution, you could also use *FX226,128 to ensure that everything is back to normal. 44. Multiple menu technique ~~~~~~~~~~~~~~~~~~~~~~~ If you have a program involving lots of different menus, it's very tedious writing them all. Here is a fiendishly clever way of making the job easier, courtesy of Tim Davies. Just put the heading and contents of each menu in DATA statements, ending each menu with a "#". You can then call up the first menu with FNmenu(1), the second with FNmenu(2) and so on. The Function returns the number of choice you made from the menu. You can use this in various ways, such as ON FNmenu(2) GOTO 100,110,120 etc.. , or CHOICE%=FNmenu(3):IF CHOICE%=1 THEN ... ELSE .... The number in line 5910 must point to the first of the DATA statements, which must be numbered in steps of 10. If you renumber the program, remember to alter line 5910, (or whatever it becomes), as it won't be done automatically. You can of course pretty the menus up with nice colours etc., but this should at least inspire your ideas. The easiest way to test this Function without having to write a short program is to simply type PRINT FNmenu(2) etc.. 5900 DEF FNmenu(num%):LOCAL text$,get%:num%=(num%-1)*10 5910 RESTORE num%+6000:CLS :REM 6000 is 1st DATA statement 5920 item%=1:READ text$:PRINT'TAB(12)text$'' 5930 READ text$:IF text$<>"#" THEN PRINT TAB(4);item%" ..... ..... "text$:item%=item%+1:GOTO 5930 5940 PRINT'"Select desired Option No. ";:REPEAT get%=GET-48:UNTIL get%>0 AND get%"END" THEN CHAIN N$ ELSE RUN 40 DATA MEMDUMP,SHACK3,TERMIN,ROMPEEP,END 46. Extra-large printing ~~~~~~~~~~~~~~~~~~~~ This is a demonstration program which creates attractive enlarged characters very simply. It makes use of a look-up table in the 1.20 Operating System ROM, which the machine normally uses in Modes 0 to 6. This particular example uses the table to create attractive block characters in teletext Mode 7. You could modify this for inclusion into your own programs, to create special headings. This is based on ideas from "Acorn User" and "Micro Programmer". 10 MODE7:E%=144:REPEAT:PRINT"Press a Key...":A%=&C000+8*(GET-32) 20 E%=145+(E%-144)MOD7:FORB%=A%TOA%+7:C%=?B% 30 PRINTCHR$(E%)CHR$(154);:FORD%=7TO0STEP-1 40 IF(2^D%ANDC%)THENPRINTCHR$(255);ELSEPRINT" "; 50 NEXT:PRINT:NEXT:UNTILFALSE 73 Rick G4BLT @ GB7WRG