J.E.Lawrie                                                           HINTS-20.
                                                                         V.2  
Extracts from "Z88 Portable Computing" by Dave Oborne - Sigma Press,
                                                       ISBN: 1-85058-204-1
Controlling the screen

  As  well as giving you full control over your printed output, BBC Basic lets
  you fine-tune your screen display to such an extent that you can control the
  cursor  movement,  create  windows, and define your own characters.  This is
  all done using a very powerful statement: VDU

  The VDU statement comes in two forms.  It is either  followed  by  a  single
  value or a sequence of values.

  When  the  VDU  statement  (which  can  be shortened to V.) is followed by a
  single value between 0 and 127 it `prints' the  ASCII  character  associated
  with  that  value  to the screen - although sometimes the action might be to
  move the cursor or ring a bell rather than printing visible characters.  VDU
  97,  for  example  will  print `a'; VDU 36 prints `$' but more often the use
  will be for the following attributes :-

    VDU7     makes the Z88 beep
    VDU8     moves the cursor back one space
    VDU9     moves the cursor forward one space
    VDU10    moves the cursor down one line
    VDU11    moves the cursor up one line
    VDU12    clears the text area
    VDU13    moves the cursor to the start of the current line
                      (note - VDU1,50 moves it to the end of this line)
    VDU127   prints a black square
    VDU160   prints three dots  (as does <>SPCBAR)

  They can be used in sequence as in the following :-

    10 VDU9,9,9,127,127,127
    20 VDU10,8,163,10,8,163
    30 VDU8,8,163,8,8,163,8
    40 VDU11,127,10,10,127

  Extended Sequences

  To use the extended form of VDU statements the first number of the  sequence
  must  always  be  1.   This  facility  opens  a  range  of possibilities for
  controlling  the  screen  display.   With  it  you  can   generate   special
  characters,  set  text  attributes,  define  text  justification  and create
  windows.

  Cursor Movement:
  You can send the cursor directly to a particular position on the  screen  by
  using the VDU command:
                            VDU1,51,64,32+x,32+y
  where  x  and y are the column and row numbers respectively, e.g. to put the
  cursor in the middle of the screen you would use:
                            VDU1,51,64,80,36

  Special sequence  VDU1,50,88,32+x   moves the cursor to position `x' in  the
  same row.   VDU1,50,89,32+y   moves it to row `y' in the same column


Special Characters

  VDU1,32   Three dots                 VDU1,240    An  outline  arrow  -  left
  VDU1,33   The Z88 bell symbol        VDU1,241   "      "       "    -  right
  VDU1,39    The  grave  accent            VDU1,242   "     "      "   -  down
  VDU1,42   Square                     VDU1,243   "     "      "   -   up
  VDU1,43   Diamond                    VDU1,244    A bullet arrow  -  left
  VDU1,45   The Z88 SHIFT symbol       VDU1,245    "    "     "    - right
  VDU1,124  An unbroken vertical line  VDU1,246    "    "     "    -  down
  VDU1,224  The Z88 SPACE symbol       VDU1,247    "    "     "    -   up
  VDU1,225  The Z88 ENTER symbol       VDU1,248    A left pointer
  VDU1,226  The Z88 TAB symbol         VDU1,249    A right pointer
  VDU1,227  The Z88 DEL symbol         VDU1,250    A down pointer
  VDU1,228  The Z88 ESC symbol         VDU1,251    An up pointer
  VDU1,229  The Z88 MENU symbol
  VDU1,230  The Z88 INDEX symbol
  VDU1,231  The Z88 HELP symbol

Text Attributes
  In  addition  to  these  characters, other attributes can be set.  The first
  time the command is encountered it is set `on', the next time is `off'.  i.e
  the attribute is "toggled".

    VDU1,66 Bold               VDU1,67 Cursor       VDU1,70 Flash
    VDU1,71 Grey print         VDU1,76 Caps lock    VDU1,82 Inverse video
    VDU1,83 Vertical scroll    VDU1,84 Tiny font    VDU1,85 Underline
    VDU1,87 Horizontal scrolling

    VDU1,127,1,67,1,83   Resets all toggles to the established standard.
       Note - VDU1,127  Sets ALL toggles to `off', then 1,67 and 1,83
                          reset the cursor and scrolling  back to `on'.

  Using another extended VDU sequence it is possible to force a  complete  set
  of attributes to be switched on or off at the same time -

    to turn attributes on:  VDU1,49+n,43,sequence of codes
    to turn attributes off: VDU1,49+n,45,sequence of codes

    `n' represents the number of attribute codes to be turned on or off.
      So, to turn on reverse video and tiny font, you use the sequence -
      VDU1,51,43,82,84  or, to turn off the cursor,  VDU1,50,45,67
         ( 51 = 49 + 2 )                                ( 50 = 49 + 1 )

    Finally, it is possible to set certain attributes for a specific
    number of characters already onscreen -  though  only  applying  to  grey,
    flashing,  reverse  and  underlining  it  can  save  considerable time - -
    VDU1,50,65,32+n applies the current  toggle  to  the  next  `n'  charac's.
    VDU1,50,69,32+n inverts the current toggles for the next `n' char's.

Windows

  The  Z88  makes considerable use of windows within its various applications.
  For example, the INDEX, RAMs, DIARY, CALCULATOR, etc. Within Basic  you  can
  define  up  to  six such windows, referred to simply from 1 to the number of
  windows you have.

  The following sequence defines a window:

  VDU1, 55, 35, 48+n, 32+x, 32+y, 32+w, 32+d, type
                           (spaces are only for greater clarity)
  n    is the window number
  x    is the start column (left hand) of the window
  y    is the start row (top) of the window
  w    is the width of the window

  type is the type of window, defined as:
    129  draw left and right margin lines
    130  draw shelf brackets (blocks at the top of left and right lines)
    131  draw margin lines AND shelf brackets

  Once  you  have  defined  a  window  you can send information to it by using
  one of the following VDU sequences:

    VDU1,50,72,48+n    Direct  output   to   window   `n',   maintaining   the
                       display attributes previously set for this window.
    VDU1,50,73,48+n    Direct output to window `n', resetting attributes
                       to their default state.
    VDU1,50,67,48+n    Direct output  to  window  `n',  resetting  attributes 
                       to default and clearing the window.

    When text and other information is sent to a window, the normal  scrolling
    functions  of  the  display  are  turned  off.  Remember though, that both
    horizontal  and  vertical  scrolling  can   be   turned   on   using   the
    previously-described  attribute sequences.  So, to turn vertical scrolling
    on/off use VDU1,83 and horizontal scrolling with VDU1,87

    To  force  a  scrolling  movement  of a window, use VDU1,255 for upwards &
    VDU1,254 for downwards.

    To `grey' the current window, which produces the effect seen when using  a
    pop-down  such  as  the  calculator,  use   VDU1,50,71,43  -  grey  ON and
    VDU1,50,71,45 - grey OFF.

Multiple `Beeps'
  The following sequence of codes rings the Z88's bell a number of times -

    VDU1, 52, 33, 32+n, 32+w, 32+l  where n is the number of beeps
                                          w is the time between beeps in
                                               10 msec units
                                          l is the length of each beep in
                                               10 msec units.

    For  example:-  VDU1,52,33,36,132,232    will produce 4 beeps, each 2 secs
    long (200+32) with a wait time of 1 sec (100+32) between them. A  word  of
    warning:   if  you  set  the  number  of beeps to less than 0 the Z88 will
    continue the sequence forever, necessitating a Soft Reset.



                                                                           END

Back to HINTS-INDEX