home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ida35bc.zip / MEMCPY.IDC < prev    next >
Text File  |  1996-01-29  |  1KB  |  41 lines

  1. //
  2. //    This file demonstrates how to copy blocks of memory
  3. //    using IDC. To use it, press F2 and select this file.
  4. //    Once loaded and compiled all IDC functions stay in memory
  5. //    so afterwards you can copy blocks simply pressing Shift-F2
  6. //    and entering something like:
  7. //
  8. //        memcpy(0x30000,0x20000,0x100);
  9. //
  10. //    This construction copies 0x100 bytes from 0x20000 to 0x30000.
  11. //
  12. //    Also, you can delete main() function below.
  13. //    When you try to execute this file, you'll get an error:
  14. //    can find function 'main', don't pay attention.
  15. //    You will get memcpy() function in the memory.
  16. //    In this case you should create a segment youself (if nesessary).
  17. //
  18.  
  19. //------------------------------------------------------------------------
  20. static memcpy(to,from,size) {
  21.   auto i;
  22.  
  23.   for ( i=0; i < size; i=i+1 ) {
  24.     PatchByte( to, Byte(from) );
  25.     from = from + 1;
  26.     to = to + 1;
  27.   }
  28. }
  29.  
  30. //------------------------------------------------------------------------
  31. static main(void) {
  32.   auto from,to,size;
  33.  
  34.   from = 0x10000;
  35.   to = 0x20000;
  36.   size = 0x5;
  37.  
  38.   if ( SegCreate(to,to+size,to>>4,0,1,2) )
  39.     memcpy(to,from,size);
  40. }
  41.