@@ -57,51 +57,42 @@ REM Avoid recursive / multiple inclusion
5757
5858Function FASTCALL SNETsocket(stype As ubyte) As byte
5959 Asm
60- push namespace core
6160 ld c, a ; c = type
6261 ld hl, Spectranet.SOCKET
6362 call Spectranet.HLCALL
64- pop namespace
6563 End Asm
6664End Function
6765
6866
6967Function FASTCALL SNETbind(socket as ubyte, port As uinteger) As byte
7068 Asm
71- push namespace core
7269 pop hl
7370 ex (sp), hl
7471 ex de, hl ; HL = port
7572 ld hl, Spectranet.BIND
7673 call Spectranet.HLCALL
77- pop namespace
7874 End Asm
7975End Function
8076
8177
8278Function FASTCALL SNETlisten(socket As ubyte) As byte
8379 Asm
84- push namespace core
8580 ld hl, Spectranet.LISTEN
8681 call Spectranet.HLCALL
87- pop namespace
8882 End Asm
8983End Function
9084
9185
9286Function FASTCALL SNETaccept(socket As ubyte) As byte
9387 Asm
94- push namespace core
9588 ld hl, Spectranet.ACCEPT
9689 call Spectranet.HLCALL
97- pop namespace
9890 End Asm
9991End Function
10092
10193
10294Function FASTCALL SNETconnect(socket As ubyte, ip$, port As uinteger) As byte
10395 Asm
104- push namespace core
10596 pop hl ; ret address
10697 pop de ; string containing the IP in CODE format. e.g. 10.0.0.1 = chr$( 10 , 0 , 0 , 1 )
10798 pop bc ; port
@@ -115,58 +106,49 @@ Function FASTCALL SNETconnect(socket As ubyte, ip$, port As uinteger) As byte
115106 ex af, af '
116107 call __MEM_FREE
117108 ex af, af '
118- pop namespace
119109 End Asm
120110End Function
121111
122112
123113Function FASTCALL SNETclose(socket As ubyte) As byte
124114 Asm
125- push namespace core
126115 ld hl, Spectranet.CLOSE
127116 call Spectranet.HLCALL
128- pop namespace
129117 End Asm
130118End Function
131119
132120
133121Function FASTCALL SNETrecv(socket As ubyte, addr As uinteger, length as uinteger) as byte
134122 Asm
135- push namespace core
136123 pop hl ; Ret address
137124 pop de ; address
138125 pop bc ; Length
139126 push hl ; Restore ret address
140127 ld hl, Spectranet.RECV
141128 call Spectranet.HLCALL
142- pop namespace
143129 End Asm
144130End Function
145131
146132
147133Function FASTCALL SNETsend(socket As ubyte, addr As uinteger, length as uinteger) as byte
148134 Asm
149- push namespace core
150135 pop hl ; Ret address
151136 pop de ; address
152137 pop bc ; Length
153138 push hl ; Restore ret address
154139 ld hl, Spectranet.SEND
155140 call Spectranet.HLCALL
156- pop namespace
157141 End Asm
158142End Function
159143
160144
161145Function FASTCALL SNETpollfd(socket As ubyte) as ubyte
162146 Asm
163- push namespace core
164147 ld hl, Spectranet.POLLFD
165148 call Spectranet.HLCALL
166149 ld a, 0
167150 ret z
168151 ld c, a
169- pop namespace
170152 End Asm
171153End Function
172154
@@ -176,7 +158,6 @@ End Function
176158' -----------------------------------------------------------
177159Function FASTCALL SNETpeekUinteger(addr as Uinteger) As UInteger
178160 Asm
179- push namespace core
180161 ex de, hl
181162 ld hl, Spectranet.PAGEIN
182163 call Spectranet.HLCALL
@@ -187,7 +168,6 @@ Function FASTCALL SNETpeekUinteger(addr as Uinteger) As UInteger
187168 ld hl, Spectranet.PAGEOUT
188169 call Spectranet.HLCALL
189170 ex de, hl
190- pop namespace
191171 End Asm
192172End Function
193173
@@ -221,15 +201,13 @@ Function SNETmount(mpoint as Ubyte, proto$, host$, source$, userid$, passwd$) As
221201
222202 ix = @buffer( 0 ) ' Useless, but will allow to calculate HL
223203 Asm
224- push namespace core
225204 ld a, (ix + 5 )
226205 push ix ; Must be restored upon return
227206 push hl
228207 pop ix
229208 ld hl, Spectranet.MOUNT
230209 call Spectranet.HLCALL
231210 pop ix
232- pop namespace
233211 End Asm
234212End Function
235213
@@ -248,10 +226,8 @@ End Function
248226' -----------------------------------------------------------
249227sub FASTCALL SNETsetmountpt(mpoint)
250228 Asm
251- push namespace core
252229 ld hl, Spectranet.SETMOUNTPOINT
253230 call Spectranet.HLCALL
254- pop namespace
255231 End Asm
256232End sub
257233
@@ -264,10 +240,8 @@ End sub
264240' -----------------------------------------------------------
265241Function FASTCALL SNETumount(mpoint as UByte) As UInteger
266242 Asm
267- push namespace core
268243 ld hl, Spectranet.UMOUNT
269244 call Spectranet.HLCALL
270- pop namespace
271245 End Asm
272246End Function
273247
@@ -292,7 +266,6 @@ Function SNETopen(mpoint as Ubyte, fname$, flags as UInteger, chmod as Uinteger)
292266 fname$ = ASCIIZ(fname$)
293267 addrOfFname = PEEK(Uinteger, @fname$) + 2
294268 Asm
295- push namespace core
296269 ld a, (ix + 5 ) ; mount point
297270 ld e, (ix + 8 )
298271 ld d, (ix + 9 ) ; de = flags (ORDONLY, etc...)
@@ -303,7 +276,6 @@ Function SNETopen(mpoint as Ubyte, fname$, flags as UInteger, chmod as Uinteger)
303276 ld ix, Spectranet.OPEN
304277 call Spectranet.IXCALL
305278 pop ix
306- pop namespace
307279 End Asm
308280End Function
309281
@@ -318,7 +290,6 @@ End Function
318290' -----------------------------------------------------------
319291Function FASTCALL SNETfread(fhandle as Ubyte, addr as Uinteger, size as Uinteger) As Uinteger
320292 Asm
321- push namespace core
322293 pop hl ; ret address
323294 pop de
324295 pop bc
@@ -329,7 +300,6 @@ Function FASTCALL SNETfread(fhandle as Ubyte, addr as Uinteger, size as Uinteger
329300 ld c, l
330301 ret nc
331302 ld (ERR_NR), a
332- pop namespace
333303 End Asm
334304End Function
335305
@@ -344,7 +314,6 @@ End Function
344314' -----------------------------------------------------------
345315Function FASTCALL SNETfwrite(fhandle as Ubyte, addr as Uinteger, size as Uinteger) As Uinteger
346316 Asm
347- push namespace core
348317 pop hl ; ret address
349318 pop de ; addr
350319 pop bc ; size
@@ -358,7 +327,6 @@ Function FASTCALL SNETfwrite(fhandle as Ubyte, addr as Uinteger, size as Uintege
358327 ld c, l
359328 ret nc
360329 ld (ERR_NR), a
361- pop namespace
362330 End Asm
363331End Function
364332
@@ -396,12 +364,10 @@ End Function
396364' -----------------------------------------------------------
397365Function FASTCALL SNETfclose(fhandle as Ubyte) As Byte
398366 Asm
399- push namespace core
400367 ld hl, Spectranet.CLOSE
401368 call Spectranet.HLCALL
402369 ret c
403370 xor a ; Ensures A = 0 on success
404- pop namespace
405371 End Asm
406372End Function
407373
@@ -415,7 +381,6 @@ End Function
415381' -----------------------------------------------------------
416382Function FASTCALL SNETfseek(fhandle as Ubyte, op as Ubyte, pos as ULong) as Byte
417383 Asm
418- push namespace core
419384 pop hl ; Return address
420385 ; pop af ; Not done. FASTCALL passes always the 1s parameter
421386 pop bc ; Bytes comes in the high part, so B.
@@ -429,7 +394,6 @@ Function FASTCALL SNETfseek(fhandle as Ubyte, op as Ubyte, pos as ULong) as Byte
429394 pop ix
430395 ret c
431396 xor a ; Ensures A = 0 on success
432- pop namespace
433397 End Asm
434398End function
435399
@@ -445,7 +409,6 @@ Function SNETunlink(fname$) AS Byte
445409 DIM addr as Uinteger
446410 addr = PEEK(Uinteger, @fname) + 2
447411 Asm
448- push namespace core
449412 PROC
450413 LOCAL CONT
451414 push ix
@@ -456,7 +419,6 @@ Function SNETunlink(fname$) AS Byte
456419 xor a ; Ensures A = 0 on success
457420 CONT:
458421 ENDP
459- pop namespace
460422 End Asm
461423End Function
462424
0 commit comments