source: trunk/libs/newlib/src/newlib/libc/sys/rdos/rdos.S @ 444

Last change on this file since 444 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 130.6 KB
Line 
1/*#######################################################################
2# RDOS operating system
3# Copyright (C) 1988-2006, Leif Ekblad
4#
5# This library is free software; you can redistribute it and/or modify
6# it under the terms of the GNU Lesser General Public License as published
7# by the Free Software Foundation; either version 2.1 of the License, or
8# (at your option) any later version.
9#
10# This library is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU Lesser General Public License for more details.
14#
15# You should have received a copy of the GNU Lesser General Public
16# License along with this library; if not, write to the Free Software
17# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18#
19# The author of this program may be contacted at leif@rdos.net
20#
21# rdos.S                                                               
22# GCC based interface to RDOS kernel                                   
23#
24##########################################################################*/
25
26#include "user.def"
27
28    .macro UserGate nr
29    .byte 0x9A
30    .long \nr
31    .word 2
32    .endm
33
34/*##########################################################################
35#
36#   Name       : RdosSwapShort
37#
38#   Purpose....: Byte reverse a short int
39#
40#   Returns....: Result
41#
42##########################################################################*/
43
44    .global RdosSwapShort
45   
46RdosSwapShort:
47        pushl %ebp
48        movl %esp,%ebp
49        movw 8(%ebp),%ax
50        xchgb %ah,%al
51        leave
52        ret
53
54
55/*##########################################################################
56#
57#   Name       : RdosSwapLong
58#
59#   Purpose....: Byte reverse a long int
60#
61#   Returns....: Result
62#
63##########################################################################*/
64
65    .global RdosSwapLong
66   
67RdosSwapLong:
68        pushl %ebp
69        movl %esp,%ebp
70        movl 8(%ebp),%eax
71        xchgb %ah,%al
72        roll $16,%eax
73        xchgb %ah,%al
74        leave
75        ret
76
77
78/*##########################################################################
79#
80#   Name       : LocalToNetworkLong
81#
82#   Purpose....: Convert a local long to network format
83#
84#   Returns....: Network format
85#
86##########################################################################*/
87
88    .global LocalToNetworkLong
89   
90LocalToNetworkLong:
91        pushl %ebp
92        movl %esp,%ebp
93        movl 8(%ebp),%eax
94        xchgb %ah,%al
95        roll $16,%eax
96        xchgb %ah,%al
97        leave
98        ret
99
100/*##########################################################################
101#
102#   Name       : NetworkToLocalLong
103#
104#   Purpose....: Convert a network long to local format
105#
106#   Returns....: Local format
107#
108##########################################################################*/
109
110    .global NetworkToLocalLong
111   
112NetworkToLocalLong:
113        pushl %ebp
114        movl %esp,%ebp
115        movl 8(%ebp),%eax
116        xchgb %ah,%al
117        roll $16,%eax
118        xchgb %ah,%al
119        leave
120        ret
121
122/*##########################################################################
123#
124#   Name       : RdosGetThreadHandle
125#
126#   Purpose....: Get current thread handle
127#
128#   Returns....: Thread ID
129#
130##########################################################################*/
131
132    .global RdosGetThreadHandle
133   
134RdosGetThreadHandle:
135        pushl %ebp
136        movl %esp,%ebp
137        UserGate get_thread_nr
138        movzx %ax,%eax
139        leave
140        ret
141
142/*##########################################################################
143#
144#   Name       : RdosGetThreadState
145#
146#   Purpose....: Get thread state
147#
148#   Parameters.: Thread #
149#                State buffer
150#
151##########################################################################*/
152
153    .global RdosGetThreadState
154   
155RdosGetThreadState:
156        pushl %ebp
157        movl %esp,%ebp
158        push %edi
159
160        movl 8(%ebp),%eax
161        movl 12(%ebp),%edx
162        UserGate get_thread_state_nr
163        jc rgtsFail
164       
165    movl $1,%eax
166    jmp rgtsDone
167   
168rgtsFail:
169    xorl %eax,%eax
170
171rgtsDone:
172        popl %edi
173        leave
174        ret
175
176/*##########################################################################
177#
178#   Name       : RdosSuspendThread
179#
180#   Purpose....: Suspend thread
181#
182#   Parameters.: Thread #
183#
184##########################################################################*/
185
186    .global RdosSuspendThread
187   
188RdosSuspendThread:
189        pushl %ebp
190        movl %esp,%ebp
191
192        movl 8(%ebp),%eax
193        UserGate suspend_thread_nr
194        jc rsfFail
195
196    movl $1,%eax
197    jmp rsfDone
198   
199rsfFail:
200    xorl %eax,%eax
201
202rsfDone:
203    leave
204    ret
205   
206
207/*##########################################################################
208#
209#   Name       : RdosExec
210#
211#   Purpose....: Execute a program
212#
213#   Parameters.: Program
214#                Commandline
215#
216##########################################################################*/
217
218    .global RdosExec
219   
220RdosExec:
221        pushl %ebp
222        movl %esp,%ebp
223        pushl %esi
224        pushl %edi
225
226        movl 8(%ebp),%esi
227        movl 12(%ebp),%edi
228
229        UserGate load_exe_nr
230        UserGate get_exit_code_nr
231
232        popl %edi
233        popl %esi
234        leave
235        ret
236   
237/*##########################################################################
238#
239#   Name       : RdosSpawn
240#
241#   Purpose....: Create new process and run a program
242#
243#   Parameters.: Program
244#                Commandline
245#                StartDir
246#
247##########################################################################*/
248
249    .global RdosSpawn
250   
251RdosSpawn:
252        pushl %ebp
253        movl %esp,%ebp
254        pushl %fs
255        pushl %ebx
256        pushl %edx
257        pushl %esi
258        pushl %edi
259
260    movw %ds,%dx
261    movw %dx,%fs
262    xorl %edx,%edx
263        movl 8(%ebp),%esi
264        movl 12(%ebp),%edi
265        movl 16(%ebp),%ebx
266        UserGate spawn_exe_nr
267        jc rsFail
268       
269    movzx %dx,%eax
270    jmp rsDone
271   
272rsFail:
273    xorl %eax,%eax
274
275rsDone:
276        popl %edi
277        popl %esi
278        popl %edx
279        popl %ebx
280        popw %fs
281        leave
282        ret
283   
284/*##########################################################################
285#
286#   Name       : RdosCpuReset
287#
288#   Purpose....: Cpu reset
289#
290##########################################################################*/
291
292    .global RdosCpuReset
293   
294RdosCpuReset:
295        pushl %ebp
296        movl %esp,%ebp
297        UserGate cpu_reset_nr
298        leave
299        ret
300   
301/*##########################################################################
302#
303#   Name       : RdosGetVersion
304#
305#   Purpose....: Get RDOS version
306#
307#   Parameters.: &major
308#                &minor
309#                &release
310#
311##########################################################################*/
312
313    .global RdosGetVersion
314   
315RdosGetVersion:
316        pushl %ebp
317        movl %esp,%ebp
318        pushl %eax
319        pushl %ecx
320        pushl %edx
321        pushl %edi
322
323        UserGate get_version_nr
324
325    movzx %dx,%edx
326        movl 8(%ebp),%edi
327        movl %edx,(%edi)
328
329    movzx %ax,%eax
330        movl 12(%ebp),%edi
331        movl %eax,(%edi)
332
333    movzx %cx,%eax
334        movl 16(%ebp),%edi
335        movl %eax,(%edi)
336
337        popl %edi
338        popl %edx
339        popl %ecx
340        popl %eax
341        leave
342        ret
343   
344/*##########################################################################
345#
346#   Name       : RdosAllocateMem
347#
348#   Purpose....: Allocate memory
349#
350#   Parameters.: Bytes to allocate
351#
352#   Returns....: Memory pointer
353#
354##########################################################################*/
355
356    .global RdosAllocateMem
357   
358RdosAllocateMem:
359        pushl %ebp
360        movl %esp,%ebp
361        pushl %edx
362
363        movl 8(%ebp),%eax
364        UserGate allocate_app_mem_nr
365        movl %edx,%eax
366
367        popl %edx
368        leave
369        ret
370   
371/*##########################################################################
372#
373#   Name       : RdosFreeMem
374#
375#   Purpose....: Free memory
376#
377#   Parameters.: Memory pointer
378#
379##########################################################################*/
380
381    .global RdosFreeMem
382
383RdosFreeMem:
384        pushl %ebp
385        movl %esp,%ebp
386        pushl %edx
387
388        movl 8(%ebp),%edx
389        UserGate free_app_mem_nr
390
391        popl %edx
392        leave
393        ret
394           
395/*##########################################################################
396#
397#   Name       : RdosAppDebug
398#
399#   Purpose....: App debug
400#
401##########################################################################*/
402
403    .global RdosAppDebug
404   
405RdosAppDebug:
406        pushl %ebp
407        movl %esp,%ebp
408        UserGate app_debug_nr
409        leave
410        ret
411                   
412/*##########################################################################
413#
414#   Name       : RdosWaitMilli
415#
416#   Purpose....: Wait a number of milliseconds
417#
418#   Parameters.: Milliseconds to wait
419#
420##########################################################################*/
421
422    .global RdosWaitMilli
423   
424RdosWaitMilli:
425        pushl %ebp
426        movl %esp,%ebp
427        pushl %eax
428
429        movl 8(%ebp),%eax
430        UserGate wait_milli_nr
431
432        popl %eax
433        leave
434        ret
435                           
436/*##########################################################################
437#
438#   Name       : RdosCreateSection
439#
440#   Purpose....: Create section
441#
442#   Returns....: Section handle
443#
444##########################################################################*/
445
446    .global RdosCreateSection
447   
448RdosCreateSection:
449        pushl %ebp
450        movl %esp,%ebp
451        pushl %ebx
452       
453        UserGate create_user_section_nr
454        movzx %bx,%eax
455
456        popl %ebx
457        leave
458        ret
459                           
460/*##########################################################################
461#
462#   Name       : RdosDeleteSection
463#
464#   Purpose....: Delete section
465#
466#   Parameters.: Section handle
467#
468##########################################################################*/
469
470    .global RdosDeleteSection
471   
472RdosDeleteSection:
473        pushl %ebp
474        movl %esp,%ebp
475        pushl %ebx
476
477        movw 8(%ebp),%bx
478        UserGate delete_user_section_nr
479
480        popl %ebx
481        leave
482        ret
483                                   
484/*##########################################################################
485#
486#   Name       : RdosEnterSection
487#
488#   Purpose....: Enter section
489#
490#   Parameters.: Section handle
491#
492##########################################################################*/
493
494    .global RdosEnterSection
495   
496RdosEnterSection:
497        pushl %ebp
498        movl %esp,%ebp
499        pushl %ebx
500
501        movw 8(%ebp),%bx
502        UserGate enter_user_section_nr
503
504        popl %ebx
505        leave
506        ret
507                                           
508/*##########################################################################
509#
510#   Name       : RdosLeaveSection
511#
512#   Purpose....: Leave section
513#
514#   Parameters.: Section handle
515#
516##########################################################################*/
517
518    .global RdosLeaveSection
519   
520RdosLeaveSection:
521        pushl %ebp
522        movl %esp,%ebp
523        pushl %ebx
524
525        movw 8(%ebp),%bx
526        UserGate leave_user_section_nr
527
528        popl %ebx
529        leave
530        ret
531                                   
532/*##########################################################################
533#
534#   Name       : RdosCreateWait
535#
536#   Purpose....: Create wait object
537#
538#   Returns....: Wait handle
539#
540##########################################################################*/
541
542    .global RdosCreateWait
543   
544RdosCreateWait:
545        pushl %ebp
546        movl %esp,%ebp
547        pushl %ebx
548
549        UserGate create_wait_nr
550        movzx %bx,%eax
551
552        popl %ebx
553        leave
554        ret
555                                           
556/*##########################################################################
557#
558#   Name       : RdosCloseWait
559#
560#   Purpose....: Close wait
561#
562#   Parameters.: Wait handle
563#
564##########################################################################*/
565
566    .global RdosCloseWait
567   
568RdosCloseWait:
569        pushl %ebp
570        movl %esp,%ebp
571        pushl %ebx
572
573        movw 8(%ebp),%bx
574        UserGate close_wait_nr
575
576        popl %ebx
577        leave
578        ret
579                                           
580/*##########################################################################
581#
582#   Name       : RdosCheckWait
583#
584#   Purpose....: Check wait state
585#
586#   Parameters.: Wait handle
587#
588#   Returns....: Signalled ID or 0
589#
590##########################################################################*/
591
592    .global RdosCheckWait
593   
594RdosCheckWait:
595        pushl %ebp
596        movl %esp,%ebp
597        pushl %ebx
598        pushl %ecx
599
600        movw 8(%ebp),%bx
601        UserGate is_wait_idle_nr
602    movl %ecx,%eax
603
604    popl %ecx
605        popl %ebx
606        leave
607        ret
608                                           
609/*##########################################################################
610#
611#   Name       : RdosWaitForever
612#
613#   Purpose....: Wait forever
614#
615#   Parameters.: Wait handle
616#
617#   Returns....: Signalled ID or 0
618#
619##########################################################################*/
620
621    .global RdosWaitForever
622   
623RdosWaitForever:
624        pushl %ebp
625        movl %esp,%ebp
626        pushl %ebx
627        pushl %ecx
628
629        movw 8(%ebp),%bx
630        UserGate wait_no_timeout_nr
631        jc rwfFail
632
633    movl %ecx,%eax
634    jmp rwfDone
635
636rwfFail:
637    xorl %eax,%eax
638
639rwfDone:
640    popl %ecx
641        popl %ebx
642        leave
643        ret
644                                           
645/*##########################################################################
646#
647#   Name       : RdosWaitTimeout
648#
649#   Purpose....: Wait with timeout
650#
651#   Parameters.: Wait handle
652#                Timeout in ms
653#
654#   Returns....: Signalled ID or 0
655#
656##########################################################################*/
657
658    .global RdosWaitTimeout
659   
660RdosWaitTimeout:
661        pushl %ebp
662        movl %esp,%ebp
663        pushl %ebx
664        pushl %ecx
665        pushl %edx
666
667        movl 12(%ebp),%eax
668        movl $1193,%edx
669        mull %edx
670        pushl %edx
671        pushl %eax
672    UserGate get_system_time_nr
673    popl %ebx
674    addl %ebx,%eax
675    popl %ebx
676    adcl %ebx,%edx
677        movw 8(%ebp),%bx
678        UserGate wait_timeout_nr
679        jc rwtFail
680
681    movl %ecx,%eax
682    jmp rwtDone
683
684rwtFail:
685    xorl %eax,%eax
686
687rwtDone:
688    popl %edx
689    popl %ecx
690        popl %ebx
691        leave
692        ret
693                                           
694/*##########################################################################
695#
696#   Name       : RdosStopWait
697#
698#   Purpose....: Stop wait
699#
700#   Parameters.: Wait handle
701#
702##########################################################################*/
703
704    .global RdosStopWait
705   
706RdosStopWait:
707        pushl %ebp
708        movl %esp,%ebp
709        pushl %ebx
710
711        movw 8(%ebp),%bx
712        UserGate stop_wait_nr
713
714        popl %ebx
715        leave
716        ret
717                                           
718/*##########################################################################
719#
720#   Name       : RdosRemoveWait
721#
722#   Purpose....: Remove wait object from wait handle
723#
724#   Parameters.: Wait handle
725#                ID
726#
727##########################################################################*/
728
729    .global RdosRemoveWait
730   
731RdosRemoveWait:
732        pushl %ebp
733        movl %esp,%ebp
734        pushl %ebx
735        pushl %ecx
736
737        movw 8(%ebp),%bx
738        movl 12(%ebp),%ecx
739        UserGate remove_wait_nr
740
741    popl %ecx
742        popl %ebx
743        leave
744        ret
745                                   
746/*##########################################################################
747#
748#   Name       : RdosCreateSignal
749#
750#   Purpose....: Create signal object
751#
752#   Returns....: Signal handle
753#
754##########################################################################*/
755
756    .global RdosCreateSignal
757   
758RdosCreateSignal:
759        pushl %ebp
760        movl %esp,%ebp
761        pushl %ebx
762
763        UserGate create_signal_nr
764        movzx %bx,%eax
765
766        popl %ebx
767        leave
768        ret
769                                           
770/*##########################################################################
771#
772#   Name       : RdosResetSignal
773#
774#   Purpose....: Reset signal
775#
776#   Parameters.: Signal handle
777#
778##########################################################################*/
779
780    .global RdosResetSignal
781   
782RdosResetSignal:
783        pushl %ebp
784        movl %esp,%ebp
785        pushl %ebx
786
787        movw 8(%ebp),%bx
788        UserGate reset_signal_nr
789
790        popl %ebx
791        leave
792        ret
793                                           
794/*##########################################################################
795#
796#   Name       : RdosIsSignalled
797#
798#   Purpose....: Check if signalled
799#
800#   Parameters.: Signal handle
801#
802#   Returns....: TRUE if signalled
803#
804##########################################################################*/
805
806    .global RdosIsSignalled
807   
808RdosIsSignalled:
809        pushl %ebp
810        movl %esp,%ebp
811        pushl %ebx
812
813        movw 8(%ebp),%bx
814        UserGate is_signalled_nr
815        jc risdFree
816
817    movl $1,%eax
818    jmp risdDone       
819
820risdFree:
821    xorl %eax,%eax
822
823risdDone:
824        popl %ebx
825        leave
826        ret
827                                           
828/*##########################################################################
829#
830#   Name       : RdosSetSignal
831#
832#   Purpose....: Set signal
833#
834#   Parameters.: Signal handle
835#
836##########################################################################*/
837
838    .global RdosSetSignal
839   
840RdosSetSignal:
841        pushl %ebp
842        movl %esp,%ebp
843        pushl %ebx
844
845        movw 8(%ebp),%bx
846        UserGate set_signal_nr
847
848        popl %ebx
849        leave
850        ret
851                                           
852/*##########################################################################
853#
854#   Name       : RdosFreeSignal
855#
856#   Purpose....: Free signal handle
857#
858#   Parameters.: Signal handle
859#
860##########################################################################*/
861
862    .global RdosFreeSignal
863   
864RdosFreeSignal:
865        pushl %ebp
866        movl %esp,%ebp
867        pushl %ebx
868
869        movw 8(%ebp),%bx
870        UserGate free_signal_nr
871
872        popl %ebx
873        leave
874        ret
875                                           
876/*##########################################################################
877#
878#   Name       : RdosAddWaitForSignal
879#
880#   Purpose....: Add signal object to wait handle
881#
882#   Parameters.: Wait handle
883#                Signal handle
884#                ID
885#
886##########################################################################*/
887
888    .global RdosAddWaitForSignal
889   
890RdosAddWaitForSignal:
891        pushl %ebp
892        movl %esp,%ebp
893        pushl %ebx
894        pushl %ecx
895
896        movw 8(%ebp),%bx
897        movw 12(%ebp),%ax
898        movl 16(%ebp),%ecx
899        UserGate add_wait_for_signal_nr
900
901    popl %ecx
902        popl %ebx
903        leave
904        ret
905                                           
906/*##########################################################################
907#
908#   Name       : RdosAddWaitForKeyboard
909#
910#   Purpose....: Add keyboard to wait handle
911#
912#   Parameters.: Wait handle
913#                ID
914#
915##########################################################################*/
916
917    .global RdosAddWaitForKeyboard
918   
919RdosAddWaitForKeyboard:
920        pushl %ebp
921        movl %esp,%ebp
922        pushl %ebx
923        pushl %ecx
924
925        movw 8(%ebp),%bx
926        movl 12(%ebp),%ecx
927        UserGate add_wait_for_keyboard_nr
928
929    popl %ecx
930        popl %ebx
931        leave
932        ret
933                                           
934/*##########################################################################
935#
936#   Name       : RdosAddWaitForMouse
937#
938#   Purpose....: Add mouse to wait handle
939#
940#   Parameters.: Wait handle
941#                ID
942#
943##########################################################################*/
944
945    .global RdosAddWaitForMouse
946   
947RdosAddWaitForMouse:
948        pushl %ebp
949        movl %esp,%ebp
950        pushl %ebx
951        pushl %ecx
952
953        movw 8(%ebp),%bx
954        movl 12(%ebp),%ecx
955        UserGate add_wait_for_mouse_nr
956
957    popl %ecx
958        popl %ebx
959        leave
960        ret
961                                           
962/*##########################################################################
963#
964#   Name       : RdosAddWaitForCom
965#
966#   Purpose....: Add com object to wait handle
967#
968#   Parameters.: Wait handle
969#                Com handle
970#                ID
971#
972##########################################################################*/
973
974    .global RdosAddWaitForCom
975   
976RdosAddWaitForCom:
977        pushl %ebp
978        movl %esp,%ebp
979        pushl %ebx
980        pushl %ecx
981
982        movw 8(%ebp),%bx
983        movw 12(%ebp),%ax
984        movl 16(%ebp),%ecx
985        UserGate add_wait_for_com_nr
986
987    popl %ecx
988        popl %ebx
989        leave
990        ret
991                                           
992/*##########################################################################
993#
994#   Name       : RdosAddWaitForAdc
995#
996#   Purpose....: Add ADC object to wait handle
997#
998#   Parameters.: Wait handle
999#                Adc handle
1000#                ID
1001#
1002##########################################################################*/
1003
1004    .global RdosAddWaitForAdc
1005   
1006RdosAddWaitForAdc:
1007        pushl %ebp
1008        movl %esp,%ebp
1009        pushl %ebx
1010        pushl %ecx
1011
1012        movw 8(%ebp),%bx
1013        movw 12(%ebp),%ax
1014        movl 16(%ebp),%ecx
1015        UserGate add_wait_for_adc_nr
1016
1017    popl %ecx
1018        popl %ebx
1019        leave
1020        ret
1021                                           
1022/*##########################################################################
1023#
1024#   Name       : RdosSetTextMode
1025#
1026#   Purpose....: Set text mode
1027#
1028##########################################################################*/
1029
1030    .global RdosSetTextMode
1031   
1032RdosSetTextMode:
1033        pushl %ebp
1034        movl %esp,%ebp
1035
1036        movw $3,%ax
1037    UserGate set_video_mode_nr
1038
1039        leave
1040        ret
1041                                           
1042/*##########################################################################
1043#
1044#   Name       : RdosSetVideoMode
1045#
1046#   Purpose....: Set video mode
1047#
1048#   Parameters.: &xres
1049#                &yres
1050#                &linesize
1051#                &LFB
1052#
1053#   Returns....: Bitmap handle
1054#
1055##########################################################################*/
1056
1057    .global RdosSetVideoMode
1058   
1059RdosSetVideoMode:
1060        pushl %ebp
1061        movl %esp,%ebp
1062        pushl %ebx
1063        pushl %ecx
1064        pushl %edx
1065        pushl %esi
1066        pushl %edi
1067
1068        movl 8(%ebp),%edi
1069        movw (%edi),%ax
1070
1071        movl 12(%ebp),%edi
1072        movw (%edi),%cx
1073
1074        movl 16(%ebp),%edi
1075        movw (%edi),%dx
1076
1077        UserGate get_video_mode_nr
1078        jc set_video_fail
1079
1080    UserGate set_video_mode_nr
1081    jc set_video_fail
1082
1083        pushl %edi
1084        movl 8(%ebp),%edi
1085        movzx %ax,%eax
1086        movl %eax,(%edi)
1087
1088        movl 12(%ebp),%edi
1089        movzx %cx,%ecx
1090        movl %ecx,(%edi)
1091
1092        movl 16(%ebp),%edi
1093        movzx %dx,%edx
1094        movl %edx,(%edi)
1095
1096        movl 20(%ebp),%edi
1097        movzx %si,%esi
1098        movl %esi,(%edi)
1099        popl %edi
1100
1101        movl 24(%ebp),%eax
1102        movl %edi,(%eax)
1103
1104        movzx %bx,%eax
1105        jmp set_video_done
1106
1107set_video_fail:
1108        xorl %eax,%eax
1109        movl 8(%ebp),%edi
1110        movl %eax,(%edi)
1111        movl 12(%ebp),%edi
1112        movl %eax,(%edi)
1113        movl 16(%ebp),%edi
1114        movl %eax,(%edi)
1115        movl 20(%ebp),%edi
1116        movl %eax,(%edi)
1117        movl 24(%ebp),%edi
1118        movl %eax,(%edi)
1119
1120set_video_done:
1121        popl %edi
1122        popl %esi
1123        popl %edx
1124        popl %ecx
1125        popl %ebx
1126        leave
1127        ret
1128                                           
1129/*##########################################################################
1130#
1131#   Name       : RdosSetClipRect
1132#
1133#   Purpose....: Set clip rectangle
1134#
1135#   Parameters.: Bitmap handle
1136#                xmin, xmax, ymin, ymax
1137#
1138##########################################################################*/
1139
1140    .global RdosSetClipRect
1141   
1142RdosSetClipRect:
1143        pushl %ebp
1144        movl %esp,%ebp
1145        pushl %ebx
1146        pushl %ecx
1147        pushl %edx
1148        pushl %esi
1149        pushl %edi
1150
1151        movw 8(%ebp),%bx
1152        movw 12(%ebp),%cx
1153        movw 16(%ebp),%dx
1154        movw 20(%ebp),%si
1155        movw 24(%ebp),%di
1156        UserGate set_clip_rect_nr
1157
1158    popl %edi
1159    popl %esi
1160    popl %edx
1161    popl %ecx
1162        popl %ebx
1163        leave
1164        ret
1165                                           
1166/*##########################################################################
1167#
1168#   Name       : RdosClearClipRect
1169#
1170#   Purpose....: Clear clip rectangle
1171#
1172#   Parameters.: Bitmap handle
1173#
1174##########################################################################*/
1175
1176    .global RdosClearClipRect
1177   
1178RdosClearClipRect:
1179        pushl %ebp
1180        movl %esp,%ebp
1181        pushl %ebx
1182
1183        movw 8(%ebp),%bx
1184        UserGate clear_clip_rect_nr
1185
1186        popl %ebx
1187        leave
1188        ret
1189                                           
1190/*##########################################################################
1191#
1192#   Name       : RdosSetDrawColor
1193#
1194#   Purpose....: Set draw color
1195#
1196#   Parameters.: Bitmap handle
1197#                Color
1198#
1199##########################################################################*/
1200
1201    .global RdosSetDrawColor
1202   
1203RdosSetDrawColor:
1204        pushl %ebp
1205        movl %esp,%ebp
1206        pushl %eax
1207        pushl %ebx
1208
1209        movw 8(%ebp),%bx
1210        movl 12(%ebp),%eax
1211        UserGate set_drawcolor_nr
1212
1213        popl %ebx
1214        popl %eax
1215        leave
1216        ret
1217                                           
1218/*##########################################################################
1219#
1220#   Name       : RdosSetLGOP
1221#
1222#   Purpose....: Set draw color
1223#
1224#   Parameters.: Bitmap handle
1225#                LGOP
1226#
1227##########################################################################*/
1228
1229    .global RdosSetLGOP
1230   
1231RdosSetLGOP:
1232        pushl %ebp
1233        movl %esp,%ebp
1234        pushl %eax
1235        pushl %ebx
1236
1237        movw 8(%ebp),%bx
1238        movw 12(%ebp),%ax
1239        UserGate set_lgop_nr
1240
1241        popl %ebx
1242        popl %eax
1243        leave
1244        ret
1245                                           
1246/*##########################################################################
1247#
1248#   Name       : RdosSetHollowStyle
1249#
1250#   Purpose....: Set hollow fill style
1251#
1252#   Parameters.: Bitmap handle
1253#
1254##########################################################################*/
1255
1256    .global RdosSetHollowStyle
1257   
1258RdosSetHollowStyle:
1259        pushl %ebp
1260        movl %esp,%ebp
1261        pushl %ebx
1262
1263        movw 8(%ebp),%bx
1264        UserGate set_hollow_style_nr
1265
1266        popl %ebx
1267        leave
1268        ret
1269                                           
1270/*##########################################################################
1271#
1272#   Name       : RdosSetFilledStyle
1273#
1274#   Purpose....: Set filled fill style
1275#
1276#   Parameters.: Bitmap handle
1277#
1278##########################################################################*/
1279
1280    .global RdosSetFilledStyle
1281   
1282RdosSetFilledStyle:
1283        pushl %ebp
1284        movl %esp,%ebp
1285        pushl %ebx
1286
1287        movw 8(%ebp),%bx
1288        UserGate set_filled_style_nr
1289
1290        popl %ebx
1291        leave
1292        ret
1293                                           
1294/*##########################################################################
1295#
1296#   Name       : RdosOpenFont
1297#
1298#   Purpose....: Open a font
1299#
1300#   Parameters.: height
1301#
1302#   Returns....: Font handle
1303#
1304##########################################################################*/
1305
1306    .global RdosOpenFont
1307   
1308RdosOpenFont:
1309        pushl %ebp
1310        movl %esp,%ebp
1311        pushl %ebx
1312
1313        movw 8(%ebp),%ax
1314        UserGate open_font_nr
1315        movzx %bx,%eax
1316
1317        popl %ebx
1318        leave
1319        ret
1320                                           
1321/*##########################################################################
1322#
1323#   Name       : RdosCloseFont
1324#
1325#   Purpose....: Close font handle
1326#
1327#   Parameters.: Font handle
1328#
1329##########################################################################*/
1330
1331    .global RdosCloseFont
1332   
1333RdosCloseFont:
1334        pushl %ebp
1335        movl %esp,%ebp
1336        pushl %ebx
1337
1338        movw 8(%ebp),%bx
1339        UserGate close_font_nr
1340
1341        popl %ebx
1342        leave
1343        ret
1344                                           
1345/*##########################################################################
1346#
1347#   Name       : RdosGetStringMetrics
1348#
1349#   Purpose....: Get string metrics for text using font
1350#
1351#   Parameters.: Font handle
1352#                String
1353#                &width
1354#                &height
1355#
1356##########################################################################*/
1357
1358    .global RdosGetStringMetrics
1359   
1360RdosGetStringMetrics:
1361        pushl %ebp
1362        movl %esp,%ebp
1363        pushl %ebx
1364        pushl %ecx
1365        pushl %edx
1366        pushl %edi
1367
1368        movw 8(%ebp),%bx
1369        movl 12(%ebp),%edi
1370        UserGate get_string_metrics_nr
1371
1372        movl 16(%ebp),%edi
1373        movzx %cx,%ecx
1374        movl %ecx,(%edi)
1375       
1376        movl 20(%ebp),%edi
1377        movzx %dx,%edx
1378        movl %edx,(%edi)
1379
1380        popl %edi
1381        popl %edx
1382        popl %ecx
1383        popl %ebx
1384        leave
1385        ret
1386                                                                                   
1387/*##########################################################################
1388#
1389#   Name       : RdosSetFont
1390#
1391#   Purpose....: Set font
1392#
1393#   Parameters.: Bitmap handle
1394#                Font handle
1395#
1396##########################################################################*/
1397
1398    .global RdosSetFont
1399   
1400RdosSetFont:
1401        pushl %ebp
1402        movl %esp,%ebp
1403        pushl %eax
1404        pushl %ebx
1405
1406        movw 8(%ebp),%bx
1407        movw 12(%ebp),%ax
1408        UserGate set_font_nr
1409
1410        popl %ebx
1411        popl %eax
1412        leave
1413        ret
1414                                                                                   
1415/*##########################################################################
1416#
1417#   Name       : RdosGetPixel
1418#
1419#   Purpose....: Get pixel
1420#
1421#   Parameters.: Bitmap handle
1422#                x, y
1423#
1424##########################################################################*/
1425
1426    .global RdosGetPixel
1427   
1428RdosGetPixel:
1429        pushl %ebp
1430        movl %esp,%ebp
1431        pushl %ebx
1432        pushl %ecx
1433        pushl %edx
1434
1435        movw 8(%ebp),%bx
1436        movw 12(%ebp),%cx
1437        movw 16(%ebp),%dx
1438        UserGate get_pixel_nr
1439
1440        popl %edx
1441        popl %ecx
1442        popl %ebx
1443        leave
1444        ret
1445                                                                                   
1446/*##########################################################################
1447#
1448#   Name       : RdosSetPixel
1449#
1450#   Purpose....: Set pixel
1451#
1452#   Parameters.: Bitmap handle
1453#                x, y
1454#
1455##########################################################################*/
1456
1457    .global RdosSetPixel
1458   
1459RdosSetPixel:
1460        pushl %ebp
1461        movl %esp,%ebp
1462        pushl %ebx
1463        pushl %ecx
1464        pushl %edx
1465
1466        movw 8(%ebp),%bx
1467        movw 12(%ebp),%cx
1468        movw 16(%ebp),%dx
1469        UserGate set_pixel_nr
1470
1471        popl %edx
1472        popl %ecx
1473        popl %ebx
1474        leave
1475        ret
1476                                                                                   
1477/*##########################################################################
1478#
1479#   Name       : RdosBlit
1480#
1481#   Purpose....: Blit
1482#
1483#   Parameters.: SrcHandle
1484#                DestHandle
1485#                width, height
1486#                SrcX, SrcY
1487#                DestX, DestY
1488#
1489##########################################################################*/
1490
1491    .global RdosBlit
1492   
1493RdosBlit:
1494        pushl %ebp
1495        movl %esp,%ebp
1496        pushl %eax
1497        pushl %ebx
1498        pushl %ecx
1499        pushl %edx
1500        pushl %esi
1501        pushl %edi
1502;
1503        movw 8(%ebp),%ax
1504        movw 12(%ebp),%bx
1505        movw 16(%ebp),%cx
1506        movw 20(%ebp),%dx
1507        movw 28(%ebp),%si
1508        shll $16,%esi
1509        movw 24(%ebp),%si
1510        movw 36(%ebp),%di
1511        shll $16,%edi
1512        movw 32(%ebp),%di
1513        UserGate blit_nr
1514
1515        popl %edi
1516        popl %esi
1517        popl %edx
1518        popl %ecx
1519        popl %ebx
1520        popl %eax
1521        leave
1522        ret
1523                                                                                   
1524/*##########################################################################
1525#
1526#   Name       : RdosDrawMask
1527#
1528#   Purpose....: Draw mask
1529#
1530#   Parameters.: Bitmap handle
1531#                mask
1532#                RowSize
1533#                width, height
1534#                SrcX, SrcY
1535#                DestX, DestY
1536#
1537##########################################################################*/
1538
1539    .global RdosDrawMask
1540   
1541RdosDrawMask:
1542        pushl %ebp
1543        movl %esp,%ebp
1544        pushl %eax
1545        pushl %ebx
1546        pushl %ecx
1547        pushl %edx
1548        pushl %esi
1549        pushl %edi
1550;
1551        movw 8(%ebp),%bx
1552        movl 12(%ebp),%edi
1553        movw 16(%ebp),%ax
1554        movw 24(%ebp),%si
1555        shll $16,%esi
1556        movw 20(%ebp),%si
1557        movw 32(%ebp),%cx
1558        shll $16,%ecx
1559        movw 28(%ebp),%cx
1560        movw 40(%ebp),%dx
1561        shll $16,%edx
1562        movw 36(%ebp),%dx
1563        UserGate draw_mask_nr
1564
1565        popl %edi
1566        popl %esi
1567        popl %edx
1568        popl %ecx
1569        popl %ebx
1570        popl %eax
1571        leave
1572        ret
1573                                                                                   
1574/*##########################################################################
1575#
1576#   Name       : RdosDrawLine
1577#
1578#   Purpose....: Draw a line
1579#
1580#   Parameters.: Bitmap handle
1581#                x1, y1
1582#                x2, y2
1583#
1584##########################################################################*/
1585
1586    .global RdosDrawLine
1587   
1588RdosDrawLine:
1589        pushl %ebp
1590        movl %esp,%ebp
1591        pushl %ebx
1592        pushl %ecx
1593        pushl %edx
1594        pushl %esi
1595        pushl %edi
1596;
1597        movw 8(%ebp),%bx
1598        movw 12(%ebp),%cx
1599        movw 16(%ebp),%dx
1600        movw 20(%ebp),%si
1601        movw 24(%ebp),%di
1602        UserGate draw_line_nr
1603
1604        popl %edi
1605        popl %esi
1606        popl %edx
1607        popl %ecx
1608        popl %ebx
1609        leave
1610        ret
1611                                                                                   
1612/*##########################################################################
1613#
1614#   Name       : RdosDrawString
1615#
1616#   Purpose....: Draw a string
1617#
1618#   Parameters.: Bitmap handle
1619#                x, y
1620#                string
1621#
1622##########################################################################*/
1623
1624    .global RdosDrawString
1625   
1626RdosDrawString:
1627        pushl %ebp
1628        movl %esp,%ebp
1629        pushl %ebx
1630        pushl %ecx
1631        pushl %edx
1632        pushl %edi
1633;
1634        movw 8(%ebp),%bx
1635        movw 12(%ebp),%cx
1636        movw 16(%ebp),%dx
1637        movl 20(%ebp),%edi
1638        UserGate draw_string_nr
1639
1640        popl %edi
1641        popl %edx
1642        popl %ecx
1643        popl %ebx
1644        leave
1645        ret
1646                                                                                   
1647/*##########################################################################
1648#
1649#   Name       : RdosDrawRect
1650#
1651#   Purpose....: Draw a rect
1652#
1653#   Parameters.: Bitmap handle
1654#                x, y
1655#                width, height
1656#
1657##########################################################################*/
1658
1659    .global RdosDrawRect
1660   
1661RdosDrawRect:
1662        pushl %ebp
1663        movl %esp,%ebp
1664        pushl %ebx
1665        pushl %ecx
1666        pushl %edx
1667        pushl %esi
1668        pushl %edi
1669
1670        movw 8(%ebp),%bx
1671        movw 12(%ebp),%cx
1672        movw 16(%ebp),%dx
1673        movw 20(%ebp),%si
1674        movw 24(%ebp),%di
1675        UserGate draw_rect_nr
1676
1677        popl %edi
1678        popl %esi
1679        popl %edx
1680        popl %ecx
1681        popl %ebx
1682        leave
1683        ret
1684                                                                                   
1685/*##########################################################################
1686#
1687#   Name       : RdosDrawEllipse
1688#
1689#   Purpose....: Draw an ellipse
1690#
1691#   Parameters.: Bitmap handle
1692#                x, y
1693#                width, height
1694#
1695##########################################################################*/
1696
1697    .global RdosDrawEllipse
1698   
1699RdosDrawEllipse:
1700        pushl %ebp
1701        movl %esp,%ebp
1702        pushl %ebx
1703        pushl %ecx
1704        pushl %edx
1705        pushl %esi
1706        pushl %edi
1707
1708        movw 8(%ebp),%bx
1709        movw 12(%ebp),%cx
1710        movw 16(%ebp),%dx
1711        movw 20(%ebp),%si
1712        movw 24(%ebp),%di
1713        UserGate draw_ellipse_nr
1714
1715        popl %edi
1716        popl %esi
1717        popl %edx
1718        popl %ecx
1719        popl %ebx
1720        leave
1721        ret
1722                                           
1723/*##########################################################################
1724#
1725#   Name       : RdosCreateBitmap
1726#
1727#   Purpose....: Create a bitmap
1728#
1729#   Parameters.: BitsPerPixel
1730#                width, height
1731#
1732#   Returns....: Bitmap handle
1733#
1734##########################################################################*/
1735
1736    .global RdosCreateBitmap
1737   
1738RdosCreateBitmap:
1739        pushl %ebp
1740        movl %esp,%ebp
1741        pushl %ebx
1742        pushl %ecx
1743        pushl %edx
1744
1745        movw 8(%ebp),%ax
1746        movw 12(%ebp),%cx
1747        movw 16(%ebp),%dx
1748        UserGate create_bitmap_nr
1749        movzx %bx,%eax
1750;
1751        popl %edx
1752        popl %ecx
1753        popl %ebx
1754        leave
1755        ret
1756                                                                                   
1757/*##########################################################################
1758#
1759#   Name       : RdosDuplicateBitmapHandle
1760#
1761#   Purpose....: Duplicate bitmap handle for use in another thread / object
1762#
1763#   Parameters.: Bitmap handle
1764#
1765#   Returns....: Bitmap handle
1766#
1767##########################################################################*/
1768
1769    .global RdosDuplicateBitmapHandle
1770   
1771RdosDuplicateBitmapHandle:
1772        pushl %ebp
1773        movl %esp,%ebp
1774        pushl %ebx
1775
1776        movw 8(%ebp),%bx
1777        UserGate dup_bitmap_handle_nr
1778        movzx %bx,%eax
1779
1780        popl %ebx
1781        leave
1782        ret
1783                                                                                   
1784/*##########################################################################
1785#
1786#   Name       : RdosCloseBitmap
1787#
1788#   Purpose....: Close bitmap handle
1789#
1790#   Parameters.: Bitmap handle
1791#
1792##########################################################################*/
1793
1794    .global RdosCloseBitmap
1795   
1796RdosCloseBitmap:
1797        pushl %ebp
1798        movl %esp,%ebp
1799        pushl %ebx
1800
1801        movw 8(%ebp),%bx
1802        UserGate close_bitmap_nr
1803
1804        popl %ebx
1805        leave
1806        ret
1807                                                                                   
1808/*##########################################################################
1809#
1810#   Name       : RdosCreateStringBitmap
1811#
1812#   Purpose....: Create bitmap from string & font
1813#
1814#   Parameters.: Font
1815#                string
1816#
1817#   Returns....: Bitmap handle
1818#
1819##########################################################################*/
1820
1821    .global RdosCreateStringBitmap
1822   
1823RdosCreateStringBitmap:
1824        pushl %ebp
1825        movl %esp,%ebp
1826        pushl %ebx
1827        pushl %edi
1828
1829        movw 8(%ebp),%bx
1830        movl 12(%ebp),%edi
1831        UserGate create_string_bitmap_nr
1832        movzx %bx,%eax
1833;
1834        popl %edi
1835        popl %ebx
1836        leave
1837        ret
1838                                                                                   
1839/*##########################################################################
1840#
1841#   Name       : RdosGetBitmapInfo
1842#
1843#   Purpose....: Get info about bitmap
1844#
1845#   Parameters.: Bitmap handle
1846#                &BitsPerPixel
1847#                &width, &height
1848#                &linesize
1849#                &LFB
1850#
1851##########################################################################*/
1852
1853    .global RdosGetBitmapInfo
1854   
1855RdosGetBitmapInfo:
1856        pushl %ebp
1857        movl %esp,%ebp
1858        pushl %eax
1859        pushl %ebx
1860        pushl %ecx
1861        pushl %edx
1862        pushl %esi
1863        pushl %edi
1864
1865        movw 8(%ebp),%bx
1866        UserGate get_bitmap_info_nr
1867        jc gbiFail
1868
1869        pushl %edi
1870        movl 12(%ebp),%edi
1871        movzx %al,%eax
1872        movl %eax,(%edi)
1873
1874        movl 16(%ebp),%edi
1875        movzx %cx,%ecx
1876        movl %ecx,(%edi)
1877       
1878        movl 20(%ebp),%edi
1879        movzx %dx,%edx
1880        movl %edx,(%edi)
1881
1882        movl 24(%ebp),%edi
1883        movzx %si,%esi
1884        movl %esi,(%edi)
1885        popl %edi
1886       
1887        movl 28(%ebp),%eax
1888        movl %edi,(%eax)
1889        jmp gbiDone
1890
1891gbiFail:
1892        xorl %eax,%eax
1893        movl 12(%ebp),%edi
1894        movl %eax,(%edi)
1895
1896        movl 16(%ebp),%edi
1897        movl %eax,(%edi)
1898
1899        movl 20(%ebp),%edi
1900        movl %eax,(%edi)
1901
1902        movl 24(%ebp),%edi
1903        movl %eax,(%edi)
1904
1905        movl 28(%ebp),%edi
1906        movl %eax,(%edi)
1907
1908gbiDone:
1909        popl %edi
1910        popl %esi
1911        popl %edx
1912        popl %ecx
1913        popl %ebx
1914        popl %eax
1915        leave
1916        ret
1917                                           
1918/*##########################################################################
1919#
1920#   Name       : RdosCreateSprite
1921#
1922#   Purpose....: Create a sprite
1923#
1924#   Parameters.: dest
1925#                bitmap
1926#                mask
1927#                LGOP
1928#
1929#   Returns....: Sprite handle
1930#
1931##########################################################################*/
1932
1933    .global RdosCreateSprite
1934   
1935RdosCreateSprite:
1936        pushl %ebp
1937        movl %esp,%ebp
1938        pushl %ebx
1939        pushl %ecx
1940        pushl %edx
1941
1942        movw 8(%ebp),%bx
1943        movw 12(%ebp),%cx
1944        movw 16(%ebp),%dx
1945        movw 20(%ebp),%ax
1946        UserGate create_sprite_nr
1947        movzx %bx,%eax
1948
1949        popl %edx
1950        popl %ecx
1951        popl %ebx
1952        leave
1953        ret
1954                                                                                   
1955/*##########################################################################
1956#
1957#   Name       : RdosCloseSprite
1958#
1959#   Purpose....: Close sprite handle
1960#
1961#   Parameters.: Sprite handle
1962#
1963##########################################################################*/
1964
1965    .global RdosCloseSprite
1966   
1967RdosCloseSprite:
1968        pushl %ebp
1969        movl %esp,%ebp
1970        pushl %ebx
1971
1972        movw 8(%ebp),%bx
1973        UserGate close_sprite_nr
1974
1975        popl %ebx
1976        leave
1977        ret
1978                                                                                   
1979/*##########################################################################
1980#
1981#   Name       : RdosShowSprite
1982#
1983#   Purpose....: Show sprite
1984#
1985#   Parameters.: Sprite handle
1986#
1987##########################################################################*/
1988
1989    .global RdosShowSprite
1990   
1991RdosShowSprite:
1992        pushl %ebp
1993        movl %esp,%ebp
1994        pushl %ebx
1995
1996        movw 8(%ebp),%bx
1997        UserGate show_sprite_nr
1998
1999        popl %ebx
2000        leave
2001        ret
2002                                                                                   
2003/*##########################################################################
2004#
2005#   Name       : RdosHideSprite
2006#
2007#   Purpose....: Hide sprite
2008#
2009#   Parameters.: Sprite handle
2010#
2011##########################################################################*/
2012
2013    .global RdosHideSprite
2014   
2015RdosHideSprite:
2016        pushl %ebp
2017        movl %esp,%ebp
2018        pushl %ebx
2019
2020        movw 8(%ebp),%bx
2021        UserGate hide_sprite_nr
2022
2023        popl %ebx
2024        leave
2025        ret
2026                                                                                   
2027/*##########################################################################
2028#
2029#   Name       : RdosMoveSprite
2030#
2031#   Purpose....: Move sprite
2032#
2033#   Parameters.: Sprite handle
2034#                x, y
2035#
2036##########################################################################*/
2037
2038    .global RdosMoveSprite
2039   
2040RdosMoveSprite:
2041        pushl %ebp
2042        movl %esp,%ebp
2043        pushl %ebx
2044        pushl %ecx
2045        pushl %edx
2046
2047        movw 8(%ebp),%bx
2048        movw 12(%ebp),%cx
2049        movw 16(%ebp),%dx
2050        UserGate move_sprite_nr
2051
2052        popl %edx
2053        popl %ecx
2054        popl %ebx
2055        leave
2056        ret
2057                                                                                   
2058/*##########################################################################
2059#
2060#   Name       : RdosSetForeColor
2061#
2062#   Purpose....: Set text-mode fore color
2063#
2064#   Parameters.: palette index
2065#
2066##########################################################################*/
2067
2068    .global RdosSetForeColor
2069   
2070RdosSetForeColor:
2071        pushl %ebp
2072        movl %esp,%ebp
2073        pushl %eax
2074
2075        movb 8(%ebp),%al
2076        UserGate set_forecolor_nr
2077
2078        popl %eax
2079        leave
2080        ret
2081                                                                                   
2082/*##########################################################################
2083#
2084#   Name       : RdosSetBackColor
2085#
2086#   Purpose....: Set text-mode back color
2087#
2088#   Parameters.: palette index
2089#
2090##########################################################################*/
2091
2092    .global RdosSetBackColor
2093   
2094RdosSetBackColor:
2095        pushl %ebp
2096        movl %esp,%ebp
2097        pushl %eax
2098
2099        movb 8(%ebp),%al
2100        UserGate set_backcolor_nr
2101
2102        popl %eax
2103        leave
2104        ret
2105                                                                                   
2106/*##########################################################################
2107#
2108#   Name       : RdosGetSysTime
2109#
2110#   Purpose....: Get system time
2111#
2112#   Parameters.: &year, &month, &day
2113#                &hour, &min, &sec, &ms
2114#
2115##########################################################################*/
2116
2117    .global RdosGetSysTime
2118   
2119RdosGetSysTime:
2120        pushl %ebp
2121        movl %esp,%ebp
2122        pushal
2123
2124        UserGate get_system_time_nr
2125        pushl %eax
2126        UserGate binary_to_time_nr
2127        pushl %edx
2128
2129        movl 8(%ebp),%esi
2130        movzx %dx,%edx
2131        movl %edx,(%esi)
2132
2133        movl 12(%ebp),%esi
2134        movzx %ch,%edx
2135        movl %edx,(%esi)
2136
2137        movl 16(%ebp),%esi
2138        movzx %cl,%edx
2139        movl %edx,(%esi)
2140
2141        movl 20(%ebp),%esi
2142        movzx %bh,%edx
2143        movl %edx,(%esi)
2144
2145        movl 24(%ebp),%esi
2146        movzx %bl,%edx
2147        movl %edx,(%esi)
2148
2149        movl 28(%ebp),%esi
2150        movzx %ah,%edx
2151        movl %edx,(%esi)
2152
2153        popl %edx
2154        UserGate time_to_binary_nr
2155        movl %eax,%ebx
2156        popl %eax
2157        subl %ebx,%eax
2158        xorl %edx,%edx
2159        movl $1192,%ebx
2160        divl %ebx
2161
2162        movl 32(%ebp),%esi
2163        movzx %ax,%eax
2164        movl %eax,(%esi)
2165
2166        popal
2167        leave
2168        ret
2169                                                                                   
2170/*##########################################################################
2171#
2172#   Name       : RdosGetTime
2173#
2174#   Purpose....: Get time
2175#
2176#   Parameters.: &year, &month, &day
2177#                &hour, &min, &sec, &ms
2178#
2179##########################################################################*/
2180
2181    .global RdosGetTime
2182   
2183RdosGetTime:
2184        pushl %ebp
2185        movl %esp,%ebp
2186        pushal
2187
2188        UserGate get_time_nr
2189        pushl %eax
2190        UserGate binary_to_time_nr
2191        pushl %edx
2192
2193        movl 8(%ebp),%esi
2194        movzx %dx,%edx
2195        movl %edx,(%esi)
2196
2197        movl 12(%ebp),%esi
2198        movzx %ch,%edx
2199        movl %edx,(%esi)
2200
2201        movl 16(%ebp),%esi
2202        movzx %cl,%edx
2203        movl %edx,(%esi)
2204
2205        movl 20(%ebp),%esi
2206        movzx %bh,%edx
2207        movl %edx,(%esi)
2208
2209        movl 24(%ebp),%esi
2210        movzx %bl,%edx
2211        movl %edx,(%esi)
2212
2213        movl 28(%ebp),%esi
2214        movzx %ah,%edx
2215        movl %edx,(%esi)
2216
2217        popl %edx
2218        UserGate time_to_binary_nr
2219        movl %eax,%ebx
2220        popl %eax
2221        subl %ebx,%eax
2222        xorl %edx,%edx
2223        movl $1192,%ebx
2224        divl %ebx
2225
2226        movl 32(%ebp),%esi
2227        movzx %ax,%eax
2228        movl %eax,(%esi)
2229
2230        popal
2231        leave
2232        ret
2233                                                                                   
2234/*##########################################################################
2235#
2236#   Name       : RdosSetTime
2237#
2238#   Purpose....: Set time
2239#
2240#   Parameters.: year, month, day
2241#                hour, min, sec, ms
2242#
2243##########################################################################*/
2244
2245    .global RdosSetTime
2246   
2247RdosSetTime:
2248        pushl %ebp
2249        movl %esp,%ebp
2250        pushal
2251
2252        movw 8(%ebp),%dx
2253        movb 12(%ebp),%ch
2254        movb 16(%ebp),%cl
2255        movb 20(%ebp),%bh
2256        movb 24(%ebp),%bl
2257        movb 28(%ebp),%ah
2258        UserGate time_to_binary_nr
2259
2260    movl %edx,%edi
2261    movl %eax,%esi
2262
2263        movl 32(%ebp),%eax
2264    movl $1192,%edx
2265    mull %edx
2266    addl %eax,%esi
2267    adcl $0,%edi   
2268
2269        UserGate get_system_time_nr
2270    subl %eax,%esi
2271    sbbl %edx,%edi
2272    movl %esi,%eax
2273    movl %edi,%edx
2274    UserGate update_time_nr
2275
2276        popal
2277        leave
2278        ret
2279                                                                                   
2280/*##########################################################################
2281#
2282#   Name       : RdosTicsToRecord
2283#
2284#   Purpose....: Convert tics to record format
2285#
2286#   Parameters.: MSB, LSB
2287#                &year, &month, &day
2288#                &hour, &min, &sec, &ms
2289#
2290##########################################################################*/
2291
2292    .global RdosTicsToRecord
2293   
2294RdosTicsToRecord:
2295        pushl %ebp
2296        movl %esp,%ebp
2297        pushal
2298
2299        movl 8(%ebp),%edx
2300        movl 12(%ebp),%eax
2301        addl $596,%eax
2302        adcl $0,%edx
2303        UserGate binary_to_time_nr
2304        pushl %edx
2305
2306        movl 16(%ebp),%esi
2307        movzx %dx,%edx
2308        movl %edx,(%esi)
2309
2310        movl 20(%ebp),%esi
2311        movzx %ch,%edx
2312        movl %edx,(%esi)
2313
2314        movl 24(%ebp),%esi
2315        movzx %cl,%edx
2316        movl %edx,(%esi)
2317
2318        movl 28(%ebp),%esi
2319        movzx %bh,%edx
2320        movl %edx,(%esi)
2321
2322        movl 32(%ebp),%esi
2323        movzx %bl,%edx
2324        movl %edx,(%esi)
2325
2326        movl 36(%ebp),%esi
2327        movzx %ah,%edx
2328        movl %edx,(%esi)
2329
2330        popl %edx
2331        UserGate time_to_binary_nr
2332        movl %eax,%ebx
2333        movl 12(%ebp),%eax
2334        subl %edx,%eax
2335        xorl %edx,%edx
2336        movl $1192,%ebx
2337        divl %ebx
2338
2339        movl 40(%ebp),%esi
2340        cmpw %ax,1000
2341        jne rttrSaveMs
2342
2343        decw %ax
2344
2345rttrSaveMs:     
2346        movzx %ax,%eax
2347        movl %eax,(%esi)
2348
2349        popal
2350        leave
2351        ret
2352                                                                                   
2353/*##########################################################################
2354#
2355#   Name       : RdosRecordToTics
2356#
2357#   Purpose....: Convert from record format to tics
2358#
2359#   Parameters.: &MSB, &LSB
2360#                year, month, day
2361#                hour, min, sec, ms
2362#
2363##########################################################################*/
2364
2365    .global RdosRecordToTics
2366   
2367RdosRecordToTics:
2368        pushl %ebp
2369        movl %esp,%ebp
2370        pushal
2371
2372        movl 40(%ebp),%eax
2373        movl $1192,%edx
2374        mull %edx
2375        pushl %eax
2376        movw 16(%ebp),%dx
2377        movb 20(%ebp),%ch
2378        movb 24(%ebp),%cl
2379        movb 28(%ebp),%bh
2380        movb 32(%ebp),%bl
2381        movb 36(%ebp),%ah
2382        UserGate time_to_binary_nr
2383        popl %ebx
2384        addl %ebx,%eax
2385        adcl $0,%edx
2386
2387        movl 8(%ebp),%esi
2388        movl %edx,(%esi)
2389
2390        movl 12(%ebp),%esi
2391        movl %eax,(%esi)
2392
2393        popal
2394        leave
2395        ret
2396                                                                                   
2397/*##########################################################################
2398#
2399#   Name       : RdosDecodeMsbTics
2400#
2401#   Purpose....: Decode MSB tics
2402#
2403#   Parameters.: MSB
2404#                &day, &hour
2405#
2406##########################################################################*/
2407
2408    .global RdosDecodeMsbTics
2409   
2410RdosDecodeMsbTics:
2411        pushl %ebp
2412        movl %esp,%ebp
2413        pushal
2414
2415        movl 8(%ebp),%eax
2416        xorl %edx,%edx
2417        movl $24,%ecx
2418        divl %ecx
2419
2420        movl 12(%ebp),%ebx
2421        movl %eax,(%ebx)
2422
2423        movl 16(%ebp),%ebx
2424        movl %edx,(%ebx)
2425
2426        popal
2427        leave
2428        ret
2429                                                                                   
2430/*##########################################################################
2431#
2432#   Name       : RdosDecodeLsbTics
2433#
2434#   Purpose....: Decode LSB tics
2435#
2436#   Parameters.: LSB
2437#                &min, &sec, &ms, &us
2438#
2439##########################################################################*/
2440
2441    .global RdosDecodeLsbTics
2442   
2443RdosDecodeLsbTics:
2444        pushl %ebp
2445        movl %esp,%ebp
2446        pushal
2447
2448        movl 8(%ebp),%eax
2449        movl $60,%edx
2450        mull %edx
2451        movl 12(%ebp),%ebx
2452        movl %edx,(%ebx)
2453
2454        movl $60,%edx
2455        mull %edx
2456        movl 16(%ebp),%ebx
2457        movl %edx,(%ebx)
2458
2459        movl $1000,%edx
2460        mull %edx
2461        movl 20(%ebp),%ebx
2462        movl %edx,(%ebx)
2463
2464        movl $1000,%edx
2465        mull %edx
2466        movl 24(%ebp),%ebx
2467        movl %edx,(%ebx)
2468
2469        popal
2470        leave
2471        ret
2472                                                                                   
2473/*##########################################################################
2474#
2475#   Name       : RdosDayOfWeek
2476#
2477#   Purpose....: Get day of week
2478#
2479#   Parameters.: year, month, day
2480#
2481#   Returns....: day of week
2482#
2483##########################################################################*/
2484
2485    .global RdosDayOfWeek
2486   
2487RdosDayOfWeek:
2488        pushl %ebp
2489        movl %esp,%ebp
2490        pushl %ebx
2491        pushl %ecx
2492        pushl %edx
2493
2494        movl 8(%ebp),%edx
2495        movb 12(%ebp),%ch
2496        movb 16(%ebp),%cl
2497    xorw %bx,%bx
2498    xorb %ah,%ah
2499        UserGate adjust_time_nr
2500        pushw %dx
2501        movl $365,%eax
2502        imulw %dx
2503        pushw %dx
2504        pushw %ax
2505        popl %ebx
2506        popw %dx
2507        UserGate passed_days_nr
2508        decw %dx
2509        shrw $2,%dx
2510        incw %dx
2511        addw %dx,%ax
2512        addl %ebx,%eax
2513    xorl %edx,%edx
2514    addl $5,%eax
2515    movl $7,%ebx
2516    divl %ebx
2517    movzx %dl,%eax
2518
2519        popl %edx
2520        popl %ecx
2521        popl %ebx
2522        leave
2523        ret
2524                                                                                   
2525/*##########################################################################
2526#
2527#   Name       : RdosGetTics
2528#
2529#   Purpose....: Get system tics
2530#
2531#   Parameters.: &MSB, &LSB
2532#
2533##########################################################################*/
2534
2535    .global RdosGetTics
2536   
2537RdosGetTics:
2538        pushl %ebp
2539        movl %esp,%ebp
2540        pushl %edx
2541        pushl %esi
2542
2543        UserGate get_time_nr
2544        movl 8(%ebp),%esi
2545        movl %edx,(%esi)
2546        movl 12(%ebp),%esi
2547        movl %eax,(%esi)
2548
2549        popl %esi
2550        popl %edx
2551        leave
2552        ret
2553                                                                                   
2554/*##########################################################################
2555#
2556#   Name       : RdosAddTics
2557#
2558#   Purpose....: Add tics to binary time
2559#
2560#   Parameters.: &MSB, &LSB
2561#                tics
2562#
2563##########################################################################*/
2564
2565    .global RdosAddTics
2566   
2567RdosAddTics:
2568        pushl %ebp
2569        movl %esp,%ebp
2570        pushl %ebx
2571
2572        movl 16(%ebp),%eax
2573        movl 12(%ebp),%ebx
2574        addl %eax,(%ebx)
2575        movl 8(%ebp),%ebx
2576        adcl $0,(%ebx)
2577
2578        popl %ebx
2579        leave
2580        ret
2581                                                                                   
2582/*##########################################################################
2583#
2584#   Name       : RdosAddMilli
2585#
2586#   Purpose....: Add milliseconds to binary time
2587#
2588#   Parameters.: &MSB, &LSB
2589#                milli
2590#
2591##########################################################################*/
2592
2593    .global RdosAddMilli
2594   
2595RdosAddMilli:
2596        pushl %ebp
2597        movl %esp,%ebp
2598        pushl %ebx
2599
2600        movl 16(%ebp),%eax
2601        movl $1193,%edx
2602        mull %edx
2603        movl 12(%ebp),%ebx
2604        addl %eax,(%ebx)
2605        movl 8(%ebp),%ebx
2606        adcl %edx,(%ebx)
2607
2608        popl %ebx
2609        leave
2610        ret
2611                                                                                   
2612/*##########################################################################
2613#
2614#   Name       : RdosAddSec
2615#
2616#   Purpose....: Add milliseconds to binary time
2617#
2618#   Parameters.: &MSB, &LSB
2619#                sec
2620#
2621##########################################################################*/
2622
2623    .global RdosAddSec
2624   
2625RdosAddSec:
2626        pushl %ebp
2627        movl %esp,%ebp
2628        pushl %ebx
2629
2630        movl 16(%ebp),%eax
2631        movl $1193000,%edx
2632        mull %edx
2633        movl 12(%ebp),%ebx
2634        addl %eax,(%ebx)
2635        movl 8(%ebp),%ebx
2636        adcl %edx,(%ebx)
2637
2638        popl %ebx
2639        leave
2640        ret
2641                                                                                   
2642/*##########################################################################
2643#
2644#   Name       : RdosAddMin
2645#
2646#   Purpose....: Add minutes to binary time
2647#
2648#   Parameters.: &MSB, &LSB
2649#                min
2650#
2651##########################################################################*/
2652
2653    .global RdosAddMin
2654   
2655RdosAddMin:
2656        pushl %ebp
2657        movl %esp,%ebp
2658        pushl %ebx
2659
2660        movl 16(%ebp),%eax
2661        movl $71582760,%edx
2662        mull %edx
2663        movl 12(%ebp),%ebx
2664        addl %eax,(%ebx)
2665        movl 8(%ebp),%ebx
2666        adcl %edx,(%ebx)
2667
2668        popl %ebx
2669        leave
2670        ret
2671                                                                                   
2672/*##########################################################################
2673#
2674#   Name       : RdosAddHour
2675#
2676#   Purpose....: Add hour to binary time
2677#
2678#   Parameters.: &MSB, &LSB
2679#                hour
2680#
2681##########################################################################*/
2682
2683    .global RdosAddHour
2684   
2685RdosAddHour:
2686        pushl %ebp
2687        movl %esp,%ebp
2688        pushl %ebx
2689
2690        movl 16(%ebp),%eax
2691        movl 8(%ebp),%ebx
2692        adc %eax,(%ebx)
2693
2694        popl %ebx
2695        leave
2696        ret
2697                                                                                   
2698/*##########################################################################
2699#
2700#   Name       : RdosAddDay
2701#
2702#   Purpose....: Add days to binary time
2703#
2704#   Parameters.: &MSB, &LSB
2705#                days
2706#
2707##########################################################################*/
2708
2709    .global RdosAddDay
2710   
2711RdosAddDay:
2712        pushl %ebp
2713        movl %esp,%ebp
2714        pushl %ebx
2715
2716        movl 16(%ebp),%eax
2717        movl $24,%edx
2718        mull %edx
2719        movl 8(%ebp),%ebx
2720        adc %eax,(%ebx)
2721
2722        popl %ebx
2723        leave
2724        ret
2725                                                                                   
2726/*##########################################################################
2727#
2728#   Name       : RdosSyncTime
2729#
2730#   Purpose....: Synchronize time with NTP
2731#
2732#   Parameters.: IP
2733#
2734##########################################################################*/
2735
2736    .global RdosSyncTime
2737   
2738RdosSyncTime:
2739        pushl %ebp
2740        movl %esp,%ebp
2741        pushal
2742
2743        movl 8(%ebp),%edx
2744        UserGate sync_time_nr
2745        jc RdosSyncTimeFail
2746
2747        movl $1,%eax
2748        jmp RdosSyncTimeDone
2749
2750RdosSyncTimeFail:
2751        xorl %eax,%eax
2752
2753RdosSyncTimeDone:
2754        popal
2755        leave
2756        ret
2757                                                                                   
2758/*##########################################################################
2759#
2760#   Name       : RdosOpenCom
2761#
2762#   Purpose....: Open com-port
2763#
2764#   Parameters.: ID
2765#                baudrate
2766#                parity
2767#                data bits
2768#                stop bits
2769#                SendBufferSize
2770#                RecBufferSize
2771#
2772#    Returns...: Com handle
2773#
2774##########################################################################*/
2775
2776    .global RdosOpenCom
2777   
2778RdosOpenCom:
2779        pushl %ebp
2780        movl %esp,%ebp
2781        pushl %ebx
2782        pushl %ecx
2783        pushl %edx
2784        pushl %esi
2785        pushl %edi
2786
2787        movb 8(%ebp),%al
2788        movb 20(%ebp),%ah
2789        movb 24(%ebp),%bl
2790        movb 16(%ebp),%bh
2791        movl 12(%ebp),%ecx
2792        movw 28(%ebp),%si
2793        movw 32(%ebp),%di
2794        UserGate open_com_nr
2795        movzx %bx,%eax
2796
2797        popl %edi
2798        popl %esi
2799        popl %edx
2800        popl %ecx
2801        popl %ebx
2802        leave
2803        ret
2804                                                                                   
2805/*##########################################################################
2806#
2807#   Name       : RdosCloseCom
2808#
2809#   Purpose....: Close com-port
2810#
2811#   Parameters.: Com handle
2812#
2813##########################################################################*/
2814
2815    .global RdosCloseCom
2816   
2817RdosCloseCom:
2818        pushl %ebp
2819        movl %esp,%ebp
2820        pushl %ebx
2821
2822        movw 8(%ebp),%bx
2823        UserGate close_com_nr
2824
2825        popl %ebx
2826        leave
2827        ret
2828                                                                                   
2829/*##########################################################################
2830#
2831#   Name       : RdosFlushCom
2832#
2833#   Purpose....: Flush com-port
2834#
2835#   Parameters.: Com handle
2836#
2837##########################################################################*/
2838
2839    .global RdosFlushCom
2840   
2841RdosFlushCom:
2842        pushl %ebp
2843        movl %esp,%ebp
2844        pushl %ebx
2845
2846        movw 8(%ebp),%bx
2847        UserGate flush_com_nr
2848
2849        popl %ebx
2850        leave
2851        ret
2852                                                                                   
2853/*##########################################################################
2854#
2855#   Name       : RdosReadCom
2856#
2857#   Purpose....: Read com-port
2858#
2859#   Parameters.: Com handle
2860#
2861#   Returns....: Character
2862#
2863##########################################################################*/
2864
2865    .global RdosReadCom
2866   
2867RdosReadCom:
2868        pushl %ebp
2869        movl %esp,%ebp
2870        pushl %ebx
2871
2872        movw 8(%ebp),%bx
2873        UserGate read_com_nr
2874
2875        popl %ebx
2876        leave
2877        ret
2878                                                                                   
2879/*##########################################################################
2880#
2881#   Name       : RdosWriteCom
2882#
2883#   Purpose....: Write com-port
2884#
2885#   Parameters.: Com handle
2886#                char
2887#
2888#   Returns....: 0 for success
2889#
2890##########################################################################*/
2891
2892    .global RdosWriteCom
2893   
2894RdosWriteCom:
2895        pushl %ebp
2896        movl %esp,%ebp
2897        pushl %ebx
2898
2899        movw 8(%ebp),%bx
2900        movb 12(%ebp),%al
2901        UserGate write_com_nr
2902        movzx %al,%eax
2903
2904        popl %ebx
2905        leave
2906        ret
2907                                                                                   
2908/*##########################################################################
2909#
2910#   Name       : RdosWaitForSendCompletedCom
2911#
2912#   Purpose....: Wait until send buffer is empty
2913#
2914#   Parameters.: Com handle
2915#
2916##########################################################################*/
2917
2918    .global RdosWaitForSendCompletedCom
2919   
2920RdosWaitForSendCompletedCom:
2921        pushl %ebp
2922        movl %esp,%ebp
2923        pushl %ebx
2924
2925        movw 8(%ebp),%bx
2926        UserGate wait_for_send_completed_com_nr
2927
2928        popl %ebx
2929        leave
2930        ret
2931                                                                                   
2932/*##########################################################################
2933#
2934#   Name       : RdosEnableCts
2935#
2936#   Purpose....: Enable CTS signal
2937#
2938#   Parameters.: Com handle
2939#
2940##########################################################################*/
2941
2942    .global RdosEnableCts
2943   
2944RdosEnableCts:
2945        pushl %ebp
2946        movl %esp,%ebp
2947        pushl %ebx
2948
2949        movw 8(%ebp),%bx
2950        UserGate enable_cts_nr
2951
2952        popl %ebx
2953        leave
2954        ret
2955                                                                                   
2956/*##########################################################################
2957#
2958#   Name       : RdosDisableCts
2959#
2960#   Purpose....: Disable CTS signal
2961#
2962#   Parameters.: Com handle
2963#
2964##########################################################################*/
2965
2966    .global RdosDisableCts
2967   
2968RdosDisableCts:
2969        pushl %ebp
2970        movl %esp,%ebp
2971        pushl %ebx
2972
2973        movw 8(%ebp),%bx
2974        UserGate disable_cts_nr
2975
2976        popl %ebx
2977        leave
2978        ret
2979                                                                                   
2980/*##########################################################################
2981#
2982#   Name       : RdosEnableAutoRts
2983#
2984#   Purpose....: Enable auto RTS signal generation for RS485
2985#
2986#   Parameters.: Com handle
2987#
2988##########################################################################*/
2989
2990    .global RdosEnableAutoRts
2991   
2992RdosEnableAutoRts:
2993        pushl %ebp
2994        movl %esp,%ebp
2995        pushl %ebx
2996
2997        movw 8(%ebp),%bx
2998        UserGate enable_auto_rts_nr
2999
3000        popl %ebx
3001        leave
3002        ret
3003                                                                                   
3004/*##########################################################################
3005#
3006#   Name       : RdosDisableAutoRts
3007#
3008#   Purpose....: Disable auto RTS signal generation for RS485
3009#
3010#   Parameters.: Com handle
3011#
3012##########################################################################*/
3013
3014    .global RdosDisableAutoRts
3015   
3016RdosDisableAutoRts:
3017        pushl %ebp
3018        movl %esp,%ebp
3019        pushl %ebx
3020
3021        movw 8(%ebp),%bx
3022        UserGate disable_auto_rts_nr
3023
3024        popl %ebx
3025        leave
3026        ret
3027                                                                                   
3028/*##########################################################################
3029#
3030#   Name       : RdosSetDtr
3031#
3032#   Purpose....: Set DTR active
3033#
3034#   Parameters.: Com handle
3035#
3036##########################################################################*/
3037
3038    .global RdosSetDtr
3039   
3040RdosSetDtr:
3041        pushl %ebp
3042        movl %esp,%ebp
3043        pushl %ebx
3044
3045        movw 8(%ebp),%bx
3046        UserGate set_dtr_nr
3047
3048        popl %ebx
3049        leave
3050        ret
3051                                                                                   
3052/*##########################################################################
3053#
3054#   Name       : RdosResetDtr
3055#
3056#   Purpose....: Set DTR inactive
3057#
3058#   Parameters.: Com handle
3059#
3060##########################################################################*/
3061
3062    .global RdosResetDtr
3063   
3064RdosResetDtr:
3065        pushl %ebp
3066        movl %esp,%ebp
3067        pushl %ebx
3068
3069        movw 8(%ebp),%bx
3070        UserGate reset_dtr_nr
3071
3072        popl %ebx
3073        leave
3074        ret
3075                                                                                   
3076/*##########################################################################
3077#
3078#   Name       : RdosSetRts
3079#
3080#   Purpose....: Set RTS active
3081#
3082#   Parameters.: Com handle
3083#
3084##########################################################################*/
3085
3086    .global RdosSetRts
3087   
3088RdosSetRts:
3089        pushl %ebp
3090        movl %esp,%ebp
3091        pushl %ebx
3092
3093        movw 8(%ebp),%bx
3094        UserGate set_rts_nr
3095
3096        popl %ebx
3097        leave
3098        ret
3099                                                                                   
3100/*##########################################################################
3101#
3102#   Name       : RdosResetRts
3103#
3104#   Purpose....: Set RTS inactive
3105#
3106#   Parameters.: Com handle
3107#
3108##########################################################################*/
3109
3110    .global RdosResetRts
3111   
3112RdosResetRts:
3113        pushl %ebp
3114        movl %esp,%ebp
3115        pushl %ebx
3116
3117        movw 8(%ebp),%bx
3118        UserGate reset_rts_nr
3119
3120        popl %ebx
3121        leave
3122        ret
3123                                                                                   
3124/*##########################################################################
3125#
3126#   Name       : RdosGetReceiveBufferSpace
3127#
3128#   Purpose....: Get receive buffer free space
3129#
3130#   Parameters.: Com handle
3131#
3132#   Returns....: Free bytes
3133#
3134##########################################################################*/
3135
3136    .global RdosGetReceiveBufferSpace
3137   
3138RdosGetReceiveBufferSpace:
3139        pushl %ebp
3140        movl %esp,%ebp
3141        pushl %ebx
3142
3143        movw 8(%ebp),%bx
3144        UserGate get_com_receive_space_nr
3145
3146        popl %ebx
3147        leave
3148        ret
3149                                                                                   
3150/*##########################################################################
3151#
3152#   Name       : RdosGetSendBufferSpace
3153#
3154#   Purpose....: Get send buffer free space
3155#
3156#   Parameters.: Com handle
3157#
3158#   Returns....: Free bytes
3159#
3160##########################################################################*/
3161
3162    .global RdosGetSendBufferSpace
3163   
3164RdosGetSendBufferSpace:
3165        pushl %ebp
3166        movl %esp,%ebp
3167        pushl %ebx
3168
3169        movw 8(%ebp),%bx
3170        UserGate get_com_send_space_nr
3171
3172        popl %ebx
3173        leave
3174        ret
3175                                                                                   
3176/*##########################################################################
3177#
3178#   Name       : RdosOpenFile
3179#
3180#   Purpose....: Open file
3181#
3182#   Parameters.: Filename
3183#                Access
3184#
3185#    Returns...: File handle
3186#
3187##########################################################################*/
3188
3189    .global RdosOpenFile
3190   
3191RdosOpenFile:
3192        pushl %ebp
3193        movl %esp,%ebp
3194        pushl %ebx
3195        pushl %ecx
3196        pushl %edi
3197
3198        movl 8(%ebp),%edi
3199        movb 12(%ebp),%cl
3200        UserGate open_file_nr
3201        jc OpenFileFailed
3202
3203        movzx %bx,%eax
3204        jmp OpenFileDone
3205
3206OpenFileFailed:
3207        xorl %eax,%eax
3208
3209OpenFileDone:
3210        popl %edi
3211        popl %ecx
3212        popl %ebx
3213        leave
3214        ret
3215                                                                                   
3216/*##########################################################################
3217#
3218#   Name       : RdosCreateFile
3219#
3220#   Purpose....: Create file
3221#
3222#   Parameters.: Filename
3223#                Attribute
3224#
3225#    Returns...: File handle
3226#
3227##########################################################################*/
3228
3229    .global RdosCreateFile
3230   
3231RdosCreateFile:
3232        pushl %ebp
3233        movl %esp,%ebp
3234        pushl %ebx
3235        pushl %ecx
3236        pushl %edi
3237
3238        movl 8(%ebp),%edi
3239        movw 12(%ebp),%cx
3240        UserGate create_file_nr
3241        jc CreateFileFailed
3242
3243        movzx %bx,%eax
3244        jmp CreateFileDone
3245
3246CreateFileFailed:
3247        xorl %eax,%eax
3248
3249CreateFileDone:
3250        popl %edi
3251        popl %ecx
3252        popl %ebx
3253        leave
3254        ret
3255                                                                                   
3256/*##########################################################################
3257#
3258#   Name       : RdosCloseFile
3259#
3260#   Purpose....: Close file
3261#
3262#   Parameters.: File handle
3263#
3264##########################################################################*/
3265
3266    .global RdosCloseFile
3267   
3268RdosCloseFile:
3269        pushl %ebp
3270        movl %esp,%ebp
3271        pushl %ebx
3272
3273        movw 8(%ebp),%bx
3274        UserGate close_file_nr
3275
3276        popl %ebx
3277        leave
3278        ret
3279                                                                                   
3280/*##########################################################################
3281#
3282#   Name       : RdosIsDevice
3283#
3284#   Purpose....: Check if file is device
3285#
3286#   Parameters.: TRUE if device
3287#
3288##########################################################################*/
3289
3290    .global RdosIsDevice
3291   
3292RdosIsDevice:
3293        pushl %ebp
3294        movl %esp,%ebp
3295        pushl %ebx
3296
3297        movw 8(%ebp),%bx
3298        UserGate get_ioctl_data_nr
3299        testw $0x8000,%dx
3300        jz ridFail
3301
3302        movl $1,%eax
3303        jmp ridDone
3304
3305ridFail:
3306        xorl %eax,%eax
3307
3308ridDone:
3309        popl %ebx
3310        leave
3311        ret
3312                                                                                   
3313/*##########################################################################
3314#
3315#   Name       : RdosDuplFile
3316#
3317#   Purpose....: Duplicate file handle
3318#
3319#   Parameters.: File handle
3320#
3321#   Returns....: File handle
3322#
3323##########################################################################*/
3324
3325    .global RdosDuplFile
3326   
3327RdosDuplFile:
3328        pushl %ebp
3329        movl %esp,%ebp
3330        pushl %ebx
3331
3332        movw 8(%ebp),%bx
3333        UserGate dupl_file_nr
3334        jc DuplFileFailed
3335       
3336        movzx %bx,%eax
3337        jmp DuplFileDone
3338
3339DuplFileFailed:
3340        xorl %eax,%eax
3341
3342DuplFileDone:
3343        popl %ebx
3344        leave
3345        ret
3346                                                                                   
3347/*##########################################################################
3348#
3349#   Name       : RdosGetFileSize
3350#
3351#   Purpose....: Get file size
3352#
3353#   Parameters.: File handle
3354#
3355#   Returns....: Size
3356#
3357##########################################################################*/
3358
3359    .global RdosGetFileSize
3360   
3361RdosGetFileSize:
3362        pushl %ebp
3363        movl %esp,%ebp
3364        pushl %ebx
3365
3366        movw 8(%ebp),%bx
3367        UserGate get_file_size_nr
3368        jnc GetFileSizeDone
3369
3370GetFileSizeFail:
3371        xorl %eax,%eax
3372
3373GetFileSizeDone:
3374        popl %ebx
3375        leave
3376        ret
3377                                                                                   
3378/*##########################################################################
3379#
3380#   Name       : RdosSetFileSize
3381#
3382#   Purpose....: Set file size
3383#
3384#   Parameters.: File handle
3385#                Size
3386#
3387##########################################################################*/
3388
3389    .global RdosSetFileSize
3390   
3391RdosSetFileSize:
3392        pushl %ebp
3393        movl %esp,%ebp
3394        pushl %eax
3395        pushl %ebx
3396
3397        movw 8(%ebp),%bx
3398        movl 12(%ebp),%eax
3399        UserGate set_file_size_nr
3400
3401        popl %ebx
3402        popl %eax
3403        leave
3404        ret
3405                                                                                   
3406/*##########################################################################
3407#
3408#   Name       : RdosGetFilePos
3409#
3410#   Purpose....: Get file position
3411#
3412#   Parameters.: File handle
3413#
3414#   Returns....: Position
3415#
3416##########################################################################*/
3417
3418    .global RdosGetFilePos
3419   
3420RdosGetFilePos:
3421        pushl %ebp
3422        movl %esp,%ebp
3423        pushl %ebx
3424
3425        movw 8(%ebp),%bx
3426        UserGate get_file_pos_nr
3427        jnc GetFilePosDone
3428
3429GetFilePosFail:
3430        xorl %eax,%eax
3431
3432GetFilePosDone:
3433        popl %ebx
3434        leave
3435        ret
3436                                                                                   
3437/*##########################################################################
3438#
3439#   Name       : RdosSetFilePos
3440#
3441#   Purpose....: Set file position
3442#
3443#   Parameters.: File handle
3444#                Position
3445#
3446##########################################################################*/
3447
3448    .global RdosSetFilePos
3449   
3450RdosSetFilePos:
3451        pushl %ebp
3452        movl %esp,%ebp
3453        pushl %eax
3454        pushl %ebx
3455
3456        movw 8(%ebp),%bx
3457        movl 12(%ebp),%eax
3458        UserGate set_file_pos_nr
3459
3460        popl %ebx
3461        popl %eax
3462        leave
3463        ret
3464                                                                                   
3465/*##########################################################################
3466#
3467#   Name       : RdosGetFileTime
3468#
3469#   Purpose....: Get file time & date
3470#
3471#   Parameters.: File handle
3472#                &MSB, &LSB
3473#
3474##########################################################################*/
3475
3476    .global RdosGetFileTime
3477   
3478RdosGetFileTime:
3479        pushl %ebp
3480        movl %esp,%ebp
3481        pushl %ebx
3482        pushl %edi
3483
3484        movw 8(%ebp),%bx
3485        UserGate get_file_time_nr
3486        jc GetFileTimeDone
3487
3488        movl 12(%ebp),%edi
3489        movl %edx,(%edi)
3490
3491        movl 16(%ebp),%edi
3492        movl %eax,(%edi)
3493
3494GetFileTimeDone:
3495        popl %edi
3496        popl %ebx
3497        leave
3498        ret
3499                                                                                   
3500/*##########################################################################
3501#
3502#   Name       : RdosSetFileTime
3503#
3504#   Purpose....: Set file time & date
3505#
3506#   Parameters.: File handle
3507#                MSB, LSB
3508#
3509##########################################################################*/
3510
3511    .global RdosSetFileTime
3512   
3513RdosSetFileTime:
3514        pushl %ebp
3515        movl %esp,%ebp
3516        pushl %eax
3517        pushl %ebx
3518        pushl %edx
3519
3520        movw 8(%ebp),%bx
3521        movl 12(%ebp),%edx
3522        movl 16(%ebp),%eax
3523        UserGate set_file_time_nr
3524
3525        popl %edx
3526        popl %ebx
3527        popl %eax
3528        leave
3529        ret
3530                                                                                   
3531/*##########################################################################
3532#
3533#   Name       : RdosReadFile
3534#
3535#   Purpose....: Read from file
3536#
3537#   Parameters.: File handle
3538#                buffer
3539#                count
3540#
3541#   Returns....: Read count
3542#
3543##########################################################################*/
3544
3545    .global RdosReadFile
3546   
3547RdosReadFile:
3548        pushl %ebp
3549        movl %esp,%ebp
3550        pushl %ebx
3551        pushl %ecx
3552        pushl %edi
3553
3554        movw 8(%ebp),%bx
3555        movl 12(%ebp),%edi
3556        movl 16(%ebp),%ecx
3557        UserGate read_file_nr
3558
3559        popl %edi
3560        popl %ecx
3561        popl %ebx
3562        leave
3563        ret
3564                                                                                   
3565/*##########################################################################
3566#
3567#   Name       : RdosWriteFile
3568#
3569#   Purpose....: Write to file
3570#
3571#   Parameters.: File handle
3572#                buffer
3573#                count
3574#
3575#   Returns....: Written count
3576#
3577##########################################################################*/
3578
3579    .global RdosWriteFile
3580   
3581RdosWriteFile:
3582        pushl %ebp
3583        movl %esp,%ebp
3584        pushl %ebx
3585        pushl %ecx
3586        pushl %edi
3587
3588        movw 8(%ebp),%bx
3589        movl 12(%ebp),%edi
3590        movl 16(%ebp),%ecx
3591        UserGate write_file_nr
3592
3593        popl %edi
3594        popl %ecx
3595        popl %ebx
3596        leave
3597        ret
3598                                                                                   
3599/*##########################################################################
3600#
3601#   Name       : RdosCreateMapping
3602#
3603#   Purpose....: Create file mapping
3604#
3605#   Parameters.: Size
3606#
3607#    Returns...: Filemap handle
3608#
3609##########################################################################*/
3610
3611    .global RdosCreateMapping
3612   
3613RdosCreateMapping:
3614        pushl %ebp
3615        movl %esp,%ebp
3616        pushl %ebx
3617
3618        movl 8(%ebp),%eax
3619        UserGate create_mapping_nr
3620        movzx %bx,%eax
3621
3622        popl %ebx
3623        leave
3624        ret
3625                                                                                   
3626/*##########################################################################
3627#
3628#   Name       : RdosCreateNamedMapping
3629#
3630#   Purpose....: Create named file mapping
3631#
3632#   Parameters.: Name
3633#                Size
3634#
3635#    Returns...: Filemap handle
3636#
3637##########################################################################*/
3638
3639    .global RdosCreateNamedMapping
3640   
3641RdosCreateNamedMapping:
3642        pushl %ebp
3643        movl %esp,%ebp
3644        pushl %ebx
3645        pushl %edi
3646
3647        movl 8(%ebp),%edi
3648        movl 12(%ebp),%eax
3649        UserGate create_named_mapping_nr
3650        movzx %bx,%eax
3651
3652        popl %edi
3653        popl %ebx
3654        leave
3655        ret
3656                                                                                   
3657/*##########################################################################
3658#
3659#   Name       : RdosCreateNamedFileMapping
3660#
3661#   Purpose....: Create file named file mapping
3662#
3663#   Parameters.: Name
3664#                Size
3665#                File handle
3666#
3667#    Returns...: Filemap handle
3668#
3669##########################################################################*/
3670
3671    .global RdosCreateNamedFileMapping
3672   
3673RdosCreateNamedFileMapping:
3674        pushl %ebp
3675        movl %esp,%ebp
3676        pushl %ebx
3677        pushl %edi
3678
3679        movl 8(%ebp),%edi
3680        movl 12(%ebp),%eax
3681        movw 16(%ebp),%bx
3682        UserGate create_named_file_mapping_nr
3683        movzx %bx,%eax
3684
3685        popl %edi
3686        popl %ebx
3687        leave
3688        ret
3689                                                                                   
3690/*##########################################################################
3691#
3692#   Name       : RdosOpenNamedMapping
3693#
3694#   Purpose....: Open named file mapping
3695#
3696#   Parameters.: Name
3697#
3698#    Returns...: Filemap handle
3699#
3700##########################################################################*/
3701
3702    .global RdosOpenNamedMapping
3703   
3704RdosOpenNamedMapping:
3705        pushl %ebp
3706        movl %esp,%ebp
3707        pushl %ebx
3708        pushl %edi
3709
3710        movl 8(%ebp),%edi
3711        UserGate open_named_mapping_nr
3712        movzx %bx,%eax
3713
3714        popl %edi
3715        popl %ebx
3716        leave
3717        ret
3718                                                                                   
3719/*##########################################################################
3720#
3721#   Name       : RdosSyncMapping
3722#
3723#   Purpose....: Sync file mapping
3724#
3725#   Parameters.: Filemap handle
3726#
3727##########################################################################*/
3728
3729    .global RdosSyncMapping
3730   
3731RdosSyncMapping:
3732        pushl %ebp
3733        movl %esp,%ebp
3734        pushl %ebx
3735
3736        movw 8(%ebp),%bx
3737        UserGate sync_mapping_nr
3738
3739        popl %ebx
3740        leave
3741        ret
3742                                                                                   
3743/*##########################################################################
3744#
3745#   Name       : RdosCloseMapping
3746#
3747#   Purpose....: Close file mapping
3748#
3749#   Parameters.: Filemap handle
3750#
3751##########################################################################*/
3752
3753    .global RdosCloseMapping
3754   
3755RdosCloseMapping:
3756        pushl %ebp
3757        movl %esp,%ebp
3758        pushl %ebx
3759
3760        movw 8(%ebp),%bx
3761        UserGate close_mapping_nr
3762
3763        popl %ebx
3764        leave
3765        ret
3766                                                                                   
3767/*##########################################################################
3768#
3769#   Name       : RdosMapView
3770#
3771#   Purpose....: Map view of file into memory
3772#
3773#   Parameters.: Filemap handle
3774#                Offset
3775#                Address
3776#                Size
3777#
3778##########################################################################*/
3779
3780    .global RdosMapView
3781   
3782RdosMapView:
3783        pushl %ebp
3784        movl %esp,%ebp
3785        pushl %ebx
3786        pushl %ecx
3787        pushl %edi
3788
3789        movw 8(%ebp),%bx
3790        movl 12(%ebp),%eax
3791        movl 16(%ebp),%edi
3792        movl 20(%ebp),%ecx
3793        UserGate map_view_nr
3794
3795        popl %edi
3796        popl %ecx
3797        popl %ebx
3798        leave
3799        ret
3800                                                                                   
3801/*##########################################################################
3802#
3803#   Name       : RdosUnmapView
3804#
3805#   Purpose....: Unmap view of file
3806#
3807#   Parameters.: Filemap handle
3808#
3809##########################################################################*/
3810
3811    .global RdosUnmapView
3812   
3813RdosUnmapView:
3814        pushl %ebp
3815        movl %esp,%ebp
3816        pushl %ebx
3817
3818        movw 8(%ebp),%bx
3819        UserGate unmap_view_nr
3820
3821        popl %ebx
3822        leave
3823        ret
3824                                                                                   
3825/*##########################################################################
3826#
3827#   Name       : RdosSetCurDrive
3828#
3829#   Purpose....: Set current drive
3830#
3831#   Parameters.: Drive
3832#
3833##########################################################################*/
3834
3835    .global RdosSetCurDrive
3836   
3837RdosSetCurDrive:
3838        pushl %ebp
3839        movl %esp,%ebp
3840
3841        movb 8(%ebp),%al
3842        UserGate set_cur_drive_nr
3843        jc rscdrFail
3844
3845    movl $1,%eax
3846    jmp rscdrDone
3847
3848rscdrFail:
3849    xorl %eax,%eax
3850
3851rscdrDone:
3852        leave
3853        ret
3854                                                                                   
3855/*##########################################################################
3856#
3857#   Name       : RdosGetCurDrive
3858#
3859#   Purpose....: Get current drive
3860#
3861#   Returns....: Drive
3862#
3863##########################################################################*/
3864
3865    .global RdosGetCurDrive
3866   
3867RdosGetCurDrive:
3868        pushl %ebp
3869        movl %esp,%ebp
3870
3871    xorl %eax,%eax
3872        UserGate get_cur_drive_nr
3873        movzx %al,%eax
3874
3875        leave
3876        ret
3877                                                                                   
3878/*##########################################################################
3879#
3880#   Name       : RdosSetCurDir
3881#
3882#   Purpose....: Set current directory
3883#
3884#   Parameters.: Pathname
3885#
3886##########################################################################*/
3887
3888    .global RdosSetCurDir
3889   
3890RdosSetCurDir:
3891        pushl %ebp
3892        movl %esp,%ebp
3893        pushl %edi
3894
3895        movl 8(%ebp),%edi
3896        UserGate set_cur_dir_nr
3897        jc rscdFail
3898
3899    movl $1,%eax
3900    jmp rscdDone
3901
3902rscdFail:
3903    xorl %eax,%eax
3904
3905rscdDone:
3906        popl %edi
3907        leave
3908        ret
3909                                                                                   
3910/*##########################################################################
3911#
3912#   Name       : RdosGetCurDir
3913#
3914#   Purpose....: Get current directory
3915#
3916#   Parameters.: Drive
3917#                Pathname
3918#
3919##########################################################################*/
3920
3921    .global RdosGetCurDir
3922   
3923RdosGetCurDir:
3924        pushl %ebp
3925        movl %esp,%ebp
3926        pushl %edi
3927
3928        movb 8(%ebp),%al
3929        movl 12(%ebp),%edi
3930        UserGate get_cur_dir_nr
3931        jc rgcdFail
3932
3933    movl $1,%eax
3934    jmp rgcdDone
3935
3936rgcdFail:
3937    xorl %eax,%eax
3938
3939rgcdDone:
3940        popl %edi
3941        leave
3942        ret
3943                                                                                   
3944/*##########################################################################
3945#
3946#   Name       : RdosMakeDir
3947#
3948#   Purpose....: Create directory
3949#
3950#   Parameters.: Pathname
3951#
3952##########################################################################*/
3953
3954    .global RdosMakeDir
3955   
3956RdosMakeDir:
3957        pushl %ebp
3958        movl %esp,%ebp
3959        pushl %edi
3960
3961        movl 8(%ebp),%edi
3962        UserGate make_dir_nr
3963        jc mdFail
3964
3965    movl $1,%eax
3966    jmp mdDone
3967
3968mdFail:
3969    xorl %eax,%eax
3970
3971mdDone:
3972        popl %edi
3973        leave
3974        ret
3975                                                                                   
3976/*##########################################################################
3977#
3978#   Name       : RdosRemoveDir
3979#
3980#   Purpose....: Remove directory
3981#
3982#   Parameters.: Pathname
3983#
3984##########################################################################*/
3985
3986    .global RdosRemoveDir
3987   
3988RdosRemoveDir:
3989        pushl %ebp
3990        movl %esp,%ebp
3991        pushl %edi
3992
3993        movl 8(%ebp),%edi
3994        UserGate remove_dir_nr
3995        jc rdFail
3996
3997    movl $1,%eax
3998    jmp rdDone
3999
4000rdFail:
4001    xorl %eax,%eax
4002
4003rdDone:
4004        popl %edi
4005        leave
4006        ret
4007                                                                                   
4008/*##########################################################################
4009#
4010#   Name       : RdosRenameFile
4011#
4012#   Purpose....: Rename file
4013#
4014#   Parameters.: ToName
4015#                FromName
4016#
4017##########################################################################*/
4018
4019    .global RdosRenameFile
4020   
4021RdosRenameFile:
4022        pushl %ebp
4023        movl %esp,%ebp
4024        pushl %esi
4025        pushl %edi
4026
4027        movl 8(%ebp),%edi
4028        movl 12(%ebp),%esi
4029        UserGate rename_file_nr
4030        jc rfFail
4031
4032    mov $1,%eax
4033    jmp rfDone
4034
4035rfFail:
4036    xorl %eax,%eax
4037
4038rfDone:
4039        popl %edi
4040        popl %esi
4041        leave
4042        ret
4043                                                                                   
4044/*##########################################################################
4045#
4046#   Name       : RdosDeleteFile
4047#
4048#   Purpose....: Delete file
4049#
4050#   Parameters.: Pathname
4051#
4052##########################################################################*/
4053
4054    .global RdosDeleteFile
4055   
4056RdosDeleteFile:
4057        pushl %ebp
4058        movl %esp,%ebp
4059        pushl %edi
4060
4061        movl 8(%ebp),%edi
4062        UserGate delete_file_nr
4063        jc dfFail
4064
4065    mov $1,%eax
4066    jmp dfDone
4067
4068dfFail:
4069    xorl %eax,%eax
4070
4071dfDone:
4072        popl %edi
4073        leave
4074        ret
4075                                                                                   
4076/*##########################################################################
4077#
4078#   Name       : RdosGetFileAttribute
4079#
4080#   Purpose....: Get file attribute
4081#
4082#   Parameters.: Pathname
4083#                &Attrib
4084#
4085##########################################################################*/
4086
4087    .global RdosGetFileAttribute
4088   
4089RdosGetFileAttribute:
4090        pushl %ebp
4091        movl %esp,%ebp
4092        pushl %ecx
4093        pushl %edi
4094
4095        movl 8(%ebp),%edi
4096        UserGate get_file_attribute_nr
4097        jc gfaFail
4098
4099        movl 12(%ebp),%edi
4100    movzx %cx,%ecx
4101        movl %ecx,(%edi)
4102    movl $1,%eax
4103    jmp gfaDone
4104
4105gfaFail:
4106    xorl %eax,%eax
4107
4108gfaDone:
4109        popl %edi
4110        popl %ecx
4111        leave
4112        ret
4113                                                                                   
4114/*##########################################################################
4115#
4116#   Name       : RdosSetFileAttribute
4117#
4118#   Purpose....: Set file attribute
4119#
4120#   Parameters.: Pathname
4121#                Attrib
4122#
4123##########################################################################*/
4124
4125    .global RdosSetFileAttribute
4126   
4127RdosSetFileAttribute:
4128        pushl %ebp
4129        movl %esp,%ebp
4130        pushl %ecx
4131        pushl %edi
4132
4133        movl 8(%ebp),%edi
4134        movw 12(%ebp),%cx
4135        UserGate set_file_attribute_nr
4136        jc sfaFail
4137
4138    movl $1,%eax
4139    jmp sfaDone
4140
4141sfaFail:
4142    xorl %eax,%eax
4143
4144sfaDone:
4145        popl %edi
4146        popl %ecx
4147        leave
4148        ret
4149                                                                                   
4150/*##########################################################################
4151#
4152#   Name       : RdosOpenDir
4153#
4154#   Purpose....: Open directory
4155#
4156#   Parameters.: Pathname
4157#
4158#   Returns....: Dir handle
4159#
4160##########################################################################*/
4161
4162    .global RdosOpenDir
4163   
4164RdosOpenDir:
4165        pushl %ebp
4166        movl %esp,%ebp
4167        pushl %ebx
4168        pushl %edi
4169
4170        movl 8(%ebp),%edi
4171        UserGate open_dir_nr
4172        jc odFail
4173
4174    movzx %bx,%eax
4175    jmp odDone
4176
4177odFail:
4178    xorl %eax,%eax
4179
4180odDone:
4181        popl %edi
4182        popl %ebx
4183        leave
4184        ret
4185                                                                                   
4186/*##########################################################################
4187#
4188#   Name       : RdosCloseDir
4189#
4190#   Purpose....: Close directory
4191#
4192#   Parameters.: Dir handle
4193#
4194##########################################################################*/
4195
4196    .global RdosCloseDir
4197   
4198RdosCloseDir:
4199        pushl %ebp
4200        movl %esp,%ebp
4201        pushl %ebx
4202
4203        movw 8(%ebp),%bx
4204        UserGate close_dir_nr
4205
4206        popl %ebx
4207        leave
4208        ret
4209                                                                                   
4210/*##########################################################################
4211#
4212#   Name       : RdosReadDir
4213#
4214#   Purpose....: Read directory entry
4215#
4216#   Parameters.: Dir handle
4217#                Entry #
4218#                MaxNameSize
4219#                Name buffer
4220#                &FileSize
4221#                &Attribute
4222#                &Msb time
4223#                &Lsb time
4224#
4225##########################################################################*/
4226
4227    .global RdosReadDir
4228   
4229RdosReadDir:
4230        pushl %ebp
4231        movl %esp,%ebp
4232        pushl %ebx
4233        pushl %ecx
4234        pushl %edi
4235
4236        movw 8(%ebp),%bx
4237        movw 12(%ebp),%dx
4238        movw 16(%ebp),%cx
4239        movl 20(%ebp),%edi
4240        UserGate read_dir_nr
4241        jc rdiFail
4242
4243        movl 24(%ebp),%edi
4244        movl %ecx,(%edi)
4245
4246        movl 28(%ebp),%edi
4247    movzx %bx,%ebx
4248        movl %ebx,(%edi)
4249
4250        movl 32(%ebp),%edi
4251        movl %edx,(%edi)
4252
4253        movl 36(%ebp),%edi
4254        movl %eax,(%edi)
4255
4256    movl $1,%eax
4257    jmp rdiDone
4258
4259rdiFail:
4260    xorl %eax,%eax
4261   
4262rdiDone:
4263    popl %edi
4264    popl %ecx
4265        popl %ebx
4266        leave
4267        ret
4268                                                                                   
4269/*##########################################################################
4270#
4271#   Name       : RdosSetFocus
4272#
4273#   Purpose....: Set input focus
4274#
4275#   Parameters.: Focus handle
4276#
4277##########################################################################*/
4278
4279    .global RdosSetFocus
4280   
4281RdosSetFocus:
4282        pushl %ebp
4283        movl %esp,%ebp
4284       
4285        movl 8(%ebp),%eax
4286        UserGate set_focus_nr
4287
4288        leave
4289        ret
4290                                                                                   
4291/*##########################################################################
4292#
4293#   Name       : RdosGetFocus
4294#
4295#   Purpose....: Get input focus
4296#
4297#   Returns....: Focus handle
4298#
4299##########################################################################*/
4300
4301    .global RdosGetFocus
4302   
4303RdosGetFocus:
4304        pushl %ebp
4305        movl %esp,%ebp
4306       
4307        UserGate get_focus_nr
4308
4309        leave
4310        ret
4311                                                                                   
4312/*##########################################################################
4313#
4314#   Name       : RdosClearKeyboard
4315#
4316#   Purpose....: Clear keyboard buffer
4317#
4318##########################################################################*/
4319
4320    .global RdosClearKeyboard
4321   
4322RdosClearKeyboard:
4323        pushl %ebp
4324        movl %esp,%ebp
4325
4326        UserGate flush_keyboard_nr
4327
4328        leave
4329        ret
4330                                                                                   
4331/*##########################################################################
4332#
4333#   Name       : RdosPollKeyboard
4334#
4335#   Purpose....: Poll keyboard buffer
4336#
4337#   Returns....: TRUE if non-empty
4338#
4339##########################################################################*/
4340
4341    .global RdosPollKeyboard
4342   
4343RdosPollKeyboard:
4344        pushl %ebp
4345        movl %esp,%ebp
4346
4347        UserGate poll_keyboard_nr
4348        jc rpkEmpty
4349
4350        mov $1,%eax
4351        jmp rpkDone
4352
4353rpkEmpty:
4354        xorl %eax,%eax
4355
4356rpkDone:
4357        leave
4358        ret
4359                                                                                   
4360/*##########################################################################
4361#
4362#   Name       : RdosReadKeyboard
4363#
4364#   Purpose....: Read keyboard buffer
4365#
4366#   Returns....: Scan code
4367#
4368##########################################################################*/
4369
4370    .global RdosReadKeyboard
4371   
4372RdosReadKeyboard:
4373        pushl %ebp
4374        movl %esp,%ebp
4375
4376        UserGate read_keyboard_nr
4377        movzx %ax,%eax
4378
4379        leave
4380        ret
4381                                                                                   
4382/*##########################################################################
4383#
4384#   Name       : RdosGetKeyboardState
4385#
4386#   Purpose....: Get keyboard buffer
4387#
4388#   Returns....: Keyboard state
4389#
4390##########################################################################*/
4391
4392    .global RdosGetKeyboardState
4393   
4394RdosGetKeyboardState:
4395        pushl %ebp
4396        movl %esp,%ebp
4397
4398        UserGate get_keyboard_state_nr
4399        movzx %ax,%eax
4400
4401        leave
4402        ret
4403                                                                                   
4404/*##########################################################################
4405#
4406#   Name       : RdosPutKeyboard
4407#
4408#   Purpose....: Put scancode in keyboard buffer
4409#
4410##########################################################################*/
4411
4412    .global RdosPutKeyboard
4413   
4414RdosPutKeyboard:
4415        pushl %ebp
4416        movl %esp,%ebp
4417    pushl %edx
4418
4419        movw 8(%ebp),%ax
4420        movb 12(%ebp),%dl
4421        movb 16(%ebp),%dh
4422        UserGate put_keyboard_code_nr
4423
4424    popl %edx
4425        leave
4426        ret
4427                                                                                   
4428/*##########################################################################
4429#
4430#   Name       : RdosPeekKeyEvent
4431#
4432#   Purpose....: Peek keyboard event
4433#
4434##########################################################################*/
4435
4436    .global RdosPeekKeyEvent
4437   
4438RdosPeekKeyEvent:
4439        pushl %ebp
4440        movl %esp,%ebp
4441        pushl %ecx
4442        pushl %edx
4443        pushl %edi
4444
4445        UserGate peek_key_event_nr
4446        jc rpeFail
4447
4448        movl 8(%ebp),%edi
4449        movzx %ax,%eax
4450        movl %eax,(%edi)
4451
4452        movl 12(%ebp),%edi
4453        movzx %cx,%eax
4454        movl %eax,(%edi)
4455
4456        movl 16(%ebp),%edi
4457        movzx %dl,%eax
4458        movl %eax,(%edi)
4459
4460        movl 20(%ebp),%edi
4461        movzx %dh,%eax
4462        movl %eax,(%edi)
4463
4464        movl $1,%eax
4465        jmp rpeDone
4466
4467rpeFail:
4468        xorl %eax,%eax
4469
4470rpeDone:
4471        popl %edi
4472        popl %edx
4473        popl %ecx
4474        leave
4475        ret
4476                                                                                   
4477/*##########################################################################
4478#
4479#   Name       : RdosReadKeyEvent
4480#
4481#   Purpose....: Read keyboard event
4482#
4483##########################################################################*/
4484
4485    .global RdosReadKeyEvent
4486   
4487RdosReadKeyEvent:
4488        pushl %ebp
4489        movl %esp,%ebp
4490        pushl %ecx
4491        pushl %edx
4492        pushl %edi
4493
4494        UserGate read_key_event_nr
4495        jc rkeFail
4496
4497        movl 8(%ebp),%edi
4498        movzx %ax,%eax
4499        movl %eax,(%edi)
4500
4501        movl 12(%ebp),%edi
4502        movzx %cx,%eax
4503        movl %eax,(%edi)
4504
4505        movl 16(%ebp),%edi
4506        movzx %dl,%eax
4507        movl %eax,(%edi)
4508
4509        movl 20(%ebp),%edi
4510        movzx %dh,%eax
4511        movl %eax,(%edi)
4512
4513        movl $1,%eax
4514        jmp rkeDone
4515
4516rkeFail:
4517        xorl %eax,%eax
4518
4519rkeDone:
4520        popl %edi
4521        popl %edx
4522        popl %ecx
4523        leave
4524        ret
4525                                                                                   
4526/*##########################################################################
4527#
4528#   Name       : RdosHideMouse
4529#
4530#   Purpose....: Hide mouse cursor
4531#
4532##########################################################################*/
4533
4534    .global RdosHideMouse
4535   
4536RdosHideMouse:
4537        pushl %ebp
4538        movl %esp,%ebp
4539
4540        UserGate hide_mouse_nr
4541
4542        leave
4543        ret
4544                                                                                   
4545/*##########################################################################
4546#
4547#   Name       : RdosShowMouse
4548#
4549#   Purpose....: Show mouse cursor
4550#
4551##########################################################################*/
4552
4553    .global RdosShowMouse
4554   
4555RdosShowMouse:
4556        pushl %ebp
4557        movl %esp,%ebp
4558
4559        UserGate show_mouse_nr
4560
4561        leave
4562        ret
4563                                                                                   
4564/*##########################################################################
4565#
4566#   Name       : RdosGetMousePosition
4567#
4568#   Purpose....: Get mouse position
4569#
4570#   Parameters.: &x, &y
4571#
4572##########################################################################*/
4573
4574    .global RdosGetMousePosition
4575   
4576RdosGetMousePosition:
4577        pushl %ebp
4578        movl %esp,%ebp
4579        pushl %ecx
4580        pushl %edx
4581
4582        UserGate get_mouse_position_nr
4583
4584        movl 8(%ebp),%eax
4585        movzx %cx,%ecx
4586        movl %ecx,(%eax)
4587
4588        movl 12(%ebp),%eax
4589        movzx %dx,%edx
4590        movl %edx,(%eax)
4591
4592        popl %edx
4593        popl %ecx
4594        leave
4595        ret
4596                                                                                   
4597/*##########################################################################
4598#
4599#   Name       : RdosSetMousePosition
4600#
4601#   Purpose....: Set mouse position
4602#
4603#   Parameters.: x, y
4604#
4605##########################################################################*/
4606
4607    .global RdosSetMousePosition
4608   
4609RdosSetMousePosition:
4610        pushl %ebp
4611        movl %esp,%ebp
4612        pushl %ecx
4613        pushl %edx
4614
4615        movw 8(%ebp),%cx
4616        movw 12(%ebp),%dx
4617        UserGate set_mouse_position_nr
4618
4619        popl %edx
4620        popl %ecx
4621        leave
4622        ret
4623                                                                                   
4624/*##########################################################################
4625#
4626#   Name       : RdosSetMouseWindow
4627#
4628#   Purpose....: Set mouse window
4629#
4630#   Parameters.: start x, start y
4631#                end x, end y
4632#
4633##########################################################################*/
4634
4635    .global RdosSetMouseWindow
4636   
4637RdosSetMouseWindow:
4638        pushl %ebp
4639        movl %esp,%ebp
4640        pushl %eax
4641        pushl %ebx
4642        pushl %ecx
4643        pushl %edx
4644
4645        movw 8(%ebp),%ax
4646        movw 12(%ebp),%bx
4647        movw 16(%ebp),%cx
4648        movw 20(%ebp),%dx
4649        UserGate set_mouse_window_nr
4650
4651        popl %edx
4652        popl %ecx
4653        popl %ebx
4654        popl %eax
4655        leave
4656        ret
4657                                                                                   
4658/*##########################################################################
4659#
4660#   Name       : RdosSetMouseMickey
4661#
4662#   Purpose....: Set mouse mickey
4663#
4664#   Parameters.: x, y
4665#
4666##########################################################################*/
4667
4668    .global RdosSetMouseMickey
4669   
4670RdosSetMouseMickey:
4671        pushl %ebp
4672        movl %esp,%ebp
4673        pushl %ecx
4674        pushl %edx
4675
4676        movw 8(%ebp),%cx
4677        movw 12(%ebp),%dx
4678        UserGate set_mouse_mickey_nr
4679
4680        popl %edx
4681        popl %ecx
4682        leave
4683        ret
4684                                                                                   
4685/*##########################################################################
4686#
4687#   Name       : RdosGetCursorPosition
4688#
4689#   Purpose....: Get cursor position
4690#
4691#   Parameters.: &x, &y
4692#
4693##########################################################################*/
4694
4695    .global RdosGetCursorPosition
4696   
4697RdosGetCursorPosition:
4698        pushl %ebp
4699        movl %esp,%ebp
4700        pushl %ecx
4701        pushl %edx
4702
4703        UserGate get_cursor_position_nr
4704
4705        movl 8(%ebp),%eax
4706        movzx %cx,%ecx
4707        movl %ecx,(%eax)
4708
4709        movl 12(%ebp),%eax
4710        movzx %dx,%edx
4711        movl %edx,(%eax)
4712
4713        popl %edx
4714        popl %ecx
4715        leave
4716        ret
4717                                                                                   
4718/*##########################################################################
4719#
4720#   Name       : RdosSetCursorPosition
4721#
4722#   Purpose....: Set cursor position
4723#
4724#   Parameters.: x, y
4725#
4726##########################################################################*/
4727
4728    .global RdosSetCursorPosition
4729   
4730RdosSetCursorPosition:
4731        pushl %ebp
4732        movl %esp,%ebp
4733        pushl %ecx
4734        pushl %edx
4735
4736        movw 8(%ebp),%cx
4737        movw 12(%ebp),%dx
4738        UserGate set_cursor_position_nr
4739
4740        popl %edx
4741        popl %ecx
4742        leave
4743        ret
4744                                                                                   
4745/*##########################################################################
4746#
4747#   Name       : RdosGetLeftButton
4748#
4749#   Purpose....: Check if left button is pressed
4750#
4751#   Returns....: TRUE if pressed
4752#
4753##########################################################################*/
4754
4755    .global RdosGetLeftButton
4756   
4757RdosGetLeftButton:
4758        pushl %ebp
4759        movl %esp,%ebp
4760
4761        UserGate get_left_button_nr
4762        jc get_left_rel
4763
4764        mov $1,%eax
4765        jmp get_left_done
4766
4767get_left_rel:
4768        xorl %eax,%eax
4769
4770get_left_done:
4771        leave
4772        ret
4773                                                                                   
4774/*##########################################################################
4775#
4776#   Name       : RdosGetRightButton
4777#
4778#   Purpose....: Check if right button is pressed
4779#
4780#   Returns....: TRUE if pressed
4781#
4782##########################################################################*/
4783
4784    .global RdosGetRightButton
4785   
4786RdosGetRightButton:
4787        pushl %ebp
4788        movl %esp,%ebp
4789
4790        UserGate get_right_button_nr
4791        jc get_right_rel
4792
4793        mov $1,%eax
4794        jmp get_right_done
4795
4796get_right_rel:
4797        xorl %eax,%eax
4798
4799get_right_done:
4800        leave
4801        ret
4802                                                                                   
4803/*##########################################################################
4804#
4805#   Name       : RdosGetLeftButtonPressPosition
4806#
4807#   Purpose....: Get left button press position
4808#
4809#   Parameters.: &x, &y
4810#
4811##########################################################################*/
4812
4813    .global RdosGetLeftButtonPressPosition
4814   
4815RdosGetLeftButtonPressPosition:
4816        pushl %ebp
4817        movl %esp,%ebp
4818
4819        pushl %ecx
4820        pushl %edx
4821
4822        UserGate get_left_button_press_position_nr
4823
4824        movl 8(%ebp),%eax
4825        movzx %cx,%ecx
4826        movl %ecx,(%eax)
4827
4828        movl 12(%ebp),%eax
4829        movzx %dx,%edx
4830        movl %edx,(%eax)
4831
4832        popl %edx
4833        popl %ecx
4834        leave
4835        ret
4836                                                                                   
4837/*##########################################################################
4838#
4839#   Name       : RdosGetRightButtonPressPosition
4840#
4841#   Purpose....: Get right button press position
4842#
4843#   Parameters.: &x, &y
4844#
4845##########################################################################*/
4846
4847    .global RdosGetRightButtonPressPosition
4848   
4849RdosGetRightButtonPressPosition:
4850        pushl %ebp
4851        movl %esp,%ebp
4852
4853        pushl %ecx
4854        pushl %edx
4855
4856        UserGate get_right_button_press_position_nr
4857
4858        movl 8(%ebp),%eax
4859        movzx %cx,%ecx
4860        movl %ecx,(%eax)
4861
4862        movl 12(%ebp),%eax
4863        movzx %dx,%edx
4864        movl %edx,(%eax)
4865
4866        popl %edx
4867        popl %ecx
4868        leave
4869        ret
4870                                                                                   
4871/*##########################################################################
4872#
4873#   Name       : RdosGetLeftButtonReleasePosition
4874#
4875#   Purpose....: Get left button release position
4876#
4877#   Parameters.: &x, &y
4878#
4879##########################################################################*/
4880
4881    .global RdosGetLeftButtonReleasePosition
4882   
4883RdosGetLeftButtonReleasePosition:
4884        pushl %ebp
4885        movl %esp,%ebp
4886
4887        pushl %ecx
4888        pushl %edx
4889
4890        UserGate get_left_button_release_position_nr
4891
4892        movl 8(%ebp),%eax
4893        movzx %cx,%ecx
4894        movl %ecx,(%eax)
4895
4896        movl 12(%ebp),%eax
4897        movzx %dx,%edx
4898        movl %edx,(%eax)
4899
4900        popl %edx
4901        popl %ecx
4902        leave
4903        ret
4904                                                                                   
4905/*##########################################################################
4906#
4907#   Name       : RdosGetRightButtonReleasePosition
4908#
4909#   Purpose....: Get right button release position
4910#
4911#   Parameters.: &x, &y
4912#
4913##########################################################################*/
4914
4915    .global RdosGetRightButtonReleasePosition
4916   
4917RdosGetRightButtonReleasePosition:
4918        pushl %ebp
4919        movl %esp,%ebp
4920
4921        pushl %ecx
4922        pushl %edx
4923
4924        UserGate get_right_button_release_position_nr
4925
4926        movl 8(%ebp),%eax
4927        movzx %cx,%ecx
4928        movl %ecx,(%eax)
4929
4930        movl 12(%ebp),%eax
4931        movzx %dx,%edx
4932        movl %edx,(%eax)
4933
4934        popl %edx
4935        popl %ecx
4936        leave
4937        ret
4938                                                                                   
4939/*##########################################################################
4940#
4941#   Name       : RdosReadLine
4942#
4943#   Purpose....: Read a line from keyboard
4944#
4945#   Parameters.: Buffer
4946#                Size
4947#
4948#   Returns....: Read count
4949#
4950##########################################################################*/
4951
4952    .global RdosReadLine
4953   
4954RdosReadLine:
4955        pushl %ebp
4956        movl %esp,%ebp
4957        pushl %ecx
4958        pushl %edi
4959
4960        movl 8(%ebp),%edi
4961        movl 12(%ebp),%ecx
4962        UserGate read_con_nr
4963
4964        popl %edi
4965        popl %ecx
4966        leave
4967        ret
4968                                                                                   
4969/*##########################################################################
4970#
4971#   Name       : RdosWriteChar
4972#
4973#   Purpose....: Write a character to screen
4974#
4975#   Parameters.: Char
4976#
4977##########################################################################*/
4978
4979    .global RdosWriteChar
4980   
4981RdosWriteChar:
4982        pushl %ebp
4983        movl %esp,%ebp
4984
4985        movb 8(%ebp),%al
4986        UserGate write_char_nr
4987
4988        leave
4989        ret
4990                                                                                   
4991/*##########################################################################
4992#
4993#   Name       : RdosWriteSizeString
4994#
4995#   Purpose....: Write a fixed number of characters to screen
4996#
4997#   Parameters.: String
4998#                Count
4999#
5000##########################################################################*/
5001
5002    .global RdosWriteSizeString
5003   
5004RdosWriteSizeString:
5005        pushl %ebp
5006        movl %esp,%ebp
5007        pushl %ecx
5008        pushl %edi
5009
5010        movl 8(%ebp),%edi
5011        movl 12(%ebp),%ecx
5012        UserGate write_size_string_nr
5013
5014        popl %edi
5015        popl %ecx
5016        leave
5017        ret
5018                                                                                   
5019/*##########################################################################
5020#
5021#   Name       : RdosWriteString
5022#
5023#   Purpose....: Write a string to screen
5024#
5025#   Parameters.: String
5026#
5027##########################################################################*/
5028
5029    .global RdosWriteString
5030   
5031RdosWriteString:
5032        pushl %ebp
5033        movl %esp,%ebp
5034        pushl %edi
5035
5036        movl 8(%ebp),%edi
5037        UserGate write_asciiz_nr
5038
5039        popl %edi
5040        leave
5041        ret
5042                                                                                   
5043/*##########################################################################
5044#
5045#   Name       : RdosNameToIp
5046#
5047#   Purpose....: Convert host name to IP address
5048#
5049#   Parameters.: Name
5050#               
5051#   Returns....: IP
5052#
5053##########################################################################*/
5054
5055    .global RdosNameToIp
5056   
5057RdosNameToIp:
5058        pushl %ebp
5059        movl %esp,%ebp
5060        pushl %edi
5061
5062        movl 8(%ebp),%edi
5063        UserGate name_to_ip_nr
5064        jc rntiFail
5065
5066        movl %edx,%eax
5067        jmp rntiDone
5068
5069rntiFail:
5070        xorl %eax,%eax
5071
5072rntiDone:
5073        popl %edi
5074        leave
5075        ret
5076                                                                                   
5077/*##########################################################################
5078#
5079#   Name       : RdosGetIp
5080#
5081#   Purpose....: Get my IP
5082#               
5083#   Returns....: IP
5084#
5085##########################################################################*/
5086
5087    .global RdosGetIp
5088   
5089RdosGetIp:
5090        pushl %ebp
5091        movl %esp,%ebp
5092
5093        UserGate get_ip_address_nr
5094        movl %edx,%eax
5095
5096    leave
5097    ret
5098                                                                                   
5099/*##########################################################################
5100#
5101#   Name       : RdosIpToName
5102#
5103#   Purpose....: Convert IP address to host name
5104#
5105#   Parameters.: IP
5106#                Name               
5107#                Size
5108#
5109##########################################################################*/
5110
5111    .global RdosIpToName
5112   
5113RdosIpToName:
5114        pushl %ebp
5115        movl %esp,%ebp
5116        pushl %ecx
5117        pushl %edx
5118        pushl %edi
5119;
5120        movl 8(%ebp),%edx
5121        movl 12(%ebp),%edi
5122        movl 16(%ebp),%ecx
5123        UserGate ip_to_name_nr
5124        jnc ritnDone
5125
5126ritnFail:
5127        xorl %eax,%eax
5128
5129ritnDone:
5130        popl %edi
5131        popl %edx
5132        popl %ecx
5133        leave
5134        ret
5135                                                                                   
5136/*##########################################################################
5137#
5138#   Name       : RdosPing
5139#
5140#   Purpose....: Ping node
5141#               
5142#   Parameters.: IP
5143#                Timeout
5144#
5145##########################################################################*/
5146
5147    .global RdosPing
5148   
5149RdosPing:
5150        pushl %ebp
5151        movl %esp,%ebp
5152        pushl %edx
5153;
5154        movl 8(%ebp),%edx
5155        movl 12(%ebp),%eax
5156        UserGate ping_nr
5157        jc ping_failed
5158
5159        movl $1,%eax
5160        jmp ping_done
5161
5162ping_failed:
5163        xorl %eax,%eax
5164
5165ping_done:
5166        popl %edx
5167    leave
5168    ret
5169                                                                                   
5170/*##########################################################################
5171#
5172#   Name       : RdosOpenTcpConnection
5173#
5174#   Purpose....: Open an active connection over TCP
5175#               
5176#   Parameters.: RemoteIp
5177#                LocalPort
5178#                RemotePort
5179#                Timeout in ms
5180#                BufferSize
5181#
5182#   Returns....: Conn handle
5183#
5184##########################################################################*/
5185
5186    .global RdosOpenTcpConnection
5187   
5188RdosOpenTcpConnection:
5189        pushl %ebp
5190        movl %esp,%ebp
5191        pushl %ebx
5192        pushl %esi
5193        pushl %edi
5194
5195        movl 8(%ebp),%edx
5196        movw 12(%ebp),%si
5197        movw 16(%ebp),%di
5198        movl 20(%ebp),%eax
5199        movl 24(%ebp),%ecx
5200        UserGate open_tcp_connection_nr
5201        mov $0,%eax
5202        jc rotcDone
5203
5204        movl %ebx,%eax
5205
5206rotcDone:
5207        popl %edi
5208        popl %esi
5209        popl %ebx
5210    leave
5211    ret
5212                                                                                   
5213/*##########################################################################
5214#
5215#   Name       : RdosCreateTcpListen
5216#
5217#   Purpose....: Create listen handle
5218#               
5219#   Parameters.: Port
5220#                MaxConnections
5221#                BufferSize
5222#
5223#   Returns....: Listen handle
5224#
5225##########################################################################*/
5226
5227    .global RdosCreateTcpListen
5228   
5229RdosCreateTcpListen:
5230        pushl %ebp
5231        movl %esp,%ebp
5232        pushl %ebx
5233        pushl %esi
5234
5235        movw 8(%ebp),%si
5236        movw 12(%ebp),%ax
5237        movl 16(%ebp),%ecx
5238        UserGate create_tcp_listen_nr
5239        movzx %bx,%eax
5240        jnc ctlDone
5241
5242    xorl %eax,%eax
5243
5244ctlDone:
5245        popl %esi
5246        popl %ebx
5247    leave
5248    ret
5249                                                                                   
5250/*##########################################################################
5251#
5252#   Name       : RdosGetTcpListen
5253#
5254#   Purpose....: Get connection from listen
5255#               
5256#   Parameters.: Listen handle
5257#
5258#   Returns....: Conn handle
5259#
5260##########################################################################*/
5261
5262    .global RdosGetTcpListen
5263   
5264RdosGetTcpListen:
5265        pushl %ebp
5266        movl %esp,%ebp
5267        pushl %ebx
5268
5269        movw 8(%ebp),%bx
5270        UserGate get_tcp_listen_nr
5271        movzx %ax,%eax
5272        jnc gtlDone
5273
5274    xorl %eax,%eax
5275
5276gtlDone:
5277    popl %ebx
5278    leave
5279    ret
5280                                                                                   
5281/*##########################################################################
5282#
5283#   Name       : RdosCloseTcpListen
5284#
5285#   Purpose....: Close TCP listen
5286#               
5287#   Parameters.: Listen handle
5288#
5289##########################################################################*/
5290
5291    .global RdosCloseTcpListen
5292   
5293RdosCloseTcpListen:
5294        pushl %ebp
5295        movl %esp,%ebp
5296        pushl %ebx
5297
5298        movw 8(%ebp),%bx
5299        UserGate close_tcp_listen_nr
5300       
5301    popl %ebx
5302    leave
5303    ret
5304                                                                                   
5305/*##########################################################################
5306#
5307#   Name       : RdosAddWaitForTcpListen
5308#
5309#   Purpose....: Add wait object to tcp listen
5310#               
5311#   Parameters.: Wait handle
5312#                Listen handle
5313#                ID
5314#
5315##########################################################################*/
5316
5317    .global RdosAddWaitForTcpListen
5318   
5319RdosAddWaitForTcpListen:
5320        pushl %ebp
5321        movl %esp,%ebp
5322        pushl %ebx
5323        pushl %ecx
5324
5325        movw 8(%ebp),%bx
5326        movw 12(%ebp),%ax
5327        movl 16(%ebp),%ecx
5328        UserGate add_wait_for_tcp_listen_nr
5329        movl $1,%eax
5330        jnc awftlDone
5331
5332        xorl %eax,%eax
5333
5334awftlDone:
5335    popl %ecx
5336        popl %ebx
5337    leave
5338    ret
5339                                                                                   
5340/*##########################################################################
5341#
5342#   Name       : RdosWaitForTcpConnection
5343#
5344#   Purpose....: Wait for Tcp connection to be established
5345#               
5346#   Parameters.: Conn handle
5347#                Timeout ms
5348#
5349##########################################################################*/
5350
5351    .global RdosWaitForTcpConnection
5352   
5353RdosWaitForTcpConnection:
5354        pushl %ebp
5355        movl %esp,%ebp
5356        pushl %ebx
5357
5358        movw 8(%ebp),%bx
5359        movl 12(%ebp),%eax
5360        UserGate wait_for_tcp_connection_nr
5361        movl $1,%eax
5362        jnc wftcDone
5363
5364        xorl %eax,%eax
5365
5366wftcDone:
5367        popl %ebx
5368    leave
5369    ret
5370                                                                                   
5371/*##########################################################################
5372#
5373#   Name       : RdosAddWaitForTcpConnection
5374#
5375#   Purpose....: Add wait object to tcp connection
5376#               
5377#   Parameters.: Wait handle
5378#                Conn handle
5379#                ID
5380#
5381##########################################################################*/
5382
5383    .global RdosAddWaitForTcpConnection
5384   
5385RdosAddWaitForTcpConnection:
5386        pushl %ebp
5387        movl %esp,%ebp
5388        pushl %ebx
5389        pushl %ecx
5390
5391        movw 8(%ebp),%bx
5392        movw 12(%ebp),%ax
5393        movl 16(%ebp),%ecx
5394        UserGate add_wait_for_tcp_connection_nr
5395        movl $1,%eax
5396        jnc awftcDone
5397
5398        xorl %eax,%eax
5399
5400awftcDone:
5401    popl %ecx
5402        popl %ebx
5403    leave
5404    ret
5405                                                                                   
5406/*##########################################################################
5407#
5408#   Name       : RdosCloseTcpConnection
5409#
5410#   Purpose....: Close Tcp connection
5411#               
5412#   Parameters.: Conn handle
5413#
5414##########################################################################*/
5415
5416    .global RdosCloseTcpConnection
5417   
5418RdosCloseTcpConnection:
5419        pushl %ebp
5420        movl %esp,%ebp
5421        pushl %ebx
5422
5423        movw 8(%ebp),%bx
5424        UserGate close_tcp_connection_nr
5425
5426        popl %ebx
5427    leave
5428    ret
5429                                                                                   
5430/*##########################################################################
5431#
5432#   Name       : RdosDeleteTcpConnection
5433#
5434#   Purpose....: Delete Tcp connection
5435#               
5436#   Parameters.: Conn handle
5437#
5438##########################################################################*/
5439
5440    .global RdosDeleteTcpConnection
5441   
5442RdosDeleteTcpConnection:
5443        pushl %ebp
5444        movl %esp,%ebp
5445        pushl %ebx
5446
5447        movw 8(%ebp),%bx
5448        UserGate delete_tcp_connection_nr
5449
5450        popl %ebx
5451    leave
5452    ret
5453                                                                                   
5454/*##########################################################################
5455#
5456#   Name       : RdosAbortTcpConnection
5457#
5458#   Purpose....: Abort Tcp connection
5459#               
5460#   Parameters.: Conn handle
5461#
5462##########################################################################*/
5463
5464    .global RdosAbortTcpConnection
5465   
5466RdosAbortTcpConnection:
5467        pushl %ebp
5468        movl %esp,%ebp
5469        pushl %ebx
5470
5471        movw 8(%ebp),%bx
5472        UserGate abort_tcp_connection_nr
5473
5474        popl %ebx
5475    leave
5476    ret
5477                                                                                   
5478/*##########################################################################
5479#
5480#   Name       : RdosPushTcpConnection
5481#
5482#   Purpose....: Push Tcp connection
5483#               
5484#   Parameters.: Conn handle
5485#
5486##########################################################################*/
5487
5488    .global RdosPushTcpConnection
5489   
5490RdosPushTcpConnection:
5491        pushl %ebp
5492        movl %esp,%ebp
5493        pushl %ebx
5494
5495        movw 8(%ebp),%bx
5496        UserGate push_tcp_connection_nr
5497
5498        popl %ebx
5499    leave
5500    ret
5501                                                                                   
5502/*##########################################################################
5503#
5504#   Name       : RdosPollTcpConnection
5505#
5506#   Purpose....: Poll Tcp connection
5507#               
5508#   Parameters.: Conn handle
5509#
5510#   Returns....: Available bytes in receive buffer
5511#
5512##########################################################################*/
5513
5514    .global RdosPollTcpConnection
5515   
5516RdosPollTcpConnection:
5517        pushl %ebp
5518        movl %esp,%ebp
5519        pushl %ebx
5520
5521        movw 8(%ebp),%bx
5522        UserGate poll_tcp_connection_nr
5523
5524        popl %ebx
5525    leave
5526    ret
5527                                                                                   
5528/*##########################################################################
5529#
5530#   Name       : RdosIsTcpConnectionClosed
5531#
5532#   Purpose....: Check if connection is closed
5533#               
5534#   Parameters.: Conn handle
5535#
5536#   Returns....: TRUE if closed
5537#
5538##########################################################################*/
5539
5540    .global RdosIsTcpConnectionClosed
5541   
5542RdosIsTcpConnectionClosed:
5543        pushl %ebp
5544        movl %esp,%ebp
5545        pushl %ebx
5546
5547        movw 8(%ebp),%bx
5548        UserGate is_tcp_connection_closed_nr
5549        jc rptcClosed
5550
5551        xorl %eax,%eax
5552        jmp rptcDone
5553
5554rptcClosed:
5555        movl $1,%eax
5556       
5557rptcDone:
5558        popl %ebx
5559    leave
5560    ret
5561                                                                                   
5562/*##########################################################################
5563#
5564#   Name       : RdosGetRemoteTcpConnectionIp
5565#
5566#   Purpose....: Get remote IP
5567#               
5568#   Parameters.: Conn handle
5569#
5570#   Returns....: IP
5571#
5572##########################################################################*/
5573
5574    .global RdosGetRemoteTcpConnectionIp
5575   
5576RdosGetRemoteTcpConnectionIp:
5577        pushl %ebp
5578        movl %esp,%ebp
5579        pushl %ebx
5580
5581        movw 8(%ebp),%bx
5582        UserGate get_remote_tcp_connection_ip_nr
5583        jnc grtciDone
5584
5585        movl $0xFFFFFFFF,%eax
5586       
5587grtciDone:
5588        popl %ebx
5589    leave
5590    ret
5591                                                                                   
5592/*##########################################################################
5593#
5594#   Name       : RdosGetRemoteTcpConnectionPort
5595#
5596#   Purpose....: Get remote port
5597#               
5598#   Parameters.: Conn handle
5599#
5600#   Returns....: Port
5601#
5602##########################################################################*/
5603
5604    .global RdosGetRemoteTcpConnectionPort
5605   
5606RdosGetRemoteTcpConnectionPort:
5607        pushl %ebp
5608        movl %esp,%ebp
5609        pushl %ebx
5610
5611        movw 8(%ebp),%bx
5612        UserGate get_remote_tcp_connection_port_nr
5613        jnc grtcpDone
5614
5615        movl $0,%eax
5616       
5617grtcpDone:
5618    movzx %ax,%eax
5619        popl %ebx
5620    leave
5621    ret
5622                                                                                   
5623/*##########################################################################
5624#
5625#   Name       : RdosGetLocalTcpConnectionPort
5626#
5627#   Purpose....: Get local port
5628#               
5629#   Parameters.: Conn handle
5630#
5631#   Returns....: Port
5632#
5633##########################################################################*/
5634
5635    .global RdosGetLocalTcpConnectionPort
5636   
5637RdosGetLocalTcpConnectionPort:
5638        pushl %ebp
5639        movl %esp,%ebp
5640        pushl %ebx
5641
5642        movw 8(%ebp),%bx
5643        UserGate get_local_tcp_connection_port_nr
5644        jnc gltcpDone
5645
5646        movl $0,%eax
5647       
5648gltcpDone:
5649    movzx %ax,%eax
5650        popl %ebx
5651    leave
5652    ret
5653                                                                                   
5654/*##########################################################################
5655#
5656#   Name       : RdosReadTcpConnection
5657#
5658#   Purpose....: Read data from connection
5659#               
5660#   Parameters.: Conn handle
5661#                Buffer
5662#                Size
5663#
5664#   Returns....: Read bytes
5665#
5666##########################################################################*/
5667
5668    .global RdosReadTcpConnection
5669   
5670RdosReadTcpConnection:
5671        pushl %ebp
5672        movl %esp,%ebp
5673        pushl %ebx
5674        pushl %ecx
5675        pushl %edi
5676
5677        movw 8(%ebp),%bx
5678        movl 12(%ebp),%edi
5679        movl 16(%ebp),%ecx
5680        UserGate read_tcp_connection_nr
5681
5682        popl %edi
5683        popl %ecx
5684        popl %ebx
5685    leave
5686    ret
5687                                                                                   
5688/*##########################################################################
5689#
5690#   Name       : RdosWriteTcpConnection
5691#
5692#   Purpose....: Write data fto connection
5693#               
5694#   Parameters.: Conn handle
5695#                Buffer
5696#                Size
5697#
5698#   Returns....: Written bytes
5699#
5700##########################################################################*/
5701
5702    .global RdosWriteTcpConnection
5703   
5704RdosWriteTcpConnection:
5705        pushl %ebp
5706        movl %esp,%ebp
5707        pushl %ebx
5708        pushl %ecx
5709        pushl %edi
5710
5711        movw 8(%ebp),%bx
5712        movl 12(%ebp),%edi
5713        movl 16(%ebp),%ecx
5714        UserGate write_tcp_connection_nr
5715
5716        popl %edi
5717        popl %ecx
5718        popl %ebx
5719    leave
5720    ret
5721                                                                                   
5722/*##########################################################################
5723#
5724#   Name       : RdosGetLocalMailslot
5725#
5726#   Purpose....: Get local mailslot from name
5727#               
5728#   Parameters.: Name
5729#
5730#   Returns....: Mailslot handle
5731#
5732##########################################################################*/
5733
5734    .global RdosGetLocalMailslot
5735   
5736RdosGetLocalMailslot:
5737        pushl %ebp
5738        movl %esp,%ebp
5739        pushl %ebx
5740        pushl %edi
5741
5742        movl 8(%ebp),%edi
5743        UserGate get_local_mailslot_nr
5744        jc rglmFail
5745
5746        movzx %bx,%eax
5747        jmp rglmDone
5748
5749rglmFail:
5750        xorl %eax,%eax
5751
5752rglmDone:
5753        popl %edi
5754        popl %ebx
5755    leave
5756    ret
5757                                                                                   
5758/*##########################################################################
5759#
5760#   Name       : RdosGetRemoteMailslot
5761#
5762#   Purpose....: Get remote mailslot from name
5763#               
5764#   Parameters.: IP
5765#                Name
5766#
5767#   Returns....: Mailslot handle
5768#
5769##########################################################################*/
5770
5771    .global RdosGetRemoteMailslot
5772   
5773RdosGetRemoteMailslot:
5774        pushl %ebp
5775        movl %esp,%ebp
5776        pushl %ebx
5777        pushl %edx
5778        pushl %edi
5779
5780        movl 8(%ebp),%edx
5781        movl 12(%ebp),%edi
5782        UserGate get_remote_mailslot_nr
5783        jc rgrmFail
5784
5785        movzx %bx,%eax
5786        jmp rgrmDone
5787
5788rgrmFail:
5789        xorl %eax,%eax
5790
5791rgrmDone:
5792        popl %edi
5793        popl %edx
5794        popl %ebx
5795    leave
5796    ret
5797                                                                                   
5798/*##########################################################################
5799#
5800#   Name       : RdosFreeMailslot
5801#
5802#   Purpose....: Free mailslot
5803#               
5804#   Parameters.: Mailslot handle
5805#
5806##########################################################################*/
5807
5808    .global RdosFreeMailslot
5809   
5810RdosFreeMailslot:
5811        pushl %ebp
5812        movl %esp,%ebp
5813        pushl %ebx
5814
5815        movl 8(%ebp),%ebx
5816        UserGate free_mailslot_nr
5817
5818        popl %ebx
5819    leave
5820    ret
5821                                                                                   
5822/*##########################################################################
5823#
5824#   Name       : RdosSendMailslot
5825#
5826#   Purpose....: Send mailslot
5827#               
5828#   Parameters.: Mailslot handle
5829#                                Msg
5830#                                Size
5831#                                ReplyBuf
5832#                                MaxReplySize
5833#
5834#   Returns....: Size of reply
5835#
5836##########################################################################*/
5837
5838    .global RdosSendMailslot
5839   
5840RdosSendMailslot:
5841        pushl %ebp
5842        movl %esp,%ebp
5843        pushl %ebx
5844        pushl %esi
5845        pushl %edi
5846
5847        movw 8(%ebp),%bx
5848        movl 12(%ebp),%esi
5849        movl 16(%ebp),%ecx
5850        movl 20(%ebp),%edi
5851        movl 24(%ebp),%eax
5852        UserGate send_mailslot_nr
5853        jc smFail
5854
5855        movl %ecx,%eax
5856        jmp smDone
5857
5858smFail:
5859        movl $0xFFFFFFFF,%eax
5860
5861smDone:
5862        popl %edi
5863        popl %esi
5864        popl %ebx
5865    leave
5866    ret
5867                                                                                   
5868/*##########################################################################
5869#
5870#   Name       : RdosDefineMailslot
5871#
5872#   Purpose....: Define mailslot
5873#               
5874#   Parameters.: Name
5875#                Max msg size
5876#
5877##########################################################################*/
5878
5879    .global RdosDefineMailslot
5880   
5881RdosDefineMailslot:
5882        pushl %ebp
5883        movl %esp,%ebp
5884        pushl %ecx
5885        pushl %edi
5886
5887        movl 8(%ebp),%edi
5888        movl 12(%ebp),%ecx
5889        UserGate define_mailslot_nr
5890
5891        popl %edi
5892        popl %ecx
5893    leave
5894    ret
5895                                                                                   
5896/*##########################################################################
5897#
5898#   Name       : RdosReceiveMailslot
5899#
5900#   Purpose....: Receive from mailslot
5901#               
5902#   Parameters.: Msg buffer
5903#
5904#   Returns....: Msg size
5905#
5906##########################################################################*/
5907
5908    .global RdosReceiveMailslot
5909   
5910RdosReceiveMailslot:
5911        pushl %ebp
5912        movl %esp,%ebp
5913        pushl %ecx
5914        pushl %edi
5915
5916        movl 8(%ebp),%edi
5917        UserGate receive_mailslot_nr
5918        movl %ecx,%eax
5919
5920        popl %edi
5921        popl %ecx
5922    leave
5923    ret
5924                                                                                   
5925/*##########################################################################
5926#
5927#   Name       : RdosReplyMailslot
5928#
5929#   Purpose....: Reply to mailslot
5930#               
5931#   Parameters.: Msg buffer
5932#                Msg size
5933#
5934##########################################################################*/
5935
5936    .global RdosReplyMailslot
5937   
5938RdosReplyMailslot:
5939        pushl %ebp
5940        movl %esp,%ebp
5941        pushl %ecx
5942        pushl %edi
5943
5944        movl 8(%ebp),%edi
5945        movl 12(%ebp),%ecx
5946        UserGate reply_mailslot_nr
5947
5948        popl %edi
5949        popl %ecx
5950    leave
5951    ret
5952                                                                                   
5953/*##########################################################################
5954#
5955#   Name       : RdosGetIdeDisc
5956#
5957#   Purpose....: Get IDE disc
5958#               
5959#   Parameters.: Unit #
5960#
5961#   Returns....: Disc #
5962#
5963##########################################################################*/
5964
5965    .global RdosGetIdeDisc
5966   
5967RdosGetIdeDisc:
5968        pushl %ebp
5969        movl %esp,%ebp
5970        pushl %ebx
5971
5972        movb 8(%ebp),%bl
5973        UserGate get_ide_disc_nr
5974        jc get_ide_disc_fail
5975
5976    movzx %al,%eax
5977        jmp get_ide_disc_done
5978
5979get_ide_disc_fail:
5980        movl $0xFFFFFFFF,%eax
5981
5982get_ide_disc_done:
5983        popl %ebx
5984    leave
5985    ret
5986                                                                                   
5987/*##########################################################################
5988#
5989#   Name       : RdosGetFloppyDisc
5990#
5991#   Purpose....: Get floppy disc
5992#               
5993#   Parameters.: Unit #
5994#
5995#   Returns....: Disc #
5996#
5997##########################################################################*/
5998
5999    .global RdosGetFloppyDisc
6000   
6001RdosGetFloppyDisc:
6002        pushl %ebp
6003        movl %esp,%ebp
6004        pushl %ebx
6005
6006        movb 8(%ebp),%bl
6007        UserGate get_floppy_disc_nr
6008        jc get_floppy_disc_fail
6009
6010    movzx %al,%eax
6011        jmp get_floppy_disc_done
6012
6013get_floppy_disc_fail:
6014        movl $0xFFFFFFFF,%eax
6015
6016get_floppy_disc_done:
6017        popl %ebx
6018    leave
6019    ret
6020                                                                                   
6021/*##########################################################################
6022#
6023#   Name       : RdosGetDiscInfo
6024#
6025#   Purpose....: Get disc info
6026#               
6027#   Parameters.: Disc #
6028#                                Bytes / sector
6029#                                Total sectors
6030#                                BIOS sectors / cyl
6031#                                BIOS heads
6032#
6033#   Returns....: TRUE if ok
6034#
6035##########################################################################*/
6036
6037    .global RdosGetDiscInfo
6038   
6039RdosGetDiscInfo:
6040        pushl %ebp
6041        movl %esp,%ebp
6042        pushl %ebx
6043        pushl %ecx
6044        pushl %edx
6045        pushl %esi
6046        pushl %edi
6047
6048        movb 8(%ebp),%al
6049        UserGate get_disc_info_nr
6050        jc get_disc_info_fail
6051
6052        movl 12(%ebp),%ebx
6053        movzx %cx,%ecx
6054        movl %ecx,(%ebx)
6055
6056        movl 16(%ebp),%ebx
6057        movl %edx,(%ebx)
6058
6059        movl 20(%ebp),%ebx
6060        movzx %si,%esi
6061        movl %esi,(%ebx)
6062
6063        movl 24(%ebp),%ebx
6064        movzx %di,%edi
6065        movl %edi,(%ebx)
6066
6067        movl $1,%eax
6068        jmp get_disc_info_done
6069
6070get_disc_info_fail:
6071        xorl %eax,%eax
6072
6073get_disc_info_done:
6074        popl %edi
6075        popl %esi
6076        popl %edx
6077        popl %ecx
6078        popl %ebx
6079    leave
6080    ret
6081                                                                                   
6082/*##########################################################################
6083#
6084#   Name       : RdosSetDiscInfo
6085#
6086#   Purpose....: Set disc info
6087#               
6088#   Parameters.: Disc #
6089#                                Bytes / sector
6090#                                Total sectors
6091#                                BIOS sectors / cyl
6092#                                BIOS heads
6093#
6094#   Returns....: TRUE if ok
6095#
6096##########################################################################*/
6097
6098    .global RdosSetDiscInfo
6099   
6100RdosSetDiscInfo:
6101        pushl %ebp
6102        movl %esp,%ebp
6103        pushl %ebx
6104        pushl %ecx
6105        pushl %edx
6106        pushl %esi
6107        pushl %edi
6108
6109        movb 8(%ebp),%al
6110        movl 12(%ebp),%ecx
6111        movl 16(%ebp),%edx
6112        movl 20(%ebp),%esi
6113        movl 24(%ebp),%edi
6114        UserGate set_disc_info_nr
6115        jc set_disc_info_fail
6116
6117        movl $1,%eax
6118        jmp set_disc_info_done
6119
6120set_disc_info_fail:
6121        xorl %eax,%eax
6122
6123set_disc_info_done:
6124        popl %edi
6125        popl %esi
6126        popl %edx
6127        popl %ecx
6128        popl %ebx
6129    leave
6130    ret
6131                                                                                   
6132/*##########################################################################
6133#
6134#   Name       : RdosReadDisc
6135#
6136#   Purpose....: Read from disc
6137#               
6138#   Parameters.: Disc #
6139#                                Sector #
6140#                                Buffer
6141#                                Size
6142#
6143#   Returns....: TRUE if ok
6144#
6145##########################################################################*/
6146
6147    .global RdosReadDisc
6148   
6149RdosReadDisc:
6150        pushl %ebp
6151        movl %esp,%ebp
6152        pushl %ecx
6153        pushl %edx
6154        pushl %edi
6155
6156        movb 8(%ebp),%al
6157        movl 12(%ebp),%edx
6158        movl 16(%ebp),%edi
6159        movl 20(%ebp),%ecx
6160        UserGate read_disc_nr
6161        jc read_disc_fail
6162
6163        movl $1,%eax
6164        jmp read_disc_done
6165
6166read_disc_fail:
6167        xorl %eax,%eax
6168
6169read_disc_done:
6170        popl %edi
6171        popl %edx
6172        popl %ecx
6173    leave
6174    ret
6175                                                                                   
6176/*##########################################################################
6177#
6178#   Name       : RdosWriteDisc
6179#
6180#   Purpose....: Write to disc
6181#               
6182#   Parameters.: Disc #
6183#                                Sector #
6184#                                Buffer
6185#                                Size
6186#
6187#   Returns....: TRUE if ok
6188#
6189##########################################################################*/
6190
6191    .global RdosWriteDisc
6192   
6193RdosWriteDisc:
6194        pushl %ebp
6195        movl %esp,%ebp
6196        pushl %ecx
6197        pushl %edx
6198        pushl %edi
6199
6200        movb 8(%ebp),%al
6201        movl 12(%ebp),%edx
6202        movl 16(%ebp),%edi
6203        movl 20(%ebp),%ecx
6204        UserGate write_disc_nr
6205        jc write_disc_fail
6206
6207        movl $1,%eax
6208        jmp write_disc_done
6209
6210write_disc_fail:
6211        xorl %eax,%eax
6212
6213write_disc_done:
6214        popl %edi
6215        popl %edx
6216        popl %ecx
6217    leave
6218    ret
6219                                                                                   
6220/*##########################################################################
6221#
6222#   Name       : RdosAllocateFixedDrive
6223#
6224#   Purpose....: Allocate fixed drive
6225#               
6226#   Parameters.: Drive #
6227#
6228#   Returns....: TRUE if ok
6229#
6230##########################################################################*/
6231
6232    .global RdosAllocateFixedDrive
6233   
6234RdosAllocateFixedDrive:
6235        pushl %ebp
6236        movl %esp,%ebp
6237
6238        movb 8(%ebp),%al
6239        UserGate allocate_fixed_drive_nr
6240        jc allocate_fixed_drive_fail
6241
6242        movl $1,%eax
6243        jmp allocate_fixed_drive_done
6244
6245allocate_fixed_drive_fail:
6246        xorl %eax,%eax
6247
6248allocate_fixed_drive_done:
6249    leave
6250    ret
6251                                                                                   
6252/*##########################################################################
6253#
6254#   Name       : RdosAllocateStaticDrive
6255#
6256#   Purpose....: Allocate static drive
6257#               
6258#   Returns....: Drive #
6259#
6260##########################################################################*/
6261
6262    .global RdosAllocateStaticDrive
6263   
6264RdosAllocateStaticDrive:
6265        pushl %ebp
6266        movl %esp,%ebp
6267
6268        UserGate allocate_static_drive_nr
6269        jc allocate_static_drive_fail
6270
6271    movzx %al,%eax
6272        jmp allocate_static_drive_done
6273
6274allocate_static_drive_fail:
6275        xorl %eax,%eax
6276
6277allocate_static_drive_done:
6278    leave
6279    ret
6280                                                                                   
6281/*##########################################################################
6282#
6283#   Name       : RdosAllocateDynamicDrive
6284#
6285#   Purpose....: Allocate dynamic drive
6286#               
6287#   Returns....: Drive #
6288#
6289##########################################################################*/
6290
6291    .global RdosAllocateDynamicDrive
6292   
6293RdosAllocateDynamicDrive:
6294        pushl %ebp
6295        movl %esp,%ebp
6296
6297        UserGate allocate_dynamic_drive_nr
6298        jc allocate_dynamic_drive_fail
6299
6300    movzx %al,%eax
6301        jmp allocate_dynamic_drive_done
6302
6303allocate_dynamic_drive_fail:
6304        xorl %eax,%eax
6305
6306allocate_dynamic_drive_done:
6307    leave
6308    ret
6309                                                                                   
6310/*##########################################################################
6311#
6312#   Name       : RdosGetRdfsInfo
6313#
6314#   Purpose....: Get rdfs info
6315#               
6316#   Parameters.: Crypt tab
6317#                Key tab
6318#                Extent size tab
6319#
6320##########################################################################*/
6321
6322    .global RdosGetRdfsInfo
6323   
6324RdosGetRdfsInfo:
6325        pushl %ebp
6326        movl %esp,%ebp
6327        pushl %ebx
6328        pushl %esi
6329        pushl %edi
6330
6331        movl 8(%ebp),%esi
6332        movl 12(%ebp),%edi
6333        movl 16(%ebp),%ebx
6334        UserGate get_rdfs_info_nr
6335
6336        popl %edi
6337        popl %esi
6338        popl %ebx
6339    leave
6340    ret
6341                                                                                   
6342/*##########################################################################
6343#
6344#   Name       : RdosGetDriveInfo
6345#
6346#   Purpose....: Get drive info
6347#               
6348#   Parameters.: Drive #
6349#                Free units
6350#                Bytes per unit
6351#                Total units
6352#
6353#   Returns....: TRUE if ok
6354#
6355##########################################################################*/
6356
6357    .global RdosGetDriveInfo
6358   
6359RdosGetDriveInfo:
6360        pushl %ebp
6361        movl %esp,%ebp
6362        pushl %ebx
6363        pushl %ecx
6364        pushl %edx
6365
6366        movb 8(%ebp),%al
6367        UserGate get_drive_info_nr
6368        jc get_drive_info_fail
6369
6370        movl 12(%ebp),%ebx
6371        movl %eax,(%ebx)
6372
6373        movl 16(%ebp),%ebx
6374        movzx %cx,%ecx
6375        movl %ecx,(%ebx)
6376
6377        movl 20(%ebp),%ebx
6378        movl %edx,(%ebx)
6379
6380        movl $1,%eax
6381        jmp get_drive_info_done
6382
6383get_drive_info_fail:
6384        xorl %eax,%eax
6385
6386get_drive_info_done:
6387        popl %edx
6388        popl %ecx
6389        popl %ebx
6390    leave
6391    ret
6392                                                                                   
6393/*##########################################################################
6394#
6395#   Name       : RdosDemandLoadDrive
6396#
6397#   Purpose....: Demand load drive
6398#               
6399#   Parameters.: Drive #
6400#
6401##########################################################################*/
6402
6403    .global RdosDemandLoadDrive
6404   
6405RdosDemandLoadDrive:
6406        pushl %ebp
6407        movl %esp,%ebp
6408
6409        movb 8(%ebp),%al
6410        UserGate demand_load_drive_nr
6411
6412    leave
6413    ret
6414                                                                                   
6415/*##########################################################################
6416#
6417#   Name       : RdosGetDriveDiscParam
6418#
6419#   Purpose....: Get drive disc parameters
6420#               
6421#   Parameters.: Drive #
6422#                Disc #
6423#                Start sector
6424#                Total sectors
6425#
6426#   Returns....: TRUE if ok
6427#
6428##########################################################################*/
6429
6430    .global RdosGetDriveDiscParam
6431   
6432RdosGetDriveDiscParam:
6433        pushl %ebp
6434        movl %esp,%ebp
6435        pushl %ebx
6436        pushl %ecx
6437        pushl %edx
6438
6439        movb 8(%ebp),%al
6440        UserGate get_drive_disc_param_nr
6441        jc get_drive_disc_param_fail
6442
6443        movl 12(%ebp),%ebx
6444        movzx %al,%eax
6445        movl %eax,(%ebx)
6446
6447        movl 16(%ebp),%ebx
6448        movl %edx,(%ebx)
6449
6450        movl 20(%ebp),%ebx
6451        movl %ecx,(%ebx)
6452
6453        movl $1,%eax
6454        jmp get_drive_disc_param_done
6455
6456get_drive_disc_param_fail:
6457        xorl %eax,%eax
6458
6459get_drive_disc_param_done:
6460        popl %edx
6461        popl %ecx
6462        popl %ebx
6463    leave
6464    ret
6465                                                                                   
6466/*##########################################################################
6467#
6468#   Name       : RdosFormatDrive
6469#
6470#   Purpose....: Format drive
6471#               
6472#   Parameters.: Disc #
6473#                Start sector
6474#                Sectors
6475#                FS name
6476#
6477#   Returns....: Drive #
6478#
6479##########################################################################*/
6480
6481    .global RdosFormatDrive
6482   
6483RdosFormatDrive:
6484        pushl %ebp
6485        movl %esp,%ebp
6486        pushl %ecx
6487        pushl %edx
6488        pushl %edi
6489
6490        movb 8(%ebp),%al
6491        movl 12(%ebp),%edx
6492        movl 16(%ebp),%ecx
6493        movl 20(%ebp),%edi
6494        UserGate format_drive_nr
6495        jc rfdFail
6496
6497    movzx %al,%eax
6498    jmp rfdDone
6499
6500rfdFail:
6501    xorl %eax,%eax
6502
6503rfdDone:
6504        popl %edi
6505        popl %edx
6506        popl %ecx
6507    leave
6508    ret
6509                                                                                   
6510/*##########################################################################
6511#
6512#   Name       : RdosGetExeName
6513#
6514#   Purpose....: Get name of executable file
6515#
6516#   Returns....: Exe pathname
6517#
6518##########################################################################*/
6519
6520    .global RdosGetExeName
6521   
6522RdosGetExeName:
6523        pushl %ebp
6524        movl %esp,%ebp
6525        pushl %edi
6526
6527        UserGate get_exe_name_nr
6528        jc rgenFail
6529
6530    movl %edi,%eax
6531    jmp rgenDone
6532
6533rgenFail:
6534    xorl %eax,%eax
6535
6536rgenDone:
6537        popl %edi
6538    leave
6539    ret
6540                                                                                   
6541/*##########################################################################
6542#
6543#   Name       : RdosOpenAdc
6544#
6545#   Purpose....: Open handle to ADC channel
6546#
6547#   Parameters.: Channel #
6548#
6549#   Returns....: Adc handle
6550#
6551##########################################################################*/
6552
6553    .global RdosOpenAdc
6554   
6555RdosOpenAdc:
6556        pushl %ebp
6557        movl %esp,%ebp
6558        pushl %ebx
6559
6560        movl 8(%ebp),%eax
6561        UserGate open_adc_nr
6562        movw %bx,%ax
6563
6564        popl %ebx
6565    leave
6566    ret
6567                                                                                   
6568/*##########################################################################
6569#
6570#   Name       : RdosCloseAdc
6571#
6572#   Purpose....: Close ADC handle
6573#
6574#   Parameters.: Adc handle
6575#
6576##########################################################################*/
6577
6578    .global RdosCloseAdc
6579   
6580RdosCloseAdc:
6581        pushl %ebp
6582        movl %esp,%ebp
6583        pushl %ebx
6584
6585        movl 8(%ebp),%ebx
6586        UserGate close_adc_nr
6587
6588        popl %ebx
6589    leave
6590    ret
6591                                                                                   
6592/*##########################################################################
6593#
6594#   Name       : RdosDefineAdcTime
6595#
6596#   Purpose....: Define time of next conversion
6597#
6598#   Parameters.: Adc handle
6599#                MSB time
6600#                LSB time
6601#
6602##########################################################################*/
6603
6604    .global RdosDefineAdcTime
6605   
6606RdosDefineAdcTime:
6607        pushl %ebp
6608        movl %esp,%ebp
6609        pushl %ebx
6610        pushl %edx
6611
6612        movl 8(%ebp),%ebx
6613        movl 12(%ebp),%edx
6614        movl 16(%ebp),%eax
6615        UserGate define_adc_time_nr
6616
6617    popl %edx
6618        popl %ebx
6619    leave
6620    ret
6621                                                                                   
6622/*##########################################################################
6623#
6624#   Name       : RdosReadAdc
6625#
6626#   Purpose....: Read ADC
6627#
6628#   Parameters.: Adc handle
6629#               
6630#   Returns....: Value
6631#
6632##########################################################################*/
6633
6634    .global RdosReadAdc
6635   
6636RdosReadAdc:
6637        pushl %ebp
6638        movl %esp,%ebp
6639        pushl %ebx
6640
6641        movl 8(%ebp),%ebx
6642        UserGate read_adc_nr
6643
6644        popl %ebx
6645    leave
6646    ret
6647                                                                                   
6648/*##########################################################################
6649#
6650#   Name       : RdosReadSerialLines
6651#
6652#   Purpose....: Read serial lines
6653#
6654#   Parameters.: Device
6655#                &Value
6656#               
6657#   Returns....: TRUE if ok
6658#
6659##########################################################################*/
6660
6661    .global RdosReadSerialLines
6662   
6663RdosReadSerialLines:
6664        pushl %ebp
6665        movl %esp,%ebp
6666        pushl %edx
6667        pushl %esi
6668
6669        movb 8(%ebp),%dh
6670        UserGate read_serial_lines_nr
6671        jc rdsFail
6672
6673        movzx %al,%eax
6674        movl 12(%ebp),%esi
6675        movl %eax,(%esi)
6676        movl $1,%eax
6677        jmp rdsDone
6678
6679rdsFail:
6680        xorl %eax,%eax
6681
6682rdsDone:
6683        popl %esi
6684        popl %edx
6685    leave
6686    ret
6687                                                                                   
6688/*##########################################################################
6689#
6690#   Name       : RdosToggleSerialLine
6691#
6692#   Purpose....: Toggle serial line
6693#
6694#   Parameters.: Device
6695#                Line
6696#               
6697#   Returns....: TRUE if ok
6698#
6699##########################################################################*/
6700
6701    .global RdosToggleSerialLine
6702   
6703RdosToggleSerialLine:
6704        pushl %ebp
6705        movl %esp,%ebp
6706        pushl %edx
6707
6708        movb 8(%ebp),%dh
6709        movb 12(%ebp),%dl
6710        UserGate toggle_serial_line_nr
6711        jc rtsFail
6712
6713        movl $1,%eax
6714        jmp rtsDone
6715
6716rtsFail:
6717        xorl %eax,%eax
6718
6719rtsDone:
6720        popl %edx
6721    leave
6722    ret
6723                                                                                   
6724/*##########################################################################
6725#
6726#   Name       : RdosReadSerialVal
6727#
6728#   Purpose....: Read serial value
6729#
6730#   Parameters.: Device
6731#                Line
6732#                &Val
6733#               
6734#   Returns....: TRUE if ok
6735#
6736##########################################################################*/
6737
6738    .global RdosReadSerialVal
6739   
6740RdosReadSerialVal:
6741        pushl %ebp
6742        movl %esp,%ebp
6743        pushl %edx
6744        pushl %esi
6745
6746        movb 8(%ebp),%dh
6747        movb 12(%ebp),%dl
6748        UserGate read_serial_val_nr
6749
6750    pushfw
6751        shll $8,%eax
6752        movl 16(%ebp),%esi
6753        movl %eax,(%esi)
6754    popfw
6755        jc rdvFail
6756
6757        movl $1,%eax
6758        jmp rdvDone
6759
6760rdvFail:
6761        xorl %eax,%eax
6762
6763rdvDone:
6764        popl %esi
6765        popl %edx
6766    leave
6767    ret
6768                                                                                   
6769/*##########################################################################
6770#
6771#   Name       : RdosWriteSerialVal
6772#
6773#   Purpose....: Write serial value
6774#
6775#   Parameters.: Device
6776#                Line
6777#                Val
6778#               
6779#   Returns....: TRUE if ok
6780#
6781##########################################################################*/
6782
6783    .global RdosWriteSerialVal
6784   
6785RdosWriteSerialVal:
6786        pushl %ebp
6787        movl %esp,%ebp
6788        pushl %edx
6789
6790        movb 8(%ebp),%dh
6791        movb 12(%ebp),%dl
6792        movl 16(%ebp),%eax
6793        sarl $8,%eax
6794        UserGate write_serial_val_nr
6795        jc rwvFail
6796
6797        movl $1,%eax
6798        jmp rwvDone
6799
6800rwvFail:
6801        xorl %eax,%eax
6802
6803rwvDone:
6804        popl %edx
6805    leave
6806    ret
6807                                                                                   
6808/*##########################################################################
6809#
6810#   Name       : RdosReadSerialRaw
6811#
6812#   Purpose....: Read serial raw value
6813#
6814#   Parameters.: Device
6815#                Line
6816#                &Val
6817#               
6818#   Returns....: TRUE if ok
6819#
6820##########################################################################*/
6821
6822    .global RdosReadSerialRaw
6823   
6824RdosReadSerialRaw:
6825        pushl %ebp
6826        movl %esp,%ebp
6827        pushl %edx
6828        pushl %esi
6829
6830        movb 8(%ebp),%dh
6831        movb 12(%ebp),%dl
6832        UserGate read_serial_val_nr
6833
6834    pushfw
6835        movl 16(%ebp),%esi
6836        movl %eax,(%esi)
6837    popfw
6838        jc rdrFail
6839
6840        movl $1,%eax
6841        jmp rdrDone
6842
6843rdrFail:
6844        xorl %eax,%eax
6845
6846rdrDone:
6847        popl %esi
6848        popl %edx
6849    leave
6850    ret
6851                                                                                   
6852/*##########################################################################
6853#
6854#   Name       : RdosWriteSerialRaw
6855#
6856#   Purpose....: Write serial raw value
6857#
6858#   Parameters.: Device
6859#                Line
6860#                Val
6861#               
6862#   Returns....: TRUE if ok
6863#
6864##########################################################################*/
6865
6866    .global RdosWriteSerialRaw
6867   
6868RdosWriteSerialRaw:
6869        pushl %ebp
6870        movl %esp,%ebp
6871        pushl %edx
6872
6873        movb 8(%ebp),%dh
6874        movb 12(%ebp),%dl
6875        movl 16(%ebp),%eax
6876        UserGate write_serial_val_nr
6877        jc rwrFail
6878
6879        movl $1,%eax
6880        jmp rwrDone
6881
6882rwrFail:
6883        xorl %eax,%eax
6884
6885rwrDone:
6886        popl %edx
6887    leave
6888    ret
6889                                                                                   
6890/*##########################################################################
6891#
6892#   Name       : RdosOpenSysEnv
6893#
6894#   Purpose....: Open system environment
6895#               
6896#   Returns....: Env handle
6897#
6898##########################################################################*/
6899
6900    .global RdosOpenSysEnv
6901   
6902RdosOpenSysEnv:
6903        pushl %ebp
6904        movl %esp,%ebp
6905        pushl %ebx
6906
6907        UserGate open_sys_env_nr
6908        jc oseFail
6909
6910        movzx %bx,%eax
6911        jmp oseDone
6912
6913oseFail:
6914        xorl %eax,%eax
6915
6916oseDone:
6917        popl %ebx
6918    leave
6919    ret
6920                                                                                   
6921/*##########################################################################
6922#
6923#   Name       : RdosOpenProcessEnv
6924#
6925#   Purpose....: Open process environment
6926#               
6927#   Returns....: Env handle
6928#
6929##########################################################################*/
6930
6931    .global RdosOpenProcessEnv
6932   
6933RdosOpenProcessEnv:
6934        pushl %ebp
6935        movl %esp,%ebp
6936        pushl %ebx
6937
6938        UserGate open_proc_env_nr
6939        jc opeFail
6940
6941        movzx %bx,%eax
6942        jmp opeDone
6943
6944opeFail:
6945        xorl %eax,%eax
6946
6947opeDone:
6948        popl %ebx
6949    leave
6950    ret
6951                                                                                   
6952/*##########################################################################
6953#
6954#   Name       : RdosCloseEnv
6955#
6956#   Purpose....: Close environment
6957#
6958#   Parameters.: Env handle
6959#
6960##########################################################################*/
6961
6962    .global RdosCloseEnv
6963   
6964RdosCloseEnv:
6965        pushl %ebp
6966        movl %esp,%ebp
6967        pushl %ebx
6968
6969        movl 8(%ebp),%ebx
6970        UserGate close_env_nr
6971
6972        popl %ebx
6973    leave
6974    ret
6975                                                                                   
6976/*##########################################################################
6977#
6978#   Name       : RdosAddEnvVar
6979#
6980#   Purpose....: Add environment variable
6981#
6982#   Parameters.: Env handle
6983#                var
6984#                data
6985#
6986##########################################################################*/
6987
6988    .global RdosAddEnvVar
6989   
6990RdosAddEnvVar:
6991        pushl %ebp
6992        movl %esp,%ebp
6993        pushl %ebx
6994        pushl %esi
6995        pushl %edi
6996
6997        movl 8(%ebp),%ebx
6998        movl 12(%ebp),%esi
6999        movl 16(%ebp),%edi
7000        UserGate add_env_var_nr
7001
7002        popl %edi
7003        popl %esi
7004        popl %ebx
7005    leave
7006    ret
7007                                                                                   
7008/*##########################################################################
7009#
7010#   Name       : RdosDeleteEnvVar
7011#
7012#   Purpose....: Delete environment variable
7013#
7014#   Parameters.: Env handle
7015#                var
7016#
7017##########################################################################*/
7018
7019    .global RdosDeleteEnvVar
7020   
7021RdosDeleteEnvVar:
7022        pushl %ebp
7023        movl %esp,%ebp
7024        pushl %ebx
7025        pushl %esi
7026
7027        movl 8(%ebp),%ebx
7028        movl 12(%ebp),%esi
7029        UserGate delete_env_var_nr
7030
7031        popl %esi
7032        popl %ebx
7033    leave
7034    ret
7035                                                                                   
7036/*##########################################################################
7037#
7038#   Name       : RdosFindEnvVar
7039#
7040#   Purpose....: Find environment variable
7041#
7042#   Parameters.: Env handle
7043#                var
7044#                data
7045#
7046##########################################################################*/
7047
7048    .global RdosFindEnvVar
7049   
7050RdosFindEnvVar:
7051        pushl %ebp
7052        movl %esp,%ebp
7053        pushl %ebx
7054        pushl %esi
7055        pushl %edi
7056
7057        movl 8(%ebp),%ebx
7058        movl 12(%ebp),%esi
7059        movl 16(%ebp),%edi
7060        UserGate find_env_var_nr
7061        jc fevFail
7062
7063        movl $1,%eax
7064        jmp fevDone
7065
7066fevFail:
7067        xorl %eax,%eax
7068
7069fevDone:
7070        popl %edi
7071        popl %esi
7072        popl %ebx
7073    leave
7074    ret
7075                                                                                   
7076/*##########################################################################
7077#
7078#   Name       : RdosGetEnvData
7079#
7080#   Purpose....: Get raw environment data
7081#
7082#   Parameters.: Env handle
7083#                data
7084#
7085##########################################################################*/
7086
7087    .global RdosGetEnvData
7088   
7089RdosGetEnvData:
7090        pushl %ebp
7091        movl %esp,%ebp
7092        pushl %ebx
7093        pushl %edi
7094
7095        movl 8(%ebp),%ebx
7096        movl 12(%ebp),%edi
7097        UserGate get_env_data_nr
7098        jnc gedDone
7099
7100        xorw %ax,%ax
7101        stosw
7102
7103gedDone:
7104        popl %edi
7105        popl %ebx
7106    leave
7107    ret
7108                                                                                   
7109/*##########################################################################
7110#
7111#   Name       : RdosSetEnvData
7112#
7113#   Purpose....: Set raw environment data
7114#
7115#   Parameters.: Env handle
7116#                data
7117#
7118##########################################################################*/
7119
7120    .global RdosSetEnvData
7121   
7122RdosSetEnvData:
7123        pushl %ebp
7124        movl %esp,%ebp
7125        pushl %ebx
7126        pushl %edi
7127
7128        movl 8(%ebp),%ebx
7129        movl 12(%ebp),%edi
7130        UserGate set_env_data_nr
7131
7132        popl %edi
7133        popl %ebx
7134    leave
7135    ret
7136                                                                                   
7137/*##########################################################################
7138#
7139#   Name       : RdosOpenSysIni
7140#
7141#   Purpose....: Open system ini-file
7142#
7143#   Returns....: Ini handle
7144#
7145##########################################################################*/
7146
7147    .global RdosOpenSysIni
7148   
7149RdosOpenSysIni:
7150        pushl %ebp
7151        movl %esp,%ebp
7152        pushl %ebx
7153
7154        UserGate open_sys_ini_nr
7155        jc osiFail
7156
7157        movzx %bx,%eax
7158        jmp osiDone
7159
7160osiFail:
7161        xorl %eax,%eax
7162
7163osiDone:
7164        popl %ebx
7165    leave
7166    ret
7167                                                                                   
7168/*##########################################################################
7169#
7170#   Name       : RdosCloseIni
7171#
7172#   Purpose....: Close ini-file
7173#
7174#   Parameters.: Ini handle
7175#
7176##########################################################################*/
7177
7178    .global RdosCloseIni
7179   
7180RdosCloseIni:
7181        pushl %ebp
7182        movl %esp,%ebp
7183        pushl %ebx
7184
7185        movl 8(%ebp),%ebx
7186        UserGate close_ini_nr
7187
7188        popl %ebx
7189    leave
7190    ret
7191                                                                                   
7192/*##########################################################################
7193#
7194#   Name       : RdosGotoIniSection
7195#
7196#   Purpose....: Goto ini section
7197#
7198#   Parameters.: Ini handle
7199#                SectionName
7200#
7201##########################################################################*/
7202
7203    .global RdosGotoIniSection
7204   
7205RdosGotoIniSection:
7206        pushl %ebp
7207        movl %esp,%ebp
7208        pushl %ebx
7209        pushl %edi
7210
7211        movl 8(%ebp),%ebx
7212        movl 12(%ebp),%edi
7213        UserGate goto_ini_section_nr
7214        jc gisFail
7215
7216        movl $1,%eax
7217        jmp gisDone
7218
7219gisFail:
7220        xorl %eax,%eax
7221
7222gisDone:
7223        popl %edi
7224        popl %ebx
7225    leave
7226    ret
7227                                                                                   
7228/*##########################################################################
7229#
7230#   Name       : RdosRemoveIniSection
7231#
7232#   Purpose....: Remove current ini section
7233#
7234#   Parameters.: Ini handle
7235#
7236##########################################################################*/
7237
7238    .global RdosRemoveIniSection
7239   
7240RdosRemoveIniSection:
7241        pushl %ebp
7242        movl %esp,%ebp
7243        pushl %ebx
7244
7245        movl 8(%ebp),%ebx
7246        UserGate remove_ini_section_nr
7247        jc risFail
7248
7249        movl $1,%eax
7250        jmp risDone
7251
7252risFail:
7253        xorl %eax,%eax
7254
7255risDone:
7256        popl %ebx
7257    leave
7258    ret
7259                                                                                   
7260/*##########################################################################
7261#
7262#   Name       : RdosReadIni
7263#
7264#   Purpose....: Read ini var in current section
7265#
7266#   Parameters.: Ini handle
7267#                VarName
7268#                Data
7269#                MaxSize
7270#
7271##########################################################################*/
7272
7273    .global RdosReadIni
7274   
7275RdosReadIni:
7276        pushl %ebp
7277        movl %esp,%ebp
7278        pushl %ebx
7279        pushl %ecx
7280        pushl %esi
7281        pushl %edi
7282
7283        movl 8(%ebp),%ebx
7284        movl 12(%ebp),%esi
7285        movl 16(%ebp),%edi
7286        movl 20(%ebp),%ecx
7287        UserGate read_ini_nr
7288        jc riFail
7289
7290        movl $1,%eax
7291        jmp riDone
7292
7293riFail:
7294        xorl %eax,%eax
7295
7296riDone:
7297        popl %edi
7298        popl %esi
7299        popl %ecx
7300        popl %ebx
7301    leave
7302    ret
7303                                                                                   
7304/*##########################################################################
7305#
7306#   Name       : RdosWriteIni
7307#
7308#   Purpose....: Write ini var in current section
7309#
7310#   Parameters.: Ini handle
7311#                VarName
7312#                Data
7313#
7314##########################################################################*/
7315
7316    .global RdosWriteIni
7317   
7318RdosWriteIni:
7319        pushl %ebp
7320        movl %esp,%ebp
7321        pushl %ebx
7322        pushl %esi
7323        pushl %edi
7324
7325        movl 8(%ebp),%ebx
7326        movl 12(%ebp),%esi
7327        movl 16(%ebp),%edi
7328        UserGate write_ini_nr
7329        jc wiFail
7330
7331        movl $1,%eax
7332        jmp wiDone
7333
7334wiFail:
7335        xorl %eax,%eax
7336
7337wiDone:
7338        popl %edi
7339        popl %esi
7340        popl %ebx
7341    leave
7342    ret
7343                                                                                   
7344/*##########################################################################
7345#
7346#   Name       : RdosDeleteIni
7347#
7348#   Purpose....: Delete ini var in current section
7349#
7350#   Parameters.: Ini handle
7351#                VarName
7352#
7353##########################################################################*/
7354
7355    .global RdosDeleteIni
7356   
7357RdosDeleteIni:
7358        pushl %ebp
7359        movl %esp,%ebp
7360        pushl %ebx
7361        pushl %esi
7362
7363        movl 8(%ebp),%ebx
7364        movl 12(%ebp),%esi
7365        UserGate delete_ini_nr
7366        jc diFail
7367
7368        movl $1,%eax
7369        jmp diDone
7370
7371diFail:
7372        xorl %eax,%eax
7373
7374diDone:
7375        popl %esi
7376        popl %ebx
7377    leave
7378    ret
7379                                                                                   
7380/*##########################################################################
7381#
7382#   Name       : RdosCreateFileDrive
7383#
7384#   Purpose....: Create a new file-drive
7385#
7386#   Parameters.: Drive
7387#                Size
7388#                FS name
7389#                Filename
7390#
7391##########################################################################*/
7392
7393    .global RdosCreateFileDrive
7394   
7395RdosCreateFileDrive:
7396        pushl %ebp
7397        movl %esp,%ebp
7398        pushl %ecx
7399        pushl %esi
7400        pushl %edi
7401
7402        movb 8(%ebp),%al
7403        movl 12(%ebp),%ecx
7404        movl 16(%ebp),%esi
7405        movl 20(%ebp),%edi
7406        UserGate create_file_drive_nr
7407        jnc cfdOk
7408
7409    xorl %eax,%eax
7410    jmp cfdDone
7411
7412cfdOk:
7413        movl $1,%eax
7414
7415cfdDone:
7416        popl %edi
7417        popl %esi
7418        popl %ecx
7419    leave
7420    ret
7421                                                                                   
7422/*##########################################################################
7423#
7424#   Name       : RdosOpenFileDrive
7425#
7426#   Purpose....: Open a new file-drive
7427#
7428#   Parameters.: Drive
7429#                Filename
7430#
7431##########################################################################*/
7432
7433    .global RdosOpenFileDrive
7434   
7435RdosOpenFileDrive:
7436        pushl %ebp
7437        movl %esp,%ebp
7438        pushl %edi
7439
7440        movb 8(%ebp),%al
7441        movl 12(%ebp),%edi
7442        UserGate open_file_drive_nr
7443        jnc ofdOk
7444
7445        xorl %eax,%eax
7446        jmp ofdDone
7447
7448ofdOk:
7449        movl $1,%eax
7450
7451ofdDone:
7452        popl %edi
7453    leave
7454    ret
7455                                                                                   
7456/*##########################################################################
7457#
7458#   Name       : RdosEnableStatusLed
7459#
7460#   Purpose....: Enable status LED
7461#
7462##########################################################################*/
7463
7464    .global RdosEnableStatusLed
7465   
7466RdosEnableStatusLed:
7467        pushl %ebp
7468        movl %esp,%ebp
7469        UserGate enable_status_led_nr
7470    leave
7471    ret
7472                                                                                   
7473/*##########################################################################
7474#
7475#   Name       : RdosDisableStatusLed
7476#
7477#   Purpose....: Disable status LED
7478#
7479##########################################################################*/
7480
7481    .global RdosDisableStatusLed
7482   
7483RdosDisableStatusLed:
7484        pushl %ebp
7485        movl %esp,%ebp
7486        UserGate disable_status_led_nr
7487    leave
7488    ret
7489                                                                                   
7490/*##########################################################################
7491#
7492#   Name       : RdosStartWatchdog
7493#
7494#   Purpose....: Start watchdog
7495#
7496#   Parameters.: Timeout, ms
7497#
7498##########################################################################*/
7499
7500    .global RdosStartWatchdog
7501   
7502RdosStartWatchdog:
7503        pushl %ebp
7504        movl %esp,%ebp
7505;
7506        movl 8(%ebp),%eax
7507        UserGate start_watchdog_nr
7508;       
7509    leave
7510    ret
7511                                                                                   
7512/*##########################################################################
7513#
7514#   Name       : RdosKickWatchdog
7515#
7516#   Purpose....: Kick watchdog
7517#
7518##########################################################################*/
7519
7520    .global RdosKickWatchdog
7521   
7522RdosKickWatchdog:
7523        pushl %ebp
7524        movl %esp,%ebp
7525        UserGate kick_watchdog_nr
7526    leave
7527    ret
7528                                           
Note: See TracBrowser for help on using the repository browser.