home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-386-Vol-2of3.iso / b / batdoor.zip / PAUSE_R.ZIP / PAUSE_R.ASM next >
Assembly Source File  |  1986-11-21  |  3KB  |  83 lines

  1. ;
  2. ; PAUSE_R: A remote PAUSE for DOORS users.
  3. ;
  4. ; Courtesy of: The BBS of Excellence (312)398-2872
  5. ;
  6. ; To make this program work under COM2: change the constants as
  7. ; indicated.
  8. ;
  9. cseg    segment  byte public 'CODE'
  10.         assume   cs:cseg,ds:cseg,es:cseg
  11.         org      100h
  12. Pause_r proc     near
  13.         jmp      MainCode   ; Skip over constant
  14. ;
  15. LineReg  dw      3FDh       ; for COM1: 2FDh = COM2:
  16. DataReg  dw      3F8h       ; for COM1: 2F8h = COM2:
  17. ;
  18. MainCode:
  19.         Call     WriteMsg   ; If a message exists, then output it
  20.         Call     Wait       ; Go wait for an input
  21.         Int      20h        ; Terminate program
  22. Pause_r endp
  23.  
  24. WriteMsg   Proc    Near
  25.            mov     SI,80h          ; point to the command buffer
  26.            Xor     CX,CX           ; Init the loop counter
  27.            Mov     CL,[SI]         ; Get the input length
  28.            Cmp     CL,0            ; Was there no input ?
  29.            JZ      ExitWrite       ; True...then just wait
  30.            Inc     SI              ; Point past the length
  31. WriteLoop:
  32.            Mov     AH,2            ; Indicate screen write
  33.            Inc     SI              ; Point to next character
  34.            Mov     DL,[SI]         ; Get the character
  35.            Cmp     DL,'|'          ; Is this an Esc character ?
  36.            Jne     WriteScreen     ; No...continue
  37.            Mov     DL,27           ; Change to a REAL Esc character
  38. WriteScreen:
  39.            Int     21h             ; Write character to the screen
  40.            Mov     AL,[SI]         ; Get the character
  41.            Cmp     AL,'@'          ; Is it an Esc request ?
  42.            Jne     WriteCom        ; No...continue
  43.            Mov     AL,27           ; Change to a REAL Esc character
  44. WriteCom:
  45.            Push    AX              ; Save the byte
  46. WaitLineLoop:
  47.            Mov     DX,LineReg      ; Get the Line Register address xFDh
  48.            In      AL,DX           ; Get the Line status
  49.            And     AL,20h          ; Is the Xmit buffer empty ?
  50.            Cmp     AL,20h          ; Is it?
  51.            Jne     WaitLineLoop    ; No...Exit to caller
  52.            Pop     AX              ; Restore the byte
  53.            Mov     DX,DataReg      ; Point to output port
  54.            Out     DX,AL           ; Output the character
  55.            Loop    WriteLoop       ; Keep doing it until no more
  56. ExitWrite:
  57.            Ret                     ; Return to main routine
  58. WriteMsg   Endp
  59.  
  60. Wait       Proc    Near
  61. Read_Byte_Wait:
  62.            Mov     DX,LineReg      ; Get the Line Register address xFDh
  63.            In      AL,DX           ; Get the Line status
  64.            And     AL,01h          ; Isolate data ready bit
  65.            Cmp     AL,01h          ; Is there data ready
  66.            Jz      Get_Remote_Byte ; Yes...clear buffer and exit
  67.            Mov     AH,1            ; Set up status command
  68.            Int     16h             ; Has a local key been pressed ?
  69.            Jz      Read_Byte_Wait  ; No...keep on waiting
  70.            Xor     AH,AH           ; Set up read command
  71.            Int     16h             ; clear the buffer
  72.            Jmp     Wait_Exit       ; Return to caller
  73. Get_Remote_Byte:
  74.            Mov     DX,DataReg      ; Point to the data register
  75.            In      AL,DX           ; Get the data byte
  76. Wait_Exit:
  77.            Ret                     ; Return to main routine
  78. Wait       Endp
  79. CSEG       Ends
  80.            End     Pause_r
  81.  
  82.  
  83.