home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / UTILITY / BATCH / INT11.ZIP / INT.DOC < prev   
Encoding:
Text File  |  1992-03-24  |  14.3 KB  |  310 lines

  1.  
  2.                Documentation for INT.COM version 1.1
  3.  
  4.         INT.COM is Copyright (C) by David Abbott,  August 1990.
  5.  
  6.      This documentation,  with the exception of the disclaimer and
  7.   licence agreement,  is also Copyright (C) by David Abbott 1990-1992
  8.                           All Rights Reserved.
  9.  
  10.  
  11. CONTENTS:
  12.  
  13.     * Warning
  14.     * Disclaimer
  15.     * Introduction
  16.     * Usage
  17.     * Examples
  18.     * Beginner's guide
  19.     * History
  20.     * Bugs
  21.     * Licence agreement
  22.  
  23.  
  24. WARNING:
  25.  
  26.     This software has the ability to call DOS and BIOS routines
  27.     which,   if used incorrectly,  may cause unintentional data
  28.     loss. Be sure you understand exactly what a command will do
  29.     before executing it. The potential to format your hard disk
  30.     with one command is contained herin!
  31.  
  32.  
  33. DISCLAIMER:
  34.  
  35.     The author makes no warranty, either implied or expressed,
  36.     including, without limitation, any warranties with respect
  37.     to the software documented here, its quality, performance,
  38.     or fitness for any particular purpose.   In no event shall
  39.     the author be liable for damage, whether direct, indirect,
  40.     special, incidental, or consequential, that arise from the
  41.     use of or any defect in the software.   The entire risk as
  42.     to the quality and performance of the software is with the
  43.     user.  By using this program, you acknowledge:
  44.     (1) to have read and understood all parts of this
  45.         disclaimer, the warning above,  and of the licence
  46.         agreement appearing at the end of this document, and
  47.     (2) to have agreed with and accepted all of their
  48.         provisions.
  49.  
  50.  
  51.  
  52. INTRODUCTION:
  53.  
  54.     Have you ever wanted to check for a key press in a batch file, without
  55. having the batch file wait for input?  If you have an EGA/VGA colour system,
  56. wouldn't it be nice to be able to have full control over the colours a program
  57. uses,  even if the program does not normally allow this?  Well now, thanks to
  58. INT.COM,  virtually anyone can have this power!  INT.COM is a small but very
  59. powerful utility,  which enables the easy execution of software interrupts
  60. from the DOS command line.  Those users not experienced with software
  61. interrupts or who don't know what a CPU register is may like to read now the
  62. BEGINNER'S GUIDE to INT.COM which appears later in this document.  The rest of
  63. you can continue on here.
  64.  
  65.  
  66. USAGE:
  67.  
  68.               int R N [ah al bh bl ch cl dh dl si di] [;STRING]
  69.         or:   int R N [ax bx cx dx si di] [;STRING]
  70.  
  71.     where R is one of A,a,B,b,C,c,D,or d indicating which general
  72.     purpose register is to be returned as a DOS errorlevel: lower case
  73.     indicating the lower byte, uppercase the high byte (e.g. D returns
  74.     dh, d returns dl).
  75.  
  76.     N is the interrupt number to be called (in hexadecimal)
  77.  
  78.     The first group of optional arguments are 1,2,3, or 4 digit hex
  79.     numbers specifying the contents of 8 or 16-bit registers in the
  80.     order indicated. Thus the following command lines are equivalent:
  81.         int a 12 34 56 07 89
  82.         int a 12 3456 0789
  83.         int a 12 34 56 789
  84.     It is only necessary to supply values up to the last register you
  85.     need to specify.  The remaining registers will be set to zero.
  86.     NOTE: The segment registers cs,ds,es, and ss all point to the
  87.     Program Segment Prefix (PSP).  This can be useful when supplying
  88.     additional data on the command line (see below).
  89.  
  90.     ;STRING is used to supply additional data for some interrupts.  All
  91.     characters appearing after the semi-colon are ignored by INT.COM,
  92.     but are accessible to the interrupt called.  To use this feature,
  93.     all one has to know is that the offset from the start of the PSP to
  94.     the first character of the command tail is 81h.  Thus it is a simple
  95.     matter to count up to the semi-colon and find the offset of the
  96.     extra data. For example,  the following line uses int 21h, function
  97.     9 to write the string "Hello World!" to the screen:
  98.         int a 21 09 00 0000 0000 009c;Hello World!$
  99.     (with the first space after int at offset 81h, Hello World must
  100.     start at offset 9ch,  to which dx is set).
  101.  
  102. NOTE: INT.COM does very little checking of command line syntax.  As long as
  103. the first argument is legal,  and no illegal characters appear before the
  104. semi-colon,  INT.COM will be satisfied.  It is therefore most important that
  105. you check the command line before execution,  or some nasty results may
  106. follow!
  107.  
  108.  
  109. EXAMPLES:
  110.  
  111.     The following examples illustrate the power and convenience of
  112.     INT.COM,  especially when used in batch files.  To get the most
  113.     out of INT.COM,  however,  you will need a reference listing the
  114.     DOS and ROM BIOS interrupts.  There are many books available
  115.     containing this information,  as well as some useful public domain
  116.     and shareware databases.
  117.  
  118.  
  119. * Check to see if ESC key has been pressed,  without waiting.  The first int
  120.   command checks for the presence of a keypress,  the second reads it:
  121. echo off
  122. int a 21 0b
  123. if not errorlevel 1 goto :nokey
  124. int a 21 08
  125. if not errorlevel 28 if errorlevel 27 goto :esc_pressed
  126. rem: The above line tests errorlevel (to which register al was returned) for
  127. rem: the value decimal 27 (ASCII code for ESC).
  128. goto :key_not_esc
  129.  
  130.  
  131. * single line batch file to set new video mode (I call this vmode.bat):
  132. int a 10 00 %1
  133.   This accepts the video mode number in hexadecimal.  Thus to set video mode
  134.   on a CGA to 40x25 16 colour text, use "vmode 6".  For 640x200 16 colour
  135.   graphics on a VGA/EGA, use "vmode E".  Consult your video card's
  136.   documentation to see if there are other useful modes available.  For
  137.   example, a Paradise compatible VGA card can be switched to 132 column text
  138.   with "vmode 55".
  139.  
  140.  
  141. * set VGA/EGA displayable colour 0Eh (yellow) to a different shade of yellow
  142.   from the available palette:
  143. int a 10 1000 37 e
  144.  
  145.  
  146. * set VGA palette colour 0 (black) to very dark blue by specifying RGB values:
  147. int a 10 1010  0000   0 11 0
  148.              col.reg. G B  R  (remember they are in hexadecimal)
  149.   To use this for other colours,  it is helpful to know which palette colour
  150.   registers actually correspond to which displayable colours in the default
  151.   palette selection.  They are as follows:
  152.     displayable colour:  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
  153.     colour from palette: 00,01,02,03,04,05,14,07,38,39,3a,3b,3c,3d,3e,3f
  154.   So to specify the RGB values for yellow, you would need to change register 3e.
  155.  
  156.  
  157. * disable default colour palette/register loading on VGA mode set:
  158. int a 10 12 01 0031
  159.   to re-enable, use:
  160. int a 10 12 00 0031
  161.   This can be very useful after setting precisely the colours you want to use
  162.   in a particular application,  to prevent these colours being reset by the
  163.   application program itself if it resets the video mode.  In this way, you
  164.   can use VGA colours in programs that don't support the VGA (but note that
  165.   some programs which switch video modes during execution rely on default
  166.   loading being enabled,  in which case you could be left with weird colours
  167.   if you use this trick)!
  168.  
  169.  
  170.  
  171. BEGINNER'S GUIDE:
  172.  
  173.         Hidden inside every PC are many small programs which perform tasks
  174. such as reading the keyboard,  setting different colours, changing video
  175. modes,  or writing text to the screen.  These programs are contained in two
  176. places:  the ROM BIOS (Read Only Memory Basic Input Output System) and DOS
  177. (Disk Operating System).  Normally,  one has to write programs in assembly
  178. language or a higher level language to access these operating system routines.
  179. That's because they're called by what are known as software interrupts.  When
  180. a particular interrupt is called, the computer executes the corresponding BIOS
  181. or DOS routine,  and then passes control back to the calling program.  What's
  182. needed, therefore, is a small program which will call the interrupt for us,
  183. and this is exactly what INT.COM does.
  184.  
  185.         INT.COM is a small program which allows software interrupts to be
  186. called directly from the command line,  or from within batch files. Those of
  187. you familiar with the available DOS and BIOS interrupts will know just how
  188. powerful a tool this makes INT.COM.  If you are not a DOS programmer,  don't
  189. worry; included in this document are several examples of INT.COM in use.  In
  190. addition, there are many books which list all of the DOS and BIOS routines,
  191. and with INT.COM,  most are instantly available to anyone can write a simple
  192. batch file (though if you can't write a simple batch file,  you should
  193. probably just stick to copying the example batch files listed elsewhere in
  194. this document).
  195.  
  196.         You probably would not want to call most of the DOS & BIOS routines
  197. available, since many perform tasks such as reading or writing to particular
  198. blocks on a disk,  disk formatting and so on.  There are a few routines which
  199. are particularly useful though, and I'll talk about some of these shortly.
  200. Let's now look at how to use INT.COM.  As a simple example, we'll use it to
  201. write the letter 'Z' to the screen. To do this,  one must first know which
  202. interrupt to call. As mentioned above,  to get the most out of INT.COM,  you
  203. will need a book which lists all the available interrupts,  and their calling
  204. parameters. One such book is "Advanced MS DOS Programming" 2nd ed. by Ray
  205. Duncan (Microsoft Press),  but there are many others. Looking through the list
  206. of interrupts,  one finds that the DOS interrupt 21h function 02h will do the
  207. job.  The h after the number means the number is in hexadecimal (base 16).
  208. All numbers will be quoted in hexadecimal, since INT.COM expects its arguments
  209. to be in hexadecimal and most books list the interrupts in hexadecimal anyway.
  210. Most interrupts are able to do several different things, and so there are
  211. different function numbers, and sometimes sub-function numbers,  for the one
  212. interrupt. You may well be wondering how you tell the interrupt which function
  213. you want it to execute.  The answer is the same way you pass it other
  214. parameters: through temporary storage locations called registers in the CPU
  215. (Central Processing Unit).  All you need to know about the registers is how to
  216. set them to the values specified in the description of the interrupt. This too
  217. is done via INT.COM,  and it is now that it will be necessary to reveal the
  218. command line syntax.  If you are not a programmer,  don't be frightened!  It
  219. all looks more complicated than it actually is.  The formal syntax for INT.COM
  220. is as follows:
  221.  
  222.            INT R N [ah al bh bl ch cl dh dl si di] [;STRING]
  223.  
  224.         The first argument indicates which register is to be returned, but we
  225. don't need to worry about that here;  for now we will just set it to the
  226. letter 'a'. N is the interrupt number in hexadecimal,  which we want to be
  227. 21h.  The first set of optional arguments are register values. Only those
  228. registers up to the last one required need to be given a value.  Looking at
  229. the description of interrupt 21h,  function 02h, one finds ah must be set to
  230. 02h (the function number), and dl the ASCII code of the character we want to
  231. write (the ASCII code for 'Z' is 5Ah).  STRING is not required in this
  232. example. We thus have all we need to write the letter 'z' to the screen. The
  233. command to use is simply:
  234.  
  235.                     INT a 21 02 00 00 00 00 00 00 5A
  236.  
  237. Notice that registers before dl which we did not use are just set to zero;
  238. they could be set to anything. Since no registers after dl are used,  they
  239. don't have to be included. If you type this command exactly as printed and hit
  240. return,  the letter 'Z' will magically appear!  Of course this example is not
  241. of much practical use,  but some useful examples are listed elsewhere in this
  242. document.  One word of warning though:  INT.COM does very little checking of
  243. command line syntax.  As long as the first argument is legal,  and no illegal
  244. characters appear before the optional semi-colon,  INT.COM will be satisfied.
  245. It's therefore most important that you check the command line before
  246. execution,  or some nasty results may follow!
  247.  
  248.  
  249.  
  250. HISTORY:
  251.     v1.0 - May 1990
  252.     v1.1 - August 1990: Code improved. Support added for 3-digit arguments.
  253.            March 1992:  Expanded documentation,  added licence agreement and
  254.                         released INT.COM for wider public distribution.
  255.  
  256.  
  257. BUGS:
  258.     Bugs?  In my program?  Hey,  don't expect me to admit to that!  This
  259.     program has been tested on systems running PC-DOS v3.1, MS-DOS v3.x, and
  260.     MS-DOS v5.0.  No problems have been reported.  Well,  no problems
  261.     with INT.COM anyway,  but the example VMODE.BAT was used to diagnose
  262.     a fault in early Trident VGA cards (some of which didn't work well
  263.     at 640x400 and 640x480, 256 colour modes with fixed frequency
  264.     monitors; the cards' scan rate was incorrect).  That was back in
  265.     1990,  so hopefully things are better with the Trident cards now!
  266.  
  267.  
  268. LICENCE AGREEMENT:
  269.  
  270.     INT.COM is supplied free for personal, private non-profit use at
  271.     home or within a university or educational institution or non-profit
  272.     organisation. For use anywhere else,  a separate licence must be
  273.     obtained from the author. Feel free to distribute INT.COM given the
  274.     following restrictions:
  275.  
  276.     * The program must be supplied in its original,  unmodified form,
  277.       which includes this documentation
  278.  
  279.     * No fee may be charged
  280.  
  281.     * Commercial use under this license is prohibited
  282.  
  283.     * The program may not be included -  or bundled - with  other goods
  284.       or services for which a fee is charged,  with the single exception
  285.       of strictly non-profit PC clubs who may charge a fee no more than
  286.       reasonably required to cover the cost of distribution.  Clubs so
  287.       doing are requested to notify the author.
  288.  
  289.    *  With the exception of this licence agreement and the disclaimer,
  290.       no part of this document may be published elsewhere without the
  291.       prior written permission of the author.
  292.  
  293.  
  294.  
  295.       If you find INT.COM useful, your gift in any amount would be
  296.       appreciated. Please direct your inquiries, complaints,
  297.       suggestions, etc., to:
  298.  
  299.                  Internet:  dfa@muon.ph.unimelb.edu.au
  300.                        or:  dfa@rabbit.physiol.unimelb.edu.au
  301.                  or
  302.                               David Abbott
  303.                               24 Yuille St.
  304.                               Brighton,  3186
  305.                               Victoria, Australia.
  306.  
  307.  
  308.                Last documentation change: March 24, 1992.
  309.  
  310.