1;
2;   SMAPI; Modified Squish MSGAPI
3;
4;   Squish MSGAPI0 is copyright 1991 by Scott J. Dudley.  All rights reserved.
5;   Modifications released to the public domain.
6;
7;   Use of this file is subject to the restrictions contain in the Squish
8;   MSGAPI0 licence agreement.  Please refer to licence.txt for complete
9;   details of the licencing restrictions.  If you do not find the text
10;   of this agreement in licence.txt, or if you do not have this file,
11;   you should contact Scott Dudley at FidoNet node 1:249/106 or Internet
12;   e-mail Scott.Dudley@f106.n249.z1.fidonet.org.
13;
14;   In no event should you proceed to use any of the source files in this
15;   archive without having accepted the terms of the MSGAPI0 licensing
16;   agreement, or such other agreement as you are able to reach with the
17;   author.
18;
19
20ifndef __FLAT__
21
22.model large, pascal
23
24else
25
26.386p
27.model small, pascal
28
29endif
30
31.code
32
33public FARWRITE, FARREAD, SHARELOADED
34
35ifndef __FLAT__
36
37FARREAD proc
38  push    bp
39  mov     bp,sp
40  push    ds
41  mov     bx,word ptr [bp+12]  ; load file handle
42  mov     cx,word ptr [bp+6]   ; load length
43  mov     ax,word ptr [bp+10]  ; load segment
44  mov     dx,word ptr [bp+8]   ; load offset
45  mov     ds,ax                ; move the segment into DS
46  mov     ah,3fh
47  int     21h
48  jnc     okay
49  mov     ax, -1
50okay:
51  pop     ds
52  pop     bp
53  ret     8
54FARREAD endp
55
56FARWRITE proc
57  push    bp
58  mov     bp,sp
59  push    ds
60  mov     bx,[bp+12]           ; load file handle
61  mov     cx,[bp+6]            ; length of write
62  mov     ax,word ptr [bp+10]  ; load segment
63  mov     dx,word ptr [bp+8]   ; load offset
64  mov     ds,ax                ; move the segment into DS
65  mov     ah,40h
66  int     21h
67  jnc     done_it
68  mov     ax,-1
69done_it:
70  pop     ds
71  pop     bp
72  ret     8
73FARWRITE endp
74
75SHARELOADED proc
76  mov     ax,1000h
77  int     2fh
78  cmp     al,0ffh              ; 0ffh = SHARE is loaded
79  je      has_share
80  xor     ax,ax
81has_share:
82  ret
83SHARELOADED endp
84
85else
86
87FARREAD proc
88  mov     ecx,[esp+4]          ; load length
89  mov     edx,[esp+8]          ; load offset
90  mov     ebx,[esp+12]         ; load file handle
91  mov     ah,3fh
92  int     21h
93  jnc     okay
94  mov     eax, -1
95okay:
96  ret     0ch
97FARREAD endp
98
99FARWRITE proc
100  mov     ebx,[esp+12]         ; load file handle
101  mov     ecx,[esp+4]          ; length of write
102  mov     edx,[esp+8]          ; load offset
103  mov     ah,40h
104  int     21h
105  jnc     done_it
106  mov     eax,-1
107done_it:
108  ret     0ch
109FARWRITE endp
110
111SHARELOADED proc
112  mov     eax,1000h
113  int     2fh
114  cmp     al,0ffh              ; ffh = SHARE is loaded
115  je      has_share
116  xor     ax,ax
117has_share:
118  ret
119SHARELOADED endp
120
121endif
122
123end
124