6 unsigned int current_ds
, current_stack
;
9 /***************************************************************************
10 * These two routines to make doselks and the user program into co-routines.
12 * The Server calls run_cpu which runs the client.
13 * The client then does an int $80 which calls elks_int.
14 * Elks_int then returns to the caller of run_cpu.
16 * The return value is the value of AX when the int $80 occured.
17 * On return ES is set to the DS of the client program.
19 * The instruction times are for the 286
21 * If we were using a 486 then using mov's would be faster on the 286 they
22 * are the same speed but push/pop is smaller.
27 bx_temp
: ! Tempoary storage
for BX
.
29 .text
! The is where we store the current_ds in the _TEXT_ segment
30 cs_current_ds
: ! for the elks_int routine
34 unsigned int run_cpu()
38 seg cs
! Store ds
for return
39 mov
[cs_current_ds
],ax
; 5
41 cli
! We`re messing
! ; 3
42 test
[_intr_pending
],#$FFFF ! Last chance ...
51 mov
[_current_stack
],sp
; 5
53 mov
[_in_process
],ax
; 5
63 mov bx
,sp
! Switch to client stack
; 2
64 mov ss
,[bx
+8] ! SS
; 5
65 mov sp
,[bx
+10] ! SP
; 5
66 push
[bx
+6] ! flags
; 5
76 unsigned int elks_int()
84 mov ds
,[cs_current_ds
] ; 5
91 pop
[bx
+6] ! flags
; 5
92 mov
[bx
+8],ss
! SS
; 3
93 mov
[bx
+10],sp
! SP
; 3
95 mov sp
,bx
! Ready
for pppppush
; 2
106 push ax
! This is the
return value
, handy
; 3
108 mov sp
,[_current_stack
] ; 5
110 mov
[_in_process
],bx
; 5
111 sti
! Finished F
**** around with the stack
; 2
114 mov es
,[bx
+16] ! Set ES to the client`s DS
; 5