EUG PD


Get More Out Of View

 
Published in EUG #8

One of the main advantages with the BBC version of View is the use of defined keys when editing. You can also save a file without having to enter the filename on every occasion. But, like the Electron version, a printer driver is still required to access all those options available on your printer in one document. So get typing and enter the listings for each of the following programs, then run to save the machine code files required.

The BASIC Extended Function keys program is called "U.AUSAFKY". The code is saved as "U.SAVFKEY" and uses memory &900 to &95B. This code will save your text file using the current name displayed. So only SA is entered to save. If you need a different filename displayed, use the NAME file command. The normal way to save is still available.

In addition, any function keys you define can be used when editing, by holding the CTRL key while pressing the appropriate number key. So you can define a key to execute several editing function keys. Any string of control characters or text may be entered, i.e. your address with |M to terminate each line. The choice is yours. But it is most important that you run the code after entering View. Before you start editing, enter *FX228,1. This sets up the CTRL/function keys 0 to 9.

The next program is a Printer Driver generator "U.DRIVGEN" and saves code with the filename you choose, e.g. "DRIVER". The code uses memory &400 to &4FF and is loaded when in View with the View command "PRINTER filename".

There is also a data file which will be saved at the same time when the BASIC program is executed called "DRIVdta". This is required by the BASIC program to list any printer codes previously entered by you for the driver. Also, there is an option to save a text file of these codes. This could be used in View if you wanted to add comments and will be called "DRIVtxt". As you can see, the first four letters of the filename will be the same as the driver filename in both cases.

When you have defined all the keys, you can also save them by using *SAVE filename B00+FF. They can be loaded with *LOAD filename instead of using the *EXEC file.

I normally use the following in View's command screen to initialise:

      *FX 18 ......... clears key definitions, to avoid Bad Key error
      *FX 225,123 .... on BREAK, defaults to Mode 3
      *RUN U.Savfkey 
      *EX 228,1
      *EXEC your Key file.
The following is used when in command mode:

NOTE: Where you see the "|", this indicates CTRL. It is also used when defining keys for a specific key values. On-screen colour may be changed using:

      *KEY 10 |S72000 M, or directly by pressing CTRL-S followed by
   7 2 0 0 0 in that order, for Green text.
To change the background colour, CTRL-S 0 4 0 0 0 for Blue. This is the same as using VDU 13,7,2,0;0;0; and VDU 19,0,4,0;0;0; in BASIC, which cannot be used in View.

Next, is a list of values for each View function key, use when defining a *KEY n. They are:

      f0 to f9                 =   140 to 149
      function keys fA to fZ   =   156 to 181
      function keys f< to f/   =   184 to 187
Cursor Keys are Left, |!|X which is 152 and Right, |!|Y 153, Down, |!|Z is 154 and Up, |!|[ is 155. Other keys are Delete :? and Copy |!|W 151 which is used to copy a marked block.

To define a key to execute several editing key operations, first find the function key values required. Their value is calculated as follows:

Firstly, |! is equal to 128. So to find |!( which is 168. This is fM goto marker. Calculated by using ASC"(" which is 40, this will be added to 128 to give us a total of 168. Have a look at the back of the User Guide for these ASCII values.

The way to get numbers less than 32, which is a " " (space), is to use 128 |! followed by another | followed by the ASCII character that will equal the value you need if 64 is deducted from it. The second | will deduct 64 from the ASCII character value following. i.e. |!|\ is function key "A", back-one-word is 128 plus ASC"\" which is 92 minus 64. So the value added to 128 will be 28, so giving 156, the number for function key "A".

To test that you have the right values for your function keys, do the following in BASIC. Enter directly, PRINT GET then press RETURN followed by the function key, or to test several function keys. REPEAT:PRINT GET: UNTIL FALSE will print on the screen the value defined by the function keys.

Examples of useful function keys not otherwise available:

To delete the beginning of a line, use the following:

      |!,   fQ   set marker
      2          marker 2
      |!|Q  f5   beginning of line
      |!,   fQ   set marker
      1          marker 1
      |!1   fV   delete block

Together, this would be: *KEY 0 "|!,2|!|Q|!,1|!1"

To delete a word at the cursor:

      |!|   fD   move right one spc
      |!|   fD   again
      |!|\  fA   start of word
      |!/   fT   delete up to Chr
      spc        delete to next space
So the key is: *KEY 0 "|!|_|!|_|!|\|!/ "

Don't forget the space at the end. This is the character to delete to.

Now for a few handy keys to *SPOOL or *BUILD for an *EXEC file.

      *WORD
      *FX18                      (Flush key buffer)
      *FX255,123                 (Mode 3 on BREAK)
      *Savfkey                   (Extend Key M/code)
      *FX228,1                   (Enable function keys)
      *KEY 0 FORMAT|M
      *KEY 1 PRINTER DRIVER|M    (Load Printer Driver code "DRIVER")
      *KEY 2 SCREEN|M
      *KEY 3 SHEETS|M
      *KEY 4 NEW|M
      *KEY 5 *BASIC|MCALL!-4|M   (Enter BASIC and break)
      *KEY 6 *WORD|M
      *KEY 7 "|!|_|!|_|!|\|!/ "  (Delete word at cursor)
      *KEY 8 "|!,2|!|Q|!,1|!1"   (Delete line up to cursor)
      *KEY 9 "|!*HM|M2|M|!*FM|M3|M|!*LM|M4|M"
      (HM 2 and FM 3 also LM 4 as header)
      *KEY 10 *RUN Savfkey|M S72000*FX228,1|M
      (Load fkey code / restore colour and keys on BREAK)

The maximum number of characters that can be used to define keys is 255. So use the shortest methods for the above. i.e. *B. for BASIC and *W. Also SC for screen etc.

NOTE: Do not include the explanatory comments in brackets.

One more handy utility used to intercept ASCII 96 and print the Pound when the ASCII value is different on your printer. It can be used at any time for listings or when you cannot use the View driver. Could be that you have a STAR LC10 which has printer mode selections on the printer, so you do not need a driver for one printer mode. Then file "PrtAsc", when run, will save code "Prt156", if the printer pound is ASCII(156). Just enter *RUN Prt156 before sending your listing to the printer, or on entering View.

Finally some printer codes that I use. This is my driver text file:

      View Print Driver ''DRIVER''
      Pound = ASC156
      @/P  24,27,64    24,27,64   ClrBufReset
      A/Q  27,120,1    27,120,1   N.L.Q. ON
      B/R  27,120,0    27,120,0   N.L.Q. OFF
      C/S  27,70,15    27,70,15   EmpOffConON
      D/T  18,27,84    18,27,84   Con.ScptOFF
      E/U  27,69       27,69      Emph. ON
      F/V  27,70       27,70      Emph. OFF
      G/W  27,87,1     27,87,1    Wide ON
      H/X  27,87,0     27,87,0    Wide OFF
      I/Y  27,51,20    27,51,20   Scpt.L/F ON
      J/Z  27,51,36    27,51,36   Scpt.L/F OFF
      K/[  27,83,1     27,83,1    Subscrpt ON
      L/\  27,45,1     27,45,1    U.Line ON
      M/]  27,45,0     27,45,0    U.Line OFF

You must use HT: 2 141 in text on the first line, this initialises the Driver. HT is the margin command. This must be followed by a blank line. Use each reset on the line after, unless ESC64 (Printer reset is available). In which case only *P would be needed. Otherwise use *P *B *D *F *H *J *M I found the spaces are needed between each code.

Precede code letters with '*' which is hightlight 2. Using one letter to turn on and another to turn off implicitly. This way the reset codes used in the header will restore the default printer settings after ESCAPE has been used. There will be unpredictable results if used any other way unless you avoid aborting the printout.

Bill Woodall