home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / rng-810.zip / 00readme.txt next >
Text File  |  1994-01-28  |  3KB  |  69 lines

  1. ; RANDDRV.SYS random number driver for RNG-810 or similar hardware
  2. ; Copyright (C) 1994 Paul Elliot
  3.  
  4. This is an OS/2 IO driver for the CALNET random number generator
  5. model RNG-810.
  6.  
  7. To use, open the device $RANDOM$ and read random bytes.
  8.  
  9. From the hardware point of view, the RNG-810 is a very simple device.
  10. Simply do a "in" instruction on the port (300h 302h 304h or 306h) depending
  11. on its jumpers and you receive a random byte. The device uses Johnson noise
  12. to get its random bits. The device is subject to one restriction: You must
  13. wait 40usec between in port instructions or the bytes will not be randomly
  14. independent. Without this restriction, the read routine of this IO driver
  15. would be in essence a simple "REP INSB" instruction.
  16.  
  17. In order to get around this problem, the driver uses a timer interrupt
  18. 18.2 times per second, to read random bytes into a random bytes into
  19. a buffer. The read routine copies this data to the application, possibly blocking
  20. for the buffer to fill up.  Because of this this driver is much slower than it
  21. would be required by the speed of the random number generator.
  22.  
  23. If you want, you could hack the driver to get around this problem.
  24.  
  25. One approach would be to replace the reliance on the timer interrupt
  26. with a simple spin wait, directly reading the 0 timer. This would not
  27. be portable, and its hogs the CPU.
  28.  
  29. The other way would to be use the HRDIRVER technique, to speed up
  30. the timer interrupt. This does not appear to be an IBM supported technique
  31. and may be vulnerable to future changes in the operating system.
  32.  
  33. The best way would be to talk to IBM for a supported way to increase timer
  34. resolution.
  35.  
  36. To install:
  37.  
  38. copy RANDRV.SYS somewhere and add the following line to your CONFIG.SYS
  39. file.
  40.  
  41. DEVICE=somewhere\RANDDRV.SYS 0X300
  42.  
  43. This assumes you have configured your random number generator to use 
  44. port 0x300.
  45.  
  46. This code is written to use TASM (ideal mode) and borlands 16-bit c++ compiler.
  47. ;
  48. ; This program is free software; you can redistribute it and/or
  49. ; modify it under the terms of the GNU General Public License
  50. ; as published by the Free Software Foundation; either version 2
  51. ; of the License, or (at your option) any later version.
  52. ;
  53. ; This program is distributed in the hope that it will be useful,
  54. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  55. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  56. ; GNU General Public License for more details.
  57. ;
  58. ; You should have received a copy of the GNU General Public License
  59. ; along with this program; if not, write to the Free Software
  60. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  61. ;
  62. ;Paul.Elliott@Hrnowl.LoneStar.Org
  63. ;
  64. ;Paul Elliott
  65. ;
  66. ;3986 South Gessner #224 Houston TX 77063
  67. ;
  68.  
  69.