UTILS\MONOPAGE\MONOPAGE.DOC  ·  DOC  ·  11.7 KB  ·  1990-08-30  ·  from PCPlus_Issue-50_Nov-1990
         MONOPAGE
         by F.D. Leach


                    Multi-page displays for monochrome text
                    ---------------------------------------
                             I B M and compatibles
                             ---------------------

         The  MonoPage  programs are suitable for use with  monochrome
         displays on I.B.M.  and I.B.M.  compatible machines.

         The user of a monochrome monitor can only display one page of
         text   even  though  there  is  often  extra  display  memory
         provided.    The programs collectively called 'MonoPage'  now
         allow the use of multi-page displays for monochrome text.

         Monochrome  machines  have a minimum display memory  of  4000
         bytes  which  allows  the  display of 80 cols x  25  rows  of
         characters  with  their  respective  attribute  bytes.    The
         MonoPage  programs  give an extra page of display  for  every
         4000  bytes over and above the minimum needed up to a maximum
         of 9 extra pages.   Of two machines I use one has 32K display
         memory  provided  which gives a total of 8 display pages  and
         the other has a full 64K allowing the full 10 pages.

         Using  the  MonoPage programs you can add Help pages to  your
         programs  with  the  Help pages  temporarily  overlaying  the
         current screen.


                     Description of the MonoPage programs
                     ------------------------------------

         Program  1  - MEMPROBE.COM - shows how many total  pages  you
         have  available.    Just type <memprobe><ENTER> to  see  page
         total  and the memory locations.   Monochrome display  memory
         starts at Segment B000 Offset 0000 so as an example a machine
         with  32K of display memory would give the result of MEMPROBE
         as '8 display pages from B000:0000 to 7FFF'.

         Program 2 - CPAGE.COM - copies one page to another.  The form
         of  the command is -

                   <cpage/sourcepage,destinationpage><ENTER>

         where 'sourcepage' and 'destinationpage' are from '0' to '9'.

         For  instance  to copy the screen - Page 0 - to the first  of
         the extra pages type -

                              <cpage/0,1><ENTER>

         to re-display what was on the screen before the above command
         type -

                              <cpage/1,0><ENTER>

         Incorrect format or using a numeral above '9' gives a failure
         advice of 'Bad Command'.

         You  will see that the cursor stays in its original  position
         and  you may need to reposition it if you wish to use the new
         screen for input.

         Program  3  - SPAGE.COM - swaps two pages rather than  copies
         one to the other.  The commands are similar - just substitute
         SPAGE for CPAGE.

         Program 4 - DEMPAGES.COM - loads all available pages with the
         number  of its page ie.   Page 0 is filled with 0's,  Page  1
         with  1's and so on up to Page 9.   You can see your pages in
         turn by using 'CPAGE/(1 to n),0'.

         Program 5  - CLRPAGES.COM -  because the extra memory is  not
         used in mono text some machines do not clear it.  If you find
         this  is  the case for your machine use this program in  your
         AUTOEXEC.BAT.  The clearance covers all display memory.

         Program  6  -  TSAVE.EXE - will convert a text  file  into  a
         binary disc file for use with the extra pages.   This program
         is called by - <tsave><ENTER>.   Note that Program 7 needs to
         be  in the same directory as this program.   You are asked to
         supply the name of the text file for conversion then the name
         to  give the new binary file - full pathnames can be used  if
         you  require them to locate other directories.   The  program
         numbers the pages of text thus 'pageno/totalpages'.

         The  program copies into the disc file the central section of
         the  screen 70 cols wide by 19 rows deep.   The idea is  that
         with  the other programs provided you can overlay the current
         screen  with this section then revert to the current  screen.

         On  reloading  the  sections are surrounded by  a  border  to
         accentuate  the  overlay effect.   Note two rules - keep  one
         page  available  for  storage of the current screen  and  the
         maximum pages produced by the program is six.   See below for
         the  sequence of operations suggested to produce the  overlay
         and  reversion to the previous screen.   The program  reports
         the number of pages it has created.

         Program  7  -  TRIMSAVE.COM  - this should  be  in  the  same
         directory  as TSAVE.EXE if that is to be used.   The  program
         can be used directly to save what is in the additional screen
         pages.   The program can save up to six pages ie.   Pages 1 -
         6.  The program is called by -

                <trimsave output filename,pagequantity><ENTER>

         For example with three pages in Pages 1 - 3 of screen memory
         to create binary file 'C:\SCRWKS\FIRST.HLP' type -

                    <trimsave c:\scrwks\first.hlp,3><ENTER>

         Program  8 - TRIMLOAD.COM - this program will load the binary
         files  into screen memory starting at Page 1 and add a border
         to  the text.   The border intensity is required to be stated
         only  if  other than normal intensity is required.   Two  HEX
         digits  are required - '0F'  will produce the  high-intensity
         border.    The page quantity on the disc is detected and does
         not need to be stated.  The program is called by -

          <trimload input filename{,2-digit border attribute}><ENTER>

         thus  to  load  the file created  above  with  high-intensity
         border type -

                   <trimload c:\scrwks\first.hlp,0F><ENTER>

         Programs  9  &  10 - CTPAGE.COM, STPAGE.COM - are  called and
         perform  similarly  to  CPAGE  and SPAGE but  only  move  the
         central  sections with the borders that is 72 cols wide by 21
         rows deep.

         The  remaining  programs  are OBJ files to  incorporate  into
         high-level language libraries.


                       MonoPage in high-level languages
                       --------------------------------

         The  Call to the routine is FAR and the variables are  passed
         by Segment and Offset.  Note that there are no error traps or
         return  codes from the Call.   As an example from  QuickBASIC
         the CPAGE routine is called by

                    calls cpage(sourcepage,destinationpage)

         The  TRIMSAVE and TRIMLOAD routines in a high-level  language
         require  that  the file names are terminated by a  NUL.    In
         QuickBASIC the file name declaration could be -

                     'Z$ = "C:\SCRWKS\FIRST.HLP" + CHR$(0)'

         and the TRIMLOAD command is then - with high-intensity
         borders -

                            calls trimload(Z$,&H0F)

         If parameter checking is required declare the routines by eg.

               DECLARE SUB CPAGE (SEG SourcePage%, SEG DestPage%)
               DECLARE SUB TRIMLOAD (SEG Z$)

         TRIMLOAD  needs to have operating memory released for its use
         in  establishing  a buffer of 2660 bytes into which it  reads
         one page at a time (70 cols x 19 rows x 2).  You must arrange
         for  release of those bytes by your program.   In  QuickBASIC
         this  is  done  by 'GETMEM(-n)'.   Ask for release  in  whole
         paragraphs  (16 bytes)  and add one extra paragraph.   So for
         TRIMLOAD   the   request  for  release  is   'GETMEM(-2688)'.
         TRIMLOAD   issues  the  memory  request  and  memory  release
         interrupts.    The release by the high-level language is only
         needed once in your program.


                                    General
                                    -------

         The  programs  can be called from a high-level language by  a
         SHELL  to  the directory in which the COM files are  located.
         For  example  again from QuickBASIC when CPAGE.COM is in  the
         same directory as your main program the command would be -

                               SHELL "CPAGE/1,0"

         The loading speed is very fast but will be even faster if you
         use the OBJ files.

         If  you have BSAVE and BLOAD - binary file saving and loading
         -  note that the pages start at decimal 0,  4000,  8000  etc.
         rather than 'K'  boundaries.   You can create a small program
         which  forms your screen to BSAVE.   You will need to set the
         Segment by a 'DEF SEG = &HB000' or equivalent before the save
         and  load  and reset by a 'DEF SEG'  or equivalent after  the
         file action.   The starting location of the screen is '0' and
         the  length of the file will be '4000'.   You can then  BLOAD
         the  file  to  whichever page you wish by  setting  the  load
         location as (Page No x 4000).

         The  programs TRIMSAVE and TRIMLOAD are similar to BSAVE  and
         BLOAD but act on the central screen sections only.


                         Help Pages by Screen Overlays
                         -----------------------------

         The following is a suggestion on how to produce Help pages as
         screen  overlays.    In an operating program the  Help  pages
         would  be  called using a function key which is trapped -  in
         QuickBASIC  the ON KEY(n)  statement.   The screen pages  can
         then be scrolled by trapping the up/down cursor keys.

         1.    Convert  your text file to a binary screen  file  using
         TSAVE or TRIMSAVE.   The text file should be laid out so that
         the  text  falls between columns 10 to 70 inclusive  as  this
         allows  a  margin before the borders and clear space for  the
         Page  numbering.    For six Help pages the maximum number  of
         lines of text is 114.

         2. Load the binary file into screen memory (starts at Page 1)
         using TRIMLOAD.

         3. Set the function key trap in your program for calling  the
         Help pages and the other keytraps for scrolling the pages.

         4.    Set your program on trapping the call for Help pages to
         CPAGE  the  current  screen into the last page  of  available
         screen  memory - highest page possible is '9'.   Follow  this
         with a CTPAGE from Page 1 to Page 0.  Your screen now has the
         first  Help  page overlaying the central section.    If  more
         pages  are  available you may scroll through to  the  maximum
         indicated.  (Trap attempts to scroll below and above the page
         limits).

         5.  Your program should prepare itself to trap a function key
         - the same key or a different one - for the call to revert to
         the original screen.  On receipt of that call just CPAGE your
         last  page (containing the screen when Help was called)  back
         to  Page 0.   Reset your program keytraps to their state at 3
         above.

         6.    If  you  wish to have different sets of Help  pages  at
         various  points  in your program just TRIMLOAD  the  relevant
         disc file to load the fresh pages.  You cannot part-load from
         a disc file - it is all or nothing!


                             (c) 1989 F D Leach