SB BBC @ GBR Oldie hints/tips #095-097 Hints and tips from the archives of Wakefield BBC Micro User Group... 95. Auto screen-off ~~~~~~~~~~~~~~~ Further to the previous tip, Adrian Botham has written a machine-code routine which turns the screen display off if no key has been pressed within the previous minute. As soon as a key is pressed, the screen display magically reappears with its contents preserved. This helps to lengthen the useful life of the cathode ray tube by preventing 'phosphor burns'. The code occupies 88 bytes, and I have used the cassette/RS423 input buffer area at &A00. If this interferes with any of your other software, then you can try putting it somewhere else. After running the program, you can load other programs in, switch to Wordwise etc., and as long as you don't press , then the 'auto screen-off' will operate. Any of you who want to figure out how it works should read chapter 12 of the Advanced User Guide for the BBC Micro, and also chapter 9.5 and 9.6. The only spaces in the listing are absolutely essential, and note that the underline character is used in some variable names, and should not be confused with the minus sign, which looks very similar in mode 7. (The underline character is on the same key as the Pound sign.) After typing in the listing, save the program before attempting to RUN it. 100 osword=&FFF1:osbyte=&FFF4:evntv=&220 110 clock_pars=&A00:code%=clock_pars+5 120 FORpass%=0TO1:P%=code% 130 [OPTpass%*2 140 PHP:CMP#2:BEQkey_pressed 150 CMP#5:BEQminute_up:PLP:RTS 160 .key_pressed PHA:TXA:PHA:TYA:PHA 170 LDA#0:STA&FE00:LDA&FE01:BEQturn_screen_on 180 .set_time LDX#clock_pars MOD256:LDY#clock_pars DIV256 190 LDA#4:JSRosword:JMPexit 200 .turn_screen_on LDA#132:JSRosbyte 210 CPY#&41:BPLfour_seven 220 .zero_three LDA#127:STA&FE01:JMPset_time 230 .four_seven LDA#63:STA&FE01:JMPset_time 240 .minute_up PHA:TXA:PHA:TYA:PHA 250 LDA#0:STA&FE00:STA&FE01 260 .exit PLA:TAY:PLA:TAX:PLA:PLP:RTS 270 ]NEXT 280 ?evntv=code%MOD256: evntv?1=code%DIV256 290 !clock_pars=&FFFFE890:clock_pars?4=&FF 300 *FX14,2 310 *FX14,5 320 CALLcode% 96. Printer pound/hash sign fix ~~~~~~~~~~~~~~~~~~~~~~~~~~~ On all Epson-compatible printers, there is a discrepancy between the keyboard Pound currency sign, and the printer Pound sign. Character 96 on the keyboard is a Pound sign, but the printer prints a sort of "'" sign - like a lefthanded apostrophe. The Pound sign on the printer is shared with character 35, the "#" (Hash or Sharp symbol), depending on whether you are using the American or English character set. However, those of you with an Epson FX80 and some other printers can use a more elegant solution. It is possible to redefine the printer character set, and thus turn character 96 from a "'" to a proper Pound sign, (dipswitch 2-3 on the NLQ's and 1-4 on the FX80 must be "off"). This little program must be run with the printer "ON LINE", and could conveniently be CHAINed as part of a disc !BOOT file. Those of you who are more cunning can spool the bytes off directly onto disc, and can then *EXEC them instead of CHAINing. As it stands, this program has no effect in the NLQ mode of a Canon/Kaga printer, as a PCG RAM expansion is needed. The DATA list has only been split for clarity, and to allow me to insert REM statements, so you can type it all in on one line if you like. NB: Many newer Epson printers only allow a limited range of characters to be redefined, so this may not work. 100 VDU2:REPEAT:REM Send data to printer only. 110 READ data%:IF data%>=0 THEN VDU1,data% 120 UNTIL data%= -1:VDU3:END 130 DATA 27,82,0:REM Esc "R" - Select American characters. 140 DATA 27,58,0,0,0:REM Esc ":" - Download from ROM to RAM. 150 DATA 27,38,0,96,96:REM Esc "&" - Specify character 96. 160 DATA 139,18,0,126,128,18,128,2,128,66,0,0:REM Data for sign. 170 DATA 27,38,0,224,224:REM Esc "&" - Repeat for Italic version. 180 DATA 139,18,0,30,96,18,128,18,128,64,0,0:REM Data for Italic. 190 DATA 27,37,1,0:REM Esc "%" - Select RAM for printing. 200 DATA -1:REM Terminator for data. 97. Printing listings (1) ~~~~~~~~~~~~~~~~~~~~~ Here is a handy little routine, for using a red key to LIST your programs without fuss. It is particularly useful if you want to LIST a number of programs one after another. The routine selects LISTO7 to format the listing nicely, cancels paged mode, switches the printer on, LISTs the program, switches the printer off, re-engages paged mode, and then cancels the LISTO. Please note that the spaces are for clarity only, and should be omitted, even though it looks mighty odd! *KEY1 LISTO7|M |O |B L.|M |C |N LISTO0|M 73 Rick G4BLT @ GB7WRG