home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / lan / lanrmote / master.asm next >
Assembly Source File  |  1990-04-21  |  22KB  |  755 lines

  1.  
  2. ;----------------------------------------------------
  3. ;
  4. ;       MASTER -- remotely control a PC across
  5. ;       a Netbios LAN. (see SLAVE.ASM)
  6. ;
  7. ;       Test version 0.9
  8. ;
  9. ;       (c) 1990 Barry Nance
  10. ;
  11. ;----------------------------------------------------
  12.  
  13.                 DOSSEG
  14.                 .MODEL small
  15.  
  16. StdIn           =       0000
  17. StdOut          =       0001
  18. StdErr          =       0002
  19.  
  20. RESET                   =       032h
  21. CANCEL                  =       035h
  22. STATUS                  =       0b3h
  23. STATUS_WAIT             =       033h
  24. TRACE                   =       0f9h
  25. TRACE_WAIT              =       079h
  26. UNLINK                  =       070h
  27. ADD_NAME                =       0b0h
  28. ADD_NAME_WAIT           =       030h
  29. ADD_GROUP_NAME          =       0b6h
  30. ADD_GROUP_NAME_WAIT     =       036h
  31. DELETE_NAME             =       0b1h
  32. DELETE_NAME_WAIT        =       031h
  33. CALL_CMD                =       090h
  34. CALL_WAIT               =       010h
  35. LISTEN                  =       091h
  36. LISTEN_WAIT             =       011h
  37. HANG_UP                 =       092h
  38. HANG_UP_WAIT            =       012h
  39. SEND                    =       094h
  40. SEND_WAIT               =       014h
  41. SEND_NO_ACK             =       0f1h
  42. SEND_NO_ACK_WAIT        =       071h
  43. CHAIN_SEND              =       097h
  44. CHAIN_SEND_WAIT         =       017h
  45. CHAIN_SEND_NO_ACK       =       0f2h
  46. CHAIN_SEND_NO_ACK_WAIT  =       072h
  47. RECEIVE                 =       095h
  48. RECEIVE_WAIT            =       015h
  49. RECEIVE_ANY             =       096h
  50. RECEIVE_ANY_WAIT        =       016h
  51. SESSION_STATUS          =       0b4h
  52. SESSION_STATUS_WAIT     =       034h
  53. SEND_DATAGRAM           =       0a0h
  54. SEND_DATAGRAM_WAIT      =       020h
  55. SEND_BCST_DATAGRAM      =       0a2h
  56. SEND_BCST_DATAGRAM_WAIT =       022h
  57. RECEIVE_DATAGRAM        =       0a1h
  58. RECEIVE_DATAGRAM_WAIT   =       021h
  59. RECEIVE_BCST_DATAGRAM   =       0a3h
  60. RECEIVE_BCST_DATAGRAM_WAIT =    023h
  61.  
  62. NCB             struc
  63.     COMMAND     db      ?
  64.     RETCODE     db      ?
  65.     LSN         db      ?
  66.     NUM         db      ?
  67.     BUFFER_PTR  dd      ?
  68.     LEN         dw      ?
  69.     CALLNAME    db      16 dup (?)
  70.     OURNAME     db      16 dup (?)
  71.     RTO         db      ?
  72.     STO         db      ?
  73.     POST_FUNC   dd      ?
  74.     LANA_NUM    db      ?
  75.     CMD_CPLT    db      ?
  76.     RESERVE     db      14 dup (?)
  77. NCB             EndS
  78.  
  79.                 .DATA
  80.  
  81. Msg2            DB      "Looking for SLAVE -- Press ESC to quit."
  82.                 DB      13, 10
  83. Msg2Len         =       $-Msg2
  84.  
  85. Msg3            DB      "Early versions of DOS not supported."
  86.                 DB      13, 10
  87. Msg3Len         =       $-Msg3
  88.  
  89. Msg4            DB      "ERROR--NETBIOS not active."
  90.                 DB      13, 10
  91. Msg4Len         =       $-Msg4
  92.  
  93. Msg5            DB      "Adding name to network..."
  94.                 DB      13, 10
  95. Msg5Len         =       $-Msg5
  96.  
  97. Msg6            DB      "ERROR -- SLAVE not found."
  98.                 DB      13, 10
  99. Msg6Len         =       $-Msg6
  100.  
  101. Msg8            DB      13, 10, 13, 10
  102.                 DB      "MASTER finished."
  103.                 DB      13, 10
  104. Msg8Len         =       $-Msg8
  105.  
  106. dos_major       DB      0
  107. dos_minor       DB      0
  108.  
  109. EGAFlagPtr      Label   DWord
  110. EGAFlagOfs      DW      0487h
  111. EGAFlagSeg      DW      0
  112.  
  113. VideoPtr        Label   DWord
  114. VideoOfs        DW      0
  115. VideoSeg        DW      0
  116.  
  117. Done            DB      1
  118. OurNameNumber   DB      0
  119.  
  120. LocSave         DW      0
  121. ShapeSave       DW      0
  122.  
  123. slave_name      DB      "Slave          "
  124.                 DB      0
  125. master_name     DB      "Master         "
  126.                 DB      0
  127.  
  128. send_ncb        NCB     <>
  129. recv_ncb        NCB     <>
  130. add_name_ncb    NCB     <>
  131. delete_name_ncb NCB     <>
  132. cncl_ncb        NCB     <>
  133.  
  134. Screen_Data     Label   Byte
  135.   ScreenPos     DW      0
  136.   CursorShape   DW      0
  137.   CursorLoc     DW      0
  138.   Head2         DW      0
  139.   ScreenPkt     DB      500 Dup(0)
  140.  
  141. Kbd_Data        Label   Byte
  142.   KbdFlag1      DB      0
  143.   KbdFlag2      DB      0
  144.   AltInput      DB      0
  145.   Sess_Flag     DW      0
  146.   Tail          DW      0
  147.   KbdBuffer     DW      16 Dup(0)
  148.  
  149.                 .STACK 200h
  150.                 .CODE
  151. scan_code       DB      0
  152. In_Int10        DB      0
  153.  
  154. oldint09        Label   DWord
  155. oldint09_ofs    DW      0
  156. oldint09_seg    DW      0
  157.  
  158. oldint10        Label   DWord
  159. oldint10_ofs    DW      0
  160. oldint10_seg    DW      0
  161.  
  162. SS_Save1        DW      0
  163. SP_Save1        DW      0
  164. StackSeg1       DW      0
  165. StackOfs1       DW      0
  166.  
  167.                 DW      256 Dup(0)
  168. OurStack1       DW      0
  169.  
  170. SS_Save2        DW      0
  171. SP_Save2        DW      0
  172. StackSeg2       DW      0
  173. StackOfs2       DW      0
  174.  
  175.                 DW      256 Dup(0)
  176. OurStack2       DW      0
  177.  
  178. ;---------------------------------------
  179.  
  180.                 Assume  CS:_TEXT, DS:_DATA, ES:Nothing
  181.  
  182. Add_Our_Name    Proc    Near
  183.                 mov     add_name_ncb.COMMAND, ADD_NAME
  184.                 push    ds
  185.                 pop     es
  186.                 mov     si, offset master_name
  187.                 mov     di, offset add_name_ncb.OURNAME
  188.                 mov     cx, 8
  189.         rep     movsw
  190.                 mov     word ptr add_name_ncb.POST_FUNC+2, 0
  191.                 mov     word ptr add_name_ncb.POST_FUNC, 0
  192.                 mov     add_name_ncb.CMD_CPLT, 0FFh
  193.                 mov     bx, offset add_name_ncb
  194.                 Int     5Ch
  195.  
  196. wait_add:       cmp     add_name_ncb.CMD_CPLT, 0FFh
  197.                 je      wait_add
  198.                 ret
  199. Add_Our_Name    EndP
  200.  
  201.  
  202. Delete_Our_Name Proc    Near
  203.                 push    ds
  204.                 pop     es
  205.                 mov     delete_name_ncb.COMMAND, DELETE_NAME
  206.                 mov     si, offset master_name
  207.                 mov     di, offset delete_name_ncb.OURNAME
  208.                 mov     cx, 8
  209.         rep     movsw
  210.                 mov     word ptr delete_name_ncb.POST_FUNC+2, 0
  211.                 mov     word ptr delete_name_ncb.POST_FUNC, 0
  212.                 mov     delete_name_ncb.CMD_CPLT, 0FFh
  213.                 mov     bx, offset delete_name_ncb
  214.                 Int     5Ch
  215.  
  216. wait_delete:    cmp     delete_name_ncb.CMD_CPLT, 0FFh
  217.                 je      wait_delete
  218.                 ret
  219. Delete_Our_Name EndP
  220.  
  221.  
  222.  
  223. Cancel_Recv     Proc    Near
  224.                 push    ds
  225.                 pop     es
  226.                 mov     cncl_ncb.COMMAND, CANCEL
  227.                 mov     ax, offset recv_ncb
  228.                 mov     word ptr cncl_ncb.BUFFER_PTR, ax
  229.                 mov     word ptr cncl_ncb.BUFFER_PTR+2, ds
  230.                 mov     bx, offset cncl_ncb
  231.                 int     5Ch
  232.                 ret
  233. Cancel_Recv     EndP
  234.  
  235.  
  236. ;
  237. ;       enter Receive with:
  238. ;       DX:AX - address of buffer
  239. ;       CX    - number of bytes to receive
  240. ;       BP:BX - address of POST routine
  241. ;
  242.  
  243. Recv_Msg        Proc    Near
  244.                 push    ds
  245.                 pop     es
  246.                 mov     recv_ncb.COMMAND, RECEIVE_DATAGRAM
  247.                 push    ax
  248.                 mov     al, OurNameNumber
  249.                 mov     recv_ncb.NUM, al
  250.                 pop     ax
  251.                 mov     recv_ncb.LEN, CX
  252.                 mov     word ptr recv_ncb.BUFFER_PTR+2, dx
  253.                 mov     word ptr recv_ncb.BUFFER_PTR, ax
  254.                 mov     word ptr recv_ncb.POST_FUNC+2, bp
  255.                 mov     word ptr recv_ncb.POST_FUNC, bx
  256.                 mov     recv_ncb.CMD_CPLT, 0FFh
  257.                 mov     bx, offset recv_ncb
  258.                 Int     5Ch
  259.                 ret
  260. Recv_Msg        EndP
  261.  
  262. ;---------------------------------------
  263.  
  264. ;
  265. ;       enter Send with:
  266. ;       DX:AX - address of buffer
  267. ;       CX    - number of bytes to send
  268. ;       BP:BX - address of POST routine
  269. ;       DS:SI - address of destination name
  270. ;
  271.  
  272. Send_Msg        Proc    Near
  273.                 push    ds
  274.                 pop     es
  275.                 mov     send_ncb.COMMAND, SEND_DATAGRAM
  276.                 lea     di, send_ncb.CALLNAME
  277.                 push    cx
  278.                 mov     cx, 8
  279.         rep     movsw
  280.                 pop     cx
  281.                 push    ax
  282.                 mov     al, OurNameNumber
  283.                 mov     send_ncb.NUM, al
  284.                 pop     ax
  285.                 mov     send_ncb.LEN, cx
  286.                 mov     word ptr send_ncb.BUFFER_PTR+2, dx
  287.                 mov     word ptr send_ncb.BUFFER_PTR, ax
  288.                 mov     word ptr send_ncb.POST_FUNC+2, bp
  289.                 mov     word ptr send_ncb.POST_FUNC, bx
  290.                 mov     send_ncb.CMD_CPLT, 0FFh
  291.                 mov     bx, offset send_ncb
  292.                 Int     5Ch
  293.                 ret
  294. Send_Msg        EndP
  295.  
  296. ;---------------------------------------
  297.  
  298.                 Assume  CS:_TEXT, DS:Nothing, ES:Nothing
  299.  
  300. Int_09:         sti
  301.                 push    ax
  302.  
  303. I9_get_scan:    in      al, 60h
  304.                 mov     cs:scan_code, al
  305.                 pop     ax
  306.  
  307. I9_chain_old:   pushf
  308.                 cli
  309.                 call    cs:oldint09
  310.  
  311.                 cli
  312.                 mov     cs:SS_Save1, ss
  313.                 mov     cs:SP_Save1, sp
  314.                 mov     ss, cs:StackSeg1
  315.                 mov     sp, cs:StackOfs1
  316.                 sti
  317.  
  318. I9_save_regs:   push    ax
  319.                 push    bx
  320.                 push    cx
  321.                 push    dx
  322.                 push    si
  323.                 push    di
  324.                 push    bp
  325.                 push    ds
  326.                 push    es
  327.  
  328.                 Assume  CS:_TEXT, DS:_DATA, ES:Nothing
  329.                 mov     ax, @DATA
  330.                 mov     ds, ax
  331.                 cld
  332.  
  333. ChkCtrl5:       mov     ax, 0040h
  334.                 mov     es, ax
  335.                 test    byte ptr es:[0017h], 04h    ; Ctrl
  336.                 jz      NotCtrl5
  337.                 cmp     cs:scan_code, 4Ch           ; Center 5
  338.                 je      SayToQuit
  339.  
  340. NotCtrl5:       jmp     I9_SendKbd
  341.  
  342. SayToQuit:      mov     Done, 1
  343.  
  344. I9_ChkLastSend: cmp     send_ncb.CMD_CPLT, 0FFh
  345.                 je      I9_ChkLastSend
  346.  
  347.                 mov     Sess_Flag, -1
  348.                 mov     dx, ds
  349.                 mov     ax, offset Kbd_Data
  350.                 mov     cx, 39
  351.                 mov     bp, 0
  352.                 mov     bx, 0
  353.                 mov     si, offset slave_name
  354.                 call    Send_Msg
  355.  
  356. GotoExit:       jmp     Int09Exit
  357.  
  358.  
  359. I9_SendKbd:     cmp     Done, 0
  360.                 je      Chk_Changed
  361.  
  362.                 jmp     Int09Exit
  363.  
  364. Chk_Changed:    mov     ax, 0040h
  365.                 mov     es, ax
  366.  
  367.                 mov     al, es:[0017h]
  368.                 cmp     al, KbdFlag1
  369.                 jne     I9_Send_It
  370.  
  371.                 mov     al, es:[0018h]
  372.                 cmp     al, KbdFlag2
  373.                 jne     I9_Send_It
  374.  
  375.                 mov     ax, es:[001Ch]
  376.                 cmp     ax, Tail
  377.                 jne     I9_Send_It
  378.  
  379.                 jmp     short Int09Exit
  380.  
  381. I9_Send_It:     cmp     send_ncb.CMD_CPLT, 0FFh
  382.                 je      GotoExit
  383.  
  384. I9_SaveKbd:     push    ds
  385.                 pop     es
  386.                 mov     ax, 0040h
  387.                 mov     ds, ax
  388.                 mov     si, 0017h
  389.                 mov     di, offset Kbd_Data
  390.                 mov     cx, 39
  391.         rep     movsb
  392.                 push    es
  393.                 pop     ds
  394.                 mov     Sess_Flag, 0
  395.  
  396.                 mov     dx, ds
  397.                 mov     ax, offset Kbd_Data
  398.                 mov     cx, 39
  399.                 mov     bp, 0
  400.                 mov     bx, 0
  401.                 mov     si, offset slave_name
  402.                 call    Send_Msg
  403.  
  404. Int09Exit:      Assume  CS:_TEXT, DS:Nothing
  405.                 pop     es
  406.                 pop     ds
  407.                 pop     bp
  408.                 pop     di
  409.                 pop     si
  410.                 pop     dx
  411.                 pop     cx
  412.                 pop     bx
  413.                 pop     ax
  414.  
  415. I9_Sw_Stack2:   cli
  416.                 mov     ss, cs:SS_Save1
  417.                 mov     sp, cs:SP_Save1
  418.  
  419.                 iret
  420.  
  421. ;---------------------------------------
  422.  
  423. Int_10:         mov     cs:In_Int10, 1
  424.                 pushf
  425.                 call    cs:OldInt10
  426.                 mov     cs:In_Int10, 0
  427.                 iret
  428.  
  429. ;---------------------------------------
  430.  
  431. ScreenRecv:     mov     cs:SS_Save2, ss
  432.                 mov     cs:SP_Save2, sp
  433.                 mov     ss, cs:StackSeg2
  434.                 mov     sp, cs:StackOfs2
  435.  
  436.                 sti
  437.                 cld
  438.                 push    ax
  439.                 push    bx
  440.                 push    cx
  441.                 push    dx
  442.                 push    si
  443.                 push    di
  444.                 push    bp
  445.                 push    ds
  446.                 push    es
  447.  
  448.                 Assume  CS:_TEXT, DS:_DATA, ES:Nothing
  449.                 mov     ax, @DATA
  450.                 mov     ds, ax
  451.  
  452.                 cmp     Done, 0
  453.                 je      Chk_RetCode
  454.  
  455.                 jmp     ScreenRecvExit
  456.  
  457. Chk_RetCode:    cmp     recv_ncb.CMD_CPLT, 0
  458.                 je      EchoScreen
  459.  
  460.                 jmp     RecvScreen2
  461.  
  462. EchoScreen:     les     di, VideoPtr
  463.                 add     di, ScreenPos
  464.                 mov     si, offset ScreenPkt
  465.                 mov     cx, 250
  466.         rep     movsw
  467.  
  468. CheckIn10:      cmp     cs:In_Int10, 1
  469.                 je      Set_Head
  470.  
  471. CheckShape:     mov     cx, CursorShape
  472.                 cmp     cx, ShapeSave
  473.                 je      CheckLocation
  474.                 mov     ShapeSave, cx
  475.                 mov     ah, 1
  476.                 int     10h
  477.  
  478. CheckLocation:  mov     dx, CursorLoc
  479.                 cmp     dx, LocSave
  480.                 je      Set_Head
  481.                 mov     LocSave, dx
  482.                 mov     bh, 0
  483.                 mov     ah, 2
  484.                 int     10h
  485.  
  486. Set_Head:       mov     ax, 0040h
  487.                 mov     es, ax
  488.                 cli
  489.                 mov     ax, Head2
  490.                 mov     word ptr es:[001Ah], ax
  491.                 sti
  492.  
  493. RecvScreen2:    mov     dx, ds
  494.                 mov     ax, offset Screen_Data
  495.                 mov     cx, 508
  496.                 mov     bp, cs
  497.                 mov     bx, offset ScreenRecv
  498.                 call    Recv_Msg
  499.  
  500. ScreenRecvExit: Assume  CS:_TEXT, DS:Nothing
  501.                 pop     es
  502.                 pop     ds
  503.                 pop     bp
  504.                 pop     di
  505.                 pop     si
  506.                 pop     dx
  507.                 pop     cx
  508.                 pop     bx
  509.                 pop     ax
  510.  
  511.                 cli
  512.                 mov     ss, cs:SS_Save2
  513.                 mov     sp, cs:SP_Save2
  514.  
  515.                 iret
  516.  
  517. ;---------------------------------------
  518.  
  519. Start:          Assume  CS:_TEXT, DS:_DATA, ES:Nothing
  520.                 mov     ax, @DATA
  521.                 mov     ds, ax
  522.  
  523.                 mov     ax, cs
  524.                 mov     cs:StackSeg1, ax
  525.                 mov     ax, offset OurStack1
  526.                 mov     cs:StackOfs1, ax
  527.  
  528.                 mov     ax, cs
  529.                 mov     cs:StackSeg2, ax
  530.                 mov     ax, offset OurStack2
  531.                 mov     cs:StackOfs2, ax
  532.  
  533. get_dos_vers:   mov     ax, 3000h
  534.                 int     21h
  535.                 mov     dos_major, al
  536.                 mov     dos_minor, ah
  537.                 cmp     al, 2
  538.                 ja      netbios_test1
  539.  
  540. wrong_dos:      mov     bx, 2
  541.                 mov     dx, offset Msg3
  542.                 mov     cx, Msg3Len
  543.                 mov     ah, 40h
  544.                 int     21h
  545.  
  546.                 mov     ax, 4C00h
  547.                 int     21h
  548.  
  549. netbios_test1:  mov     ax, 0
  550.                 mov     es, ax
  551.                 cmp     word ptr es:[0170h], 0
  552.                 jne     netbios_test2
  553.  
  554. no_netbios:     mov     bx, 2
  555.                 mov     dx, offset Msg4
  556.                 mov     cx, Msg4Len
  557.                 mov     ah, 40h
  558.                 int     21h
  559.  
  560.                 mov     ax, 4C00h
  561.                 int     21h
  562.  
  563. netbios_test2:  mov     send_ncb.COMMAND, 7Fh
  564.                 mov     send_ncb.RETCODE, 0
  565.                 mov     send_ncb.CMD_CPLT, 0FFh
  566.                 mov     ax, ds
  567.                 mov     es, ax
  568.                 mov     bx, offset send_ncb
  569.                 Int     5Ch
  570.                 cmp     send_ncb.RETCODE, 3
  571.                 jne     no_netbios
  572.  
  573. bw_or_color:    mov     ah, 0Fh
  574.                 int     10h
  575.                 Cmp     AL, 7
  576.                 JE      SetMono
  577.                 Jmp     LookFurther
  578.  
  579. SetMono:        Mov     VideoSeg, 0B000h
  580.                 Mov     VideoOfs, 0000
  581.                 Jmp     network_name
  582.  
  583. LookFurther:    Mov     bx, 0FF10h
  584.                 Mov     ah, 12h
  585.                 Int     10h
  586.                 Test    bh, 0FEh
  587.                 JZ      EGAPresent
  588.                 Jmp     SetCGA
  589.  
  590. EGAPresent:     LES     BX, EGAFlagPtr
  591.                 Mov     AL, Byte Ptr ES:[BX]
  592.                 Test    AL, 00000101b
  593.                 JNZ     SetCGA
  594.                 Test    AL, 00000100b
  595.                 JNZ     SetMono
  596.                 Test    AL, 00000001b
  597.                 JNZ     SetMono
  598.  
  599. EGAIsActive:    Mov     VideoSeg, 0B800h
  600.                 Mov     VideoOfs, 0000
  601.                 Jmp     network_name
  602.  
  603. SetCGA:         Mov     VideoSeg, 0B800h
  604.                 Mov     VideoOfs, 0000
  605.  
  606. network_name:   mov     bx, 2
  607.                 mov     dx, offset Msg5
  608.                 mov     cx, Msg5Len
  609.                 mov     ah, 40h
  610.                 int     21h
  611.  
  612.                 call    Add_Our_Name
  613.                 mov     al, add_name_ncb.NUM
  614.                 mov     OurNameNumber, al
  615.                 cmp     add_name_ncb.CMD_CPLT, 0
  616.                 je      say_hello
  617.                 jmp     prog_exit
  618.  
  619. say_hello:      mov     bx, 2
  620.                 mov     dx, offset Msg2
  621.                 mov     cx, Msg2Len
  622.                 mov     ah, 40h
  623.                 int     21h
  624.  
  625. Ping_Slave:     mov     Sess_Flag, 1
  626.                 mov     dx, ds
  627.                 mov     ax, offset Kbd_Data
  628.                 mov     cx, 39
  629.                 mov     bp, 0
  630.                 mov     bx, 0
  631.                 mov     si, offset slave_name
  632.                 call    Send_Msg
  633.  
  634.                 mov     dx, ds
  635.                 mov     ax, offset Screen_Data
  636.                 mov     cx, 8
  637.                 mov     bp, 0
  638.                 mov     bx, 0
  639.                 call    Recv_Msg
  640.  
  641. Wait_Ping:      cmp     recv_ncb.CMD_CPLT, 0FFh
  642.                 jne     Pinged_Back
  643.                 mov     ah, 1
  644.                 int     16h
  645.                 jz      Wait_Ping
  646.                 mov     ah, 0
  647.                 int     16h
  648.                 cmp     al, 27
  649.                 jne     Wait_Ping
  650.  
  651. Ping_Error:     mov     bx, 2
  652.                 mov     dx, offset Msg6
  653.                 mov     cx, Msg6Len
  654.                 mov     ah, 40h
  655.                 int     21h
  656.                 call    Delete_Our_Name
  657.                 jmp     prog_exit
  658.  
  659. Pinged_Back:    cmp     recv_ncb.CMD_CPLT, 0
  660.                 jne     Ping_Error
  661.  
  662. ChkPing:        cmp     ScreenPos, -1
  663.                 jne     Ping_Error
  664.  
  665. ResetKBD:       mov     ax, 0040h
  666.                 mov     es, ax
  667.                 cli
  668.                 mov     byte ptr es:[0017h], 0
  669.                 mov     byte ptr es:[0018h], 0
  670.                 mov     ax, word ptr es:[0080h]
  671.                 mov     word ptr es:[001Ah], ax
  672.                 mov     word ptr es:[001Ch], ax
  673.                 sti
  674.                 mov     ax, ds
  675.                 mov     es, ax
  676.  
  677. save_int9:      mov     ax, 3509h
  678.                 int     21h
  679.                 mov     cs:oldint09_seg, ES
  680.                 mov     cs:oldint09_ofs, BX
  681.  
  682. save_int10:     mov     ax, 3510h
  683.                 int     21h
  684.                 mov     cs:oldint10_seg, ES
  685.                 mov     cs:oldint10_ofs, BX
  686.  
  687. install_int9:   push    ds
  688.                 mov     dx, offset Int_09
  689.                 push    cs
  690.                 pop     ds
  691.                 mov     ax, 2509h
  692.                 int     21h
  693.                 pop     ds
  694.  
  695. install_int10:  push    ds
  696.                 mov     dx, offset Int_10
  697.                 push    cs
  698.                 pop     ds
  699.                 mov     ax, 2510h
  700.                 int     21h
  701.                 pop     ds
  702.  
  703. RecvScreen:     mov     dx, ds
  704.                 mov     ax, offset Screen_Data
  705.                 mov     cx, 508
  706.                 mov     bp, cs
  707.                 mov     bx, offset ScreenRecv
  708.                 call    Recv_Msg
  709.  
  710.                 mov     Done, 0
  711. while_not_done: cmp     Done, 0
  712.                 je      while_not_done
  713.  
  714. deinstall_int9: push    ds
  715.                 mov     dx, cs:oldint09_ofs
  716.                 mov     ds, cs:oldint09_seg
  717.                 mov     ax, 2509h
  718.                 int     21h
  719.                 pop     ds
  720.  
  721. deinstall_10:   push    ds
  722.                 mov     dx, cs:oldint10_ofs
  723.                 mov     ds, cs:oldint10_seg
  724.                 mov     ax, 2510h
  725.                 int     21h
  726.                 pop     ds
  727.  
  728. ResetKBD2:      mov     ax, 0040h
  729.                 mov     es, ax
  730.                 cli
  731.                 mov     byte ptr es:[0017h], 0
  732.                 mov     byte ptr es:[0018h], 0
  733.                 mov     ax, word ptr es:[0080h]
  734.                 mov     word ptr es:[001Ah], ax
  735.                 mov     word ptr es:[001Ch], ax
  736.                 sti
  737.                 mov     ax, ds
  738.                 mov     es, ax
  739.  
  740. CnclRecv:       call    Cancel_Recv
  741. remove_name:    call    Delete_Our_Name
  742.  
  743. prog_exit:      mov     bx, 2
  744.                 mov     dx, offset Msg8
  745.                 mov     cx, Msg8Len
  746.                 mov     ah, 40h
  747.                 int     21h
  748.  
  749.                 mov     ax, 4C00h
  750.                 int     21h
  751.  
  752.                 End     Start
  753.  
  754.  
  755.