home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / fortran / mslang / memacces / readme.txt < prev    next >
Text File  |  1993-07-06  |  4KB  |  106 lines

  1. This software is distributed as is.
  2.  
  3. THIS IS A BETA VERSION OF THIS APPLICATION NOTE, please give us your
  4. suggestions and opinions.
  5.  
  6.  
  7. The following disk contains sample code that demonstrates accessing
  8. memory from a Fortran PowerStation application by making calls to the
  9. DOSXNT DOS extender.  The disk contains the following files:
  10.  
  11.  
  12.     README.TXT
  13.     LEGAL.TXT          Description of rights and responsibilities
  14.  
  15.     DOSX_API.OBJ      !Functions to read and write real memory
  16.     DOSX_API.FI       !Prototypes for the functions in DOSX_API
  17.     API_TEST.FOR      !Fortran program demonstrating the functions
  18.  
  19.     MAP.OBJ           !Function: re-map memory to physical address
  20.                       ! NOTE: This function fails under DPMI
  21.     TEST.FOR          !Test program for MAP.OBJ
  22.  
  23.  
  24. There are 2 OBJ files for 2 very different situations:
  25.  
  26.    DOSX_API.OBJ
  27.      Uses standard API calls
  28.      Works with or without DPMI
  29.      Only accesses real memory (low 1Meg)
  30.  
  31.    MAP.OBJ
  32.      Does a low-level re-map of memory allowing efficient Peek/Poke
  33.         into physical memory from Fortran
  34.      Only works without DPMI (will not work in a DOS-Prompt under
  35.         Windows)
  36.      Can be used to access any memory location
  37.  
  38.  
  39. DOSX_API - Additional Information 
  40.  
  41. These are the memory access functions:
  42.     ReadMemQQ
  43.     WriteMemQQ
  44.  
  45. Before making calls to either function, internal data must be
  46. initialized with:
  47.     DosInitInterface
  48. (this function only needs to be called once)
  49.  
  50. To create the example:
  51.     FL32  API_TEST.FOR  DOSX_API.OBJ
  52.  
  53. For more information see the FORTRAN example source code API_TEST.FOR,
  54. and the header file DOSX_API.FI.
  55.  
  56.  
  57. MAP - Additional Information 
  58.  
  59. ***  This function only works in DOS, not DOS under Windows ***
  60.  
  61. The following function prototype is required:
  62.  
  63.       interface to integer*4 function mapmem
  64.      +                       [stdcall,alias:'_MAPMEM@12']
  65.      +                       (addr,memsize,physaddr)
  66.       integer*4 addr[value]
  67.       integer*4 memsize[value]
  68.       integer*4 physaddr[value]                           
  69.       end
  70.                                 
  71. ADDR is the address of a PAGE-ALIGNED memory location in the 
  72. application's memory space.  If this is not page aligned 
  73. (mod 4096) then the function will fail.
  74.  
  75. MEMSIZE is the amount of memory in bytes to be mapped.  It must be a
  76. multiple of 4096.
  77.  
  78. PHYSADDR is the physical memory location to be mapped in.
  79.  
  80. The return value is the error status.
  81.  
  82.   0, no error
  83.   8, if memory error
  84.   9, if invalid memory region (probably not page-aligned).
  85. 130, if not supported under DPMI server
  86.  
  87. The FORTRAN code will need to declare a static or allocatable array
  88. of at least 4K larger then required since there is no way to force
  89. arrays to be page-aligned.  Both the starting memory location passed
  90. into the MAPMEM function (some offset into the array) and the MEMSIZE 
  91. value must be multiples of 4096. Care must be taken that the memory
  92. block starting at logical address ADDR of size MEMSIZE is within
  93. the logical address space of the array.
  94.  
  95. Once the MAPMEM function has been successfully called then the 
  96. FORTRAN program can proceed to simply read from or write to the array 
  97. that was mapped and the data will be be read from or sent to the 
  98. actual physical memory location.  Care must be taken to write to the 
  99. correct elements in the array since the mapped memory will begin at 
  100. some offset into the array.
  101.  
  102. For information on how to determine ADDR, MEMSIZE, and the offset, see 
  103. the example TEST.FOR.
  104.  
  105. To build the example:
  106.    FL32 TEST.FOR MAP.OBJ