home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / ioplemx.zip / read.me < prev    next >
Text File  |  1995-05-19  |  4KB  |  85 lines

  1. Hi folks,
  2.  
  3. some time ago I posted an article to comp.os.os2.programmer.misc where I asked
  4. whether it's possible to stop the multitasking in OS/2 without writing a
  5. device driver. I want to do some measurement under OS/2 as I did under DOS,
  6. but in DOS you have always this boring problem with the 64KByte memory limit.
  7.  
  8. So the idea was to write a C programm that allocates some memory (e.g. 2MB)
  9. and then jump to an assembler routine that fills the array with the measured
  10. data on the basis of a programmed timer WITHOUT getting any interrupts, 
  11. so that the timing of the data would be reliable.
  12.  
  13. Actually, there were to different answers to my article. Some people said, that
  14. it would be necessary to write a device driver for my A/D card, other people
  15. told me, it would be sufficient to create an IOPL-segment in my program to
  16. do the job. But no one told me how to do it in an emx+gcc environment.
  17.  
  18. Perhaps this is common knowledge for you, but it did cost me really some
  19. time to get the things working. So I put together an example that shows how
  20. to create an IPOL segment with emx+gcc. 
  21.  
  22. I put it on hobbes.nmsu.edu and on ftp.informatik.tu-muenchen.de.
  23. Its name ist iopl_test.zip.
  24.  
  25. The program has two parts, a C file (test_iopl.c), that allocates 2MB of 
  26. short integers and an assembler file (iopl.asm) that fills the allocated 
  27. memory with integers. To compile it you need a MASM (I used MASM 5.1, I don't
  28. know whether other versions will work, but I hope so) and the emx port of
  29. gcc. Please have a look at the makefile, because in my system there's 
  30. at the moment no PATH to masm, so I put the path in the makefile. Perhaps
  31. you have to modify it.
  32.  
  33. The assembler file exports one routine, _16_TEST, please note that the
  34. praefix _16_ is necessary, because emx+gcc adds the praefix to your
  35. declared thunk function.
  36. This routine fills the allocated array with successive integers, while the
  37. interrupts are disabled. I put a time delay in the routine, so you can watch
  38. how the mousepointer stands still, while the routine works. It takes about
  39. 5 seconds on my machine (486DX2-50).
  40.  
  41. In the C file, the array is allocated, then the assembler routine is called
  42. and finally every 64th member of the array is written to a file, so you can
  43. see that it's working. (Note: it takes about 360KByte of free disk space).
  44.  
  45. --------------------------------------------------------------------------------
  46.  
  47. NO WARRANTY !! NO WARRANTY !! NO WARRANTY !! NO WARRANTY !! NO WARRANTY !! 
  48.  
  49. YOU ARE USING THIS CODE AND RUNNING THE PROGRAM ON YOUR OWN RISK !!
  50.  
  51. --------------------------------------------------------------------------------
  52.  
  53. In fact it is a very easy way to completly stop your machine by using 
  54. privileged code and making mistakes [I know what I'm talking about 8-( ]
  55.  
  56. I hope, that this code is useful, but maybe it's not. The program works fine
  57. on my machine, but maybe it does not on yours. I didn't include error checking,
  58. because I think, if anybody wants to stop interrupts he should know what
  59. he's doing.
  60.  
  61. Especially what I didn't do is checking the problem of swapping. I allocate
  62. the m,emory with calloc, so it is filled with 0. If you have enough RAM
  63. this means that the whole array is in the RAM. I do not know, what happens,
  64. if swapping occurs while the interrupts are disabled. On my machine it works,
  65. I have 8 MB of RAM in it.
  66.  
  67. A final word: The Code isn't elegant, I think, but I'm not a programming wizard
  68. and it just does, what I wanted it to do. 8-)
  69.  
  70. So at last I want to thank the peopole who answered me to my last posting
  71. an to the writers of io386.zip, and naturally Eberhard Matthes, who did this
  72. great work of bringing emx+gcc to us.
  73.  
  74. ARMIN LAMBACHER
  75.  
  76. --------------------------------------------------------------------------------
  77. Armin Lambacher                            email: lambache@alf.biochem.mpg.de
  78. Abt. Membran- und Neurophysik
  79. MPI fuer Biochemie
  80. Martinsried
  81.  
  82. "Ich sag' nicht viel, aber was ich sag' ist Quatsch." (Pippi Langstrumpf)
  83.  
  84. --------------------------------------------------------------------------------
  85.