home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / EN0717.ZIP / PAUSEPOP.ASM < prev    next >
Assembly Source File  |  1988-06-19  |  5KB  |  120 lines

  1. ;-------------------------------------------------------------------
  2. ; PAUSEPOP.ASM -- Notifies that detached OS/2 program is terminated
  3. ;                 (c) 1988, Ziff Communications Co.
  4. ;                 PC Magazine * Charles Petzold, 3/88
  5. ;-------------------------------------------------------------------
  6.  
  7.                .286
  8.  
  9.                INCLUDE OS2.INC
  10.  
  11.                DOSSEG
  12.                .MODEL    SMALL
  13.                .STACK    4096
  14.  
  15.                                    ;--------------------------
  16.                .DATA               ; Initialized Data Segment
  17.                                    ;--------------------------
  18.  
  19.                db   "PAUSEPOP (c) 1988, Ziff Communications Co. "
  20.                db   "PC Magazine ", 254," Charles Petzold, 6/88"
  21.  
  22. PopupFlag      dw   VP_WAIT OR VP_TRANSPARENT
  23.  
  24. PauseMsg       db   201, 78 dup (205), 187
  25.                db   186, 78 dup (" "), 186
  26.                db   186, " PAUSEPOP: "
  27. InsertMsg      db        67 dup (" "), 186
  28.                db   186, 78 dup (" "), 186
  29.                db   199, 78 dup (196), 182
  30.                db   186, " Press Enter to continue.", 53 dup (" "), 186
  31.                db   200, 78 dup (205), 188
  32.  
  33. Attribute1     db   1Fh
  34. Attribute2     db   70h
  35.  
  36. vioci          VIOCURSORINFO <0, 0, 0, -1>
  37. kbci           KBDKEYINFO <>
  38.  
  39.                                    ;--------------
  40.                .CODE               ; Code Segment
  41.                                    ;--------------
  42.  
  43. ;---------------------------------------
  44. ; Parse command line to get text string
  45. ;---------------------------------------
  46.  
  47. Entry:         Mov  ES, AX                   ; Environment selector
  48.  
  49. SkipProgName:  Mov  AL, ES:[BX]              ; Pull a command line byte
  50.                Inc  BX
  51.                Or   AL, AL                   ; Check if it's zero
  52.                Jnz  SkipProgName             ; If not, continue
  53.  
  54. SkipSpaces:    Mov  AL, ES:[BX]              ; Get a byte
  55.                Inc  BX                       ; Kick up the pointer
  56.                Or   AL, AL                   ; See if end of parameter
  57.                Jz   FinishMsg                ; If so, store CX
  58.  
  59.                Cmp  AL, ' '                  ; See if it's a space
  60.                Jz   SkipSpaces               ; If so, try another
  61.  
  62.                Mov  CX, 66                   ; Max number of characters
  63.                Mov  DI, Offset InsertMsg     ; Destination of message
  64.  
  65. Transfer:      Mov  [DI], AL                 ; Store byte in message
  66.                Inc  DI                       ; Increment pointer
  67.  
  68.                Mov  AL, ES:[BX]              ; Get next byte
  69.                Inc  BX                       ; Kick up source pointer
  70.                Or   AL, AL                   ; See if its zero
  71.                Loopnz Transfer               ; Continue if not zero
  72.  
  73. FinishMsg:
  74.  
  75. ;-------------------------------------------------------------------
  76. ; Pop up on clear screen (always 80 by 25) and display text strings
  77. ;-------------------------------------------------------------------
  78.  
  79.                @VioPopup PopupFlag, 0        ; Try pop up transparently
  80.  
  81.                Or   AX, AX                   ; Check error code
  82.                Jz   PoppedUp                 ; Continue if no error
  83.  
  84.                Mov  [PopupFlag], VP_WAIT OR VP_OPAQUE
  85.  
  86.                @VioPopup PopupFlag, 0        ; Pop up opaquely
  87.  
  88. PoppedUp:      Mov  CX, 7                    ; Number of lines
  89.                Sub  DX, DX                   ; Row number
  90.                Sub  SI, SI                   ; Offset in PauseMsg
  91.  
  92. LineLoop:      @VioWrtCharStrAtt PauseMsg[SI], 80, DX, 0, Attribute1, 0
  93.  
  94.                Inc  DX                       ; Next row
  95.                Add  SI, 80                   ; Next line in message
  96.                Loop LineLoop
  97.  
  98.                @VioWrtNAttr Attribute2, 24, 5, 2, 0
  99.  
  100.                @VioSetCurType vioci, 0       ; Hide cursor
  101.  
  102.                @DosBeep 256, 250             ; Alert user
  103.  
  104. ;---------------------------------------
  105. ; Wait for keystroke and then terminate
  106. ;---------------------------------------
  107.  
  108.                @KbdFlushBuffer 0             ; Flush keyboard buffer
  109.  
  110. CheckKey:      @KbdCharIn kbci, IO_WAIT, 0   ; Wait for keystroke
  111.  
  112.                Cmp  [kbci.kbci_chChar], 13   ; Check if Enter
  113.                Jnz  CheckKey                 ; If not, get another key
  114.  
  115.                @VioEndPopUp 0                ; End the popup
  116.  
  117.                @DosExit EXIT_PROCESS, 0      ; Exit program
  118.  
  119.                END  Entry
  120.