home *** CD-ROM | disk | FTP | other *** search
/ ftp.wwiv.com / ftp.wwiv.com.zip / ftp.wwiv.com / pub / MISC / SQDEV200.ZIP / SRC / SQASM.ASM < prev    next >
Assembly Source File  |  1994-05-23  |  4KB  |  126 lines

  1. ;***************************************************************************
  2. ;*                                                                         *
  3. ;*  Squish Developers Kit Source, Version 2.00                             *
  4. ;*  Copyright 1989-1994 by SCI Communications.  All rights reserved.       *
  5. ;*                                                                         *
  6. ;*  USE OF THIS FILE IS SUBJECT TO THE RESTRICTIONS CONTAINED IN THE       *
  7. ;*  SQUISH DEVELOPERS KIT LICENSING AGREEMENT IN SQDEV.PRN.  IF YOU DO NOT *
  8. ;*  FIND THE TEXT OF THIS AGREEMENT IN THE AFOREMENTIONED FILE, OR IF YOU  *
  9. ;*  DO NOT HAVE THIS FILE, YOU SHOULD IMMEDIATELY CONTACT THE AUTHOR AT    *
  10. ;*  ONE OF THE ADDRESSES LISTED BELOW.  IN NO EVENT SHOULD YOU PROCEED TO  *
  11. ;*  USE THIS FILE WITHOUT HAVING ACCEPTED THE TERMS OF THE SQUISH          *
  12. ;*  DEVELOPERS KIT LICENSING AGREEMENT, OR SUCH OTHER AGREEMENT AS YOU ARE *
  13. ;*  ABLE TO REACH WITH THE AUTHOR.                                         *
  14. ;*                                                                         *
  15. ;*  You can contact the author at one of the address listed below:         *
  16. ;*                                                                         *
  17. ;*  Scott Dudley       FidoNet     1:249/106                               *
  18. ;*  777 Downing St.    Internet    sjd@f106.n249.z1.fidonet.org            *
  19. ;*  Kingston, Ont.     CompuServe  >INTERNET:sjd@f106.n249.z1.fidonet.org  *
  20. ;*  Canada  K7M 5N3    BBS         1-613-634-3058, V.32bis                 *
  21. ;*                                                                         *
  22. ;***************************************************************************
  23. ;
  24. ; $Id: SQASM.ASM 1.2 1994/02/06 05:55:47 sjd Exp sjd $
  25.  
  26. IFNDEF OS_2
  27.  
  28. IFNDEF __FLAT__
  29.  
  30.         .model large, pascal
  31.         .code
  32.  
  33.         public FARWRITE, FARREAD
  34.  
  35. ; int far pascal farread(int handle,char far *buf,unsigned int len)
  36. ; int far pascal farwrite(int handle,char far *buf,unsigned int len)
  37. ; int far pascal shareloaded(void);
  38.  
  39. FARREAD proc uses ds, handle:word, buf:dword, len:word
  40.         mov     bx,handle               ; Load file handle
  41.         mov     cx,len                  ; Load length
  42.  
  43.         mov     ax,word ptr [buf+2]     ; Load segment into AX (and then DS)
  44.         mov     dx,word ptr buf         ; Load offset into DX
  45.  
  46.         mov     ds,ax                   ; Move AX (the segment) into DS
  47.  
  48.         mov     ah,3fh                  ; Do it
  49.         int     21h
  50.         jnc     okay
  51.  
  52.         mov     ax, -1
  53. okay:
  54.  
  55.         ret
  56. FARREAD endp
  57.  
  58. FARWRITE proc uses ds, handle:word, buf:dword, len:word
  59.         mov     bx,handle               ; Load file handle
  60.         mov     cx,len                  ; Length of write
  61.  
  62.         mov     ax,word ptr [buf+2]     ; Load segment into DS
  63.  
  64.         mov     dx,word ptr buf         ; Load offset into DX
  65.  
  66.         mov     ds,ax                   ; Move AX (the segment) into DS
  67.  
  68.         mov     ah,40h                  ; Call it
  69.         int     21h
  70.         jnc     doneit                  ; Return # of bytes if no error
  71.  
  72.         mov     ax,-1                   ; Otherwise, return -1
  73.  
  74. doneit:
  75.         ret
  76. FARWRITE endp
  77.  
  78. ELSE            ; __FLAT__
  79.  
  80.         .386p
  81.         .model small, pascal
  82.         .code
  83.  
  84.         public FARWRITE, FARREAD
  85.  
  86. ; int far pascal farread(int handle,char far *buf,unsigned int len)
  87. ; int far pascal farwrite(int handle,char far *buf,unsigned int len)
  88. ; int far pascal shareloaded(void);
  89.  
  90. FARREAD proc
  91.         mov     ecx,[esp+4]             ; Load length
  92.  
  93.         mov     edx, [esp+8]            ; Load offset
  94.         mov     ebx, [esp+12]           ; Load file handle
  95.  
  96.         mov     ah,3fh                  ; Do it
  97.         int     21h
  98.         jnc     okay
  99.  
  100.         mov     eax, -1
  101. okay:   ret 0ch
  102. FARREAD endp
  103.  
  104. FARWRITE proc
  105.         mov     ebx,[esp+12]            ; Load file handle
  106.         mov     ecx,[esp+4]             ; Length of write
  107.  
  108.         mov     edx,[esp+8]             ; Load offset into DX
  109.  
  110.         mov     ah,40h                  ; Call it
  111.         int     21h
  112.         jnc     doneit                  ; Return # of bytes if no error
  113.  
  114.         mov     eax,-1                  ; Otherwise, return -1
  115.  
  116. doneit: ret 0ch
  117. FARWRITE endp
  118.  
  119.  
  120. ENDIF ; FLAT
  121.  
  122. ENDIF ; !OS_2
  123.  
  124. end
  125.  
  126.