1 ; ***********************************************************
  2 ; *                                                         *
  3 ; * Copyright, (C) Honeywell Bull Inc., 1987                *
  4 ; *                                                         *
  5 ; * Copyright, (C) Honeywell Information Systems Inc., 1986 *
  6 ; *                                                         *
  7 ; ***********************************************************
  8 
  9 ; HISTORY COMMENTS:
 10 ;  1) change(86-01-03,Flegel), approve(87-07-13,MCR7580),
 11 ;     audit(87-07-13,Leskiw), install(87-08-07,MR12.1-1072):
 12 ;     Created.
 13 ;  2) change(86-04-13,Flegel), approve(87-07-13,MCR7580),
 14 ;     audit(87-07-13,Leskiw), install(87-08-07,MR12.1-1072):
 15 ;     Extracted send_message module.
 16 ;  3) change(86-05-07,Lee), approve(87-07-13,MCR7580), audit(87-07-13,Leskiw),
 17 ;     install(87-08-07,MR12.1-1072):
 18 ;     Added CREATE_INST, DESTROY_INST, FINDCAPNUM,
 19 ;     and FINDCAPNAME handlers.
 20 ;  4) change(86-05-21,Westcott), approve(87-07-13,MCR7580),
 21 ;     audit(87-07-13,Leskiw), install(87-08-07,MR12.1-1072):
 22 ;     Support parameter copying.
 23 ;  5) change(86-08-12,Flegel), approve(87-07-13,MCR7580),
 24 ;     audit(87-07-13,Leskiw), install(87-08-07,MR12.1-1072):
 25 ;     Installed FG_BREAK and DISCONNECT.
 26 ;  6) change(86-08-27,Flegel), approve(87-07-13,MCR7580),
 27 ;     audit(87-07-13,Leskiw), install(87-08-07,MR12.1-1072):
 28 ;     Modifications to DISCONNECT.
 29 ;  7) change(86-09-02,Flegel), approve(87-07-13,MCR7580),
 30 ;     audit(87-07-13,Leskiw), install(87-08-07,MR12.1-1072):
 31 ;     Installed checks for packet mode mincaps.
 32 ;     8) chnage(86-09-27,ASmith): Installed SUSPEND handler.
 33 ;  9) change(86-10-18,ASmith), approve(87-07-13,MCR7580),
 34 ;     audit(87-07-13,Leskiw), install(87-08-07,MR12.1-1072):
 35 ;     Installed connect by name handler.
 36 ; 10) change(87-02-10,Flegel), approve(87-07-13,MCR7580),
 37 ;     audit(87-07-13,Leskiw), install(87-08-07,MR12.1-1072):
 38 ;     Changed tests for MOWSE active to check
 39 ;     packetize_flag instead of packet_mode
 40 ;                                                      END HISTORY COMMENTS
 41 
 42 page 55,132
 43         .xlist
 44 ; /* : PROCEDURE FUNCTION (user_interrupt_handler):
 45 ;
 46 ; This is the MOWSE user interrupt handler.  This deals with MOWSE requested
 47 ; functions.
 48 ; */
 49 
 50 ; /* : NOTES:
 51 ;
 52 ; Syntax:
 53 ;         #include <dos.h>                mov ah,<MOWSE FUNCTION>
 54 ;         union REGS *inregs,outregs;     int USERINTRPT
 55 ;         inregs->h.al = <MOWSE FUNCTION>;
 56 ;         int86(USERINTRPT,in,out);
 57 ;
 58 ;  Input Arguments:
 59 ;         ah   - register determines MOWSE FUNCTION (input)
 60 ;         si   - address of parameter structure
 61 ;         cx   - length of parameter structure
 62 ;
 63 ; */
 64 ;
 65 ;/* : RETURNS:
 66 ;         ax - return code appropriate to command called
 67 ;
 68 ; If data is required to be passed back, it would be preferrable for the
 69 ; generating interrupt to pass addresses as determined by the interrupt handler
 70 ; requested and to return only an error code in the AX register.
 71 ; */
 72 
 73 ; /* : NOTES
 74 ;
 75 ; Each case in this massive switch is primarily concerned with setting up
 76 ; the argument list to each of the handlers for that specific case.  This may
 77 ; include moving data into and out of parameter structures.
 78 ; */
 79 
 80 include dos.mac
 81 include ws.mac
 82 include ws_stack.mac
 83 include ws_dcls.mac
 84 include ws_error.mac
 85 include wsmincap.mac
 86 
 87 page
 88 ;**************************************************************
 89 ;                                       MAIN
 90 ;**************************************************************
 91 dseg
 92 
 93 ;          Public Declarations
 94 
 95 public user_interrupt_handler
 96 
 97 ;          Data Declarations
 98 
 99 endds
100 
101 page
102 ;**************************************************************
103 ;                                       MAIN
104 ;**************************************************************
105 
106 PGROUP  GROUP   PROG
107 PROG    SEGMENT WORD PUBLIC 'PROG'
108         ASSUME  CS:PGROUP
109 
110 ;--------- External Procedures -----------------------------------------------
111 
112 extrn   packetize_flag:word
113 extrn   bgcount:word
114 extrn   IN_SOFT:word
115 extrn   setup_stack:near
116 extrn   reset_stack:near
117 extrn   send_terminal_data:near
118 extrn   terminal_buffer_check:near
119 extrn   snddat:near
120 extrn   i_execom:near
121 extrn   i_creins:near
122 extrn   i_desins:near
123 extrn   i_fndcnu:near
124 extrn   i_fndcna:near
125 extrn   i_execap:near
126 extrn   i_getbgm:near
127 extrn   i_putbgm:near
128 extrn   i_sendbg:near
129 extrn   i_reset:near
130 extrn   i_sleep:near
131 extrn   i_suspnd:near
132 extrn   i_connect:near
133 extrn   terminate_mowse:near
134 extrn   toggle_debug_switches:near
135 extrn   snddis:near
136 extrn   sndbrk:near
137 extrn   line_break:near
138 
139 ;------ publics --------------------------------------------------------------
140 
141 public uisystem
142 
143 user_interrupt_handler proc near
144 
145          jmp     arounds               ; provide a signiture for MOWSE
146 
147          even
148 uisystem db     0
149          db     'MOWSE',0
150 
151 ; /* : call setup_stack () */
152 
153 arounds:
154         inc     CS:IN_SOFT
155         call    setup_stack            ;Set up user interrupt stack frame
156         push    bp
157 
158 ; /* : copy parameters from caller's address space into MOWSE address space */
159 
160         or      cx,cx
161         jbe     nocopy                 ; if no parameter to copy
162         push    ds
163         pop     es
164         mov     si,sireg[bp]
165         lea     di,wsparm[bp]
166         mov     ds,dsreg[bp]
167         rep     movsb                  ; copy string into this address space
168         push    es
169         pop     ds
170 
171 ; /* : switch (user call type) */
172 
173 nocopy:
174         xor    cx,cx                   ; requested MOWSE function:
175         mov    cl,ah                   ; switch (ah)
176         sal    cx,1
177         mov    di,cx
178         cmp    di,MAXJMP               ; ensure request is valid
179         jbe    do_jump                 ; if request not valid
180         jmp    end_int
181 
182 do_jump:
183         mov    cx,CS:JMPTBL[di]
184         jmp    cx
185 
186 ; /* : -- case SENDMESSAGE: not used */
187 
188 SENDMESS:
189         jmp    end_int
190 
191 ; /* : SENDTERM: Not used */
192 
193 SENDTERM:
194         jmp    end_int
195 
196 ; /* : -- case EXECUTCOM: */
197 
198 EXECUTCOM:
199         push    bp                     ; save bp
200         lea     di,wsparm[bp]          ; di -> the parameter structure
201         mov     bp,sp                  ; save SP so we can put it back after the C
202         push    di                     ; put the parameter pointer on the stack (arg)
203         call    i_execom               ; call the procedure
204         mov     sp,bp                  ; restore the stack position
205         pop     bp                     ; restore BP
206         jmp     copy_back              ; copy resutls back into callers space
207 
208 ; /* : -- case 3: EXECAP */
209 
210 EXECAP:
211         push    bp
212         lea     di,wsparm[bp]
213         mov     cx,cxreg[bp]
214         mov     bp,sp
215         push    cx
216         push    di
217         call    i_execap
218         mov     sp,bp
219         pop     bp
220         jmp     copy_back
221 
222 ; /* : -- case 4: CREATE_INSTANCE */
223 
224 CREATE_INST:
225         push    bp
226         lea     di,wsparm[bp]
227         mov     ax,bp
228         mov     bp,sp
229         push    di                     ; push address of copy of caller's mcb
230         push    ax                     ; push address of stack
231         call    i_creins
232         mov     sp,bp
233         pop     bp
234         jmp     copy_back
235 
236 ; /* : -- case 5: DESTROY_INSTANCE */
237 
238 DESTROY_INST:
239         push    bp
240         lea     di,wsparm[bp]
241         mov     bp,sp
242         push    di
243         call    i_desins
244         mov     sp,bp
245         pop     bp
246         jmp     copy_back
247 
248 ; /* : -- case 6: FINDCAPNAME */
249 
250 FINDCAPNAME:
251         push    bp
252         lea     di,wsparm[bp]
253         mov     bp,sp
254         push    di
255         call    i_fndcna
256         mov     sp,bp
257         pop     bp
258         jmp     copy_back
259 
260 ; /* : -- case 7: FINDCAPNUM */
261 
262 FINDCAPNUM:
263         push    bp
264         lea     di,wsparm[bp]
265         mov     bp,sp
266         push    di
267         call    i_fndcnu
268         mov     sp,bp
269         pop     bp
270         jmp     copy_back
271 
272 ; /* : -- case 8: Debug packet switches - undocumented */
273 
274 L08:
275         mov     ax,wsparm[bp]
276         push    bp
277         push    ax
278         call    toggle_debug_switches
279         pop     bp
280         jmp     copy_back
281 
282 ; /* : -- case GETTDATA: Get data from terminal buffer */
283 
284 GETTDATA:
285         lea     bx,wsparm[bp]
286         mov     cx,bgcount             ; see if background messages are pending
287         mov     gbpflag[bx],cx
288 
289         mov     di,getlbp[bx]          ;di = address of caller's buffer
290         mov     cx,getlbs[bx]          ;cx = size of caller's buffer
291         push    es
292         mov     es,dsreg[bp]
293         push    bp                     ;check for foreground data
294         call    terminal_buffer_check
295         pop     bp
296         pop     es
297 
298         cmp     cx,0                   ;if no data then check the mode flag
299         jne     data_ready
300 
301         test    packetize_flag,1       ;if clear, then set minor cap to mowse_detached
302         jne     set_attached           ;else set minor to mowse_attached
303         mov     ax,MOWSE_DETACHED
304         jmp     data_ready
305 
306 set_attached:
307         mov     ax,MOWSE_ATTACHED
308 
309 data_ready:
310         mov     gmincap[bx],ax
311         mov     ax,cx                  ;return number of chars obtained to caller
312         mov     cx,gettlen
313         jmp     copy_back
314 
315 ; /* : -- case PUTTDATA   : Send data over foreground channel */
316 
317 PUTDATA:
318         lea     bx,wsparm[bp]
319         test    packetize_flag,1
320         jz      nopkt
321 
322 ; /* : --- if in packet mode create send packet structure for snddat */
323 
324         mov     ax,minor_cap[bx]
325         lea     si,pkthdr[bp]
326         mov     [si],al                ; insert minor cap in packet header
327         mov     datap[bp],si           ; insert pointer to packet header
328         mov     datal[bp],1            ; insert length of packet header
329         lea     si,puttstr[bx]
330         mov     datap+2[bp],si         ; insert pointer to data string
331         mov     ax,putstrl[bx]
332         mov     datal+2[bp],ax         ; insert length of data string
333         mov     datac[bp],2            ; insert count of packet pieces
334         mov     chan[bp],FG            ; insert channel id (foreground)
335         lea     bx,chan[bp]
336 
337 ; /* : --- give the packet to the protocol to send */
338 
339         jmp     send_pkt               ; give data to protocol
340 
341 ; /* : -- else, just transmit the data */
342 
343 nopkt:
344         push    bp
345         mov     cx,putstrl[bx]
346         lea     si,puttstr[bx]
347         mov     bp,sp
348         call    send_terminal_data
349         mov     sp,bp
350         pop     bp
351         jmp     end_int
352 
353 ; /* : -- case GETBGMES: */
354 
355 GETBGMES:
356         push    bp
357         lea     di,wsparm[bp]
358         mov     bp,sp
359         push    di                     ; push address of parameter structure
360         call    i_getbgm               ; get background message
361         mov     sp,bp
362         pop     bp
363         jmp     copy_back
364 
365 ; /* : -- case PUTBGMES: */
366 
367 PUTBGMES:
368         push    bp
369         lea     di,wsparm[bp]
370         mov     bp,sp
371         push    di                     ; push address of parameter structure
372         call    i_putbgm               ; put background message
373         mov     sp,bp
374         pop     bp
375         jmp     copy_back
376 
377 ; /* : -- case SENDBG: */
378 
379 SENDBG:
380         push    bp
381         lea     di,wsparm[bp]
382         mov     cx,cxreg[bp]
383         mov     bp,sp
384         push    cx                     ; push length of message
385         push    di                     ; push address of message
386         call    i_sendbg
387         mov     sp,bp
388         pop     bp
389         jmp     copy_back
390 
391 ; /* : -- case L14: Nothing */
392 
393 L14:
394         mov     bx,wsparm[bp]
395         mov     ax,[bx]
396         jmp     end_int
397 
398 ; /* : -- case RESET: */
399 
400 RESET:
401         push    bp
402         lea     di,wsparm[bp]
403         mov     cx,cxreg[bp]
404         mov     bp,sp
405         push    cx                     ; push length of message
406         push    di
407         call    i_reset
408         mov     sp,bp
409         pop     bp
410         jmp     copy_back
411 
412 ; /* : -- case SLEEP */
413 
414 SLEEP:
415         push    bp
416         lea     di,wsparm[bp]
417         mov     bp,sp
418         push    di
419         call    i_sleep
420         mov     sp,bp
421         pop     bp
422         jmp     copy_back
423 
424 SUSPEND:
425         push    bp
426         lea     di,wsparm[bp]
427         mov     bp,sp
428         push    di
429         call    i_suspnd
430         mov     sp,bp
431         pop     bp
432         jmp     copy_back
433 
434 CONNECT:
435         push    bp
436         lea     di,wsparm[bp]
437         mov     bp,sp
438         push    di
439         call    i_connect
440         mov     sp,bp
441         pop     bp
442         jmp     copy_back
443 
444 ; /* : -- case DISCONNECT */
445 
446 DISCONNECT:
447         test    wsparm[bp],1           ; but if force is requested, continue
448         jne     discon_ok
449 
450         test    packetize_flag,1       ; if in packet mode then fail
451         je      discon_ok
452 
453         push    bp
454         mov     bp,sp
455         call    snddis                 ; establish disconnection attempt
456         mov     sp,bp
457         pop     bp
458         jmp     copy_back
459 
460 discon_ok:
461         push    bp
462         mov     bp,sp
463         call    terminate_mowse        ; remove mowse from the PC
464         mov     sp,bp
465         pop     bp
466         jmp     copy_back
467 
468 ; /* : -- case FOREBREAK: */
469 
470 FOREBREAK:
471         xor     ax,ax
472         test    packetize_flag,1       ; Packet mode ?
473         jne     soft_brk               ;  YES - Protocol break
474         call    line_break             ;   NO - Line break
475         jmp     copy_back
476 
477 soft_brk:
478         push    bp
479         mov     bp,sp
480         call    sndbrk                 ; call to send break to Multics
481         mov     sp,bp
482         pop     bp
483         jmp     copy_back
484 
485 ; /* : send_pkt : give a packet structure to the mowse protocol for packetizing
486 ;      and subsequent trasmission */
487 
488 send_pkt:
489         push    bp
490         lea     si,datap[bp]
491         lea     di,datal[bp]
492         mov     ax,chan[bp]
493         mov     cx,datac[bp]
494         mov     bp,sp
495         push    di
496         push    si
497         push    cx
498         push    ax
499         call    snddat                 ; send the packet to the protocol
500         mov     sp,bp
501         pop     bp
502         cmp     ax,1
503         je      send_pkt               ; if window full, try again
504         mov     axreg[bp],ax           ; save return code
505         jmp     end_int
506 
507 
508 ; /* : COPY_BACK: copy parameter structure back to user's address space before
509 ;      returning from interrupt. */
510 
511 copy_back:
512         mov     axreg[bp],ax           ; save return code
513         mov     cx,cxreg[bp]
514         or      cx,cx
515         jbe     end_int                ; if no parameter to copy
516         mov     di,sireg[bp]
517         lea     si,wsparm[bp]
518         mov     es,dsreg[bp]
519         rep     movsb                  ; copy string into this address space
520 
521 ; /* : End of interrupt: call reset_stack(), return from interrupt */
522 
523 end_int:
524         pop     bp                     ; Put the stack to where it was
525         call    reset_stack            ;   before the interrupt
526         dec     CS:IN_SOFT
527         iret
528 
529 ;          Switching Table
530 
531 JMPTBL  dw      pgroup:SENDMESS
532         dw      pgroup:SENDTERM
533         dw      pgroup:EXECUTCOM
534         dw      pgroup:EXECAP
535         dw      pgroup:CREATE_INST
536         dw      pgroup:DESTROY_INST
537         dw      pgroup:FINDCAPNAME
538         dw      pgroup:FINDCAPNUM
539         dw      pgroup:L08
540         dw      pgroup:GETTDATA
541         dw      pgroup:PUTDATA
542         dw      pgroup:GETBGMES
543         dw      pgroup:PUTBGMES
544         dw      pgroup:SENDBG
545         dw      pgroup:L14
546         dw      pgroup:RESET
547         dw      pgroup:SLEEP
548         dw      pgroup:DISCONNECT
549         dw      pgroup:FOREBREAK
550         dw      pgroup:SUSPEND
551         dw      pgroup:CONNECT
552 JMP_END dw      0
553 MAXJMP  = JMP_END - JMPTBL
554 
555 ; /* : END user_interrupt_handler */
556 user_interrupt_handler endp
557 
558         endps
559         end
560