home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PROGRAMS / UTILS / DOS_HELP / XP.ZIP / STRXCPY.ASM < prev    next >
Encoding:
Assembly Source File  |  1989-12-20  |  1.1 KB  |  37 lines

  1. ; Move a near string into a far string.
  2. ; Terminate far string with 2 consecutive zeros. (max size 64K)
  3. ;       void strXcopy(char far *Dest, char *Source);
  4. ; For Turbo C 2.0, small/tiny model.
  5. ; Written and tested with Turbo Assembler 1.0
  6. ; By Goh King Hwa, 20 Dec 1989.
  7.  
  8. _TEXT   segment byte public 'CODE'
  9.         assume cs:_TEXT
  10. _strXcpy    proc    near
  11.     push    bp
  12.     mov    bp,sp
  13.         push    si
  14.         push    di
  15.  
  16.         cld                             ;set for auto-increment
  17.         les     di,dword ptr [bp+4]     ;get dest far address
  18.         mov     si,word ptr [bp+8]      ;get source near address
  19. doLoop:
  20.         lodsb                           ;fetch one byte
  21.         or      al,al                   ;is it end of string?
  22.         jz      exit                    ;if so, exit
  23.         stosb                           ;move it into the destination
  24.         jmp     short doLoop
  25. exit:
  26.         stosb           ;double null terminate the far string
  27.         stosb
  28.         pop     di
  29.         pop     si
  30.     pop    bp
  31.     ret    
  32. _strXcpy    endp
  33. _TEXT    ends
  34.  
  35.         public  _strXcpy
  36.     end
  37.