home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / batch / library / batutl2 / pause21.asm < prev    next >
Assembly Source File  |  1988-04-20  |  2KB  |  83 lines

  1. TITLE    PAUSE2    11-4-84    [4-16-88]
  2. ;Toad Hall Disassembly, tweak
  3.  
  4. LF    EQU    0AH
  5. CR    EQU    0DH
  6. ;
  7. ;INITIAL VALUES :    CS:IP    0000:0100
  8. ;            SS:SP    0000:FFFF
  9.  
  10. CodeSeg    SEGMENT
  11.     ASSUME DS:CodeSeg,SS:CodeSeg,CS:CodeSeg,ES:CodeSeg
  12.     ORG    100H
  13.  
  14. Pause2    proc    near
  15. ;    push    DS            ;save DS
  16.     CLD                ;insure fwd
  17.     JMP    Start            ;skip over our buffer
  18. ;I don't know WHY the author decided to move the PSP command line
  19. ;into an internal buffer.  We could have processed/displayed the
  20. ;cmd line characters just as easily as this buffer, and saved all
  21. ;the hassle of moving the damned thing!
  22. ;I DID throw out all his resetting of segment registers (DS and ES)
  23. ;just to LODSB and STOSB a buffer right here in the code segment!
  24. ;Donno why he messed with all that hassle either!
  25.  
  26. buffer    DB    100H DUP(0)
  27.  
  28. Start:
  29. ;    MOV    AX,OFFSET Pause2
  30. ;    MOV    ES,AX            ;ES=our buffer
  31. ;    Assume    ES:Nothing
  32.  
  33. ;    MOV    DI,8            ;back to buffer start
  34.     mov    di,offset buffer    ;copying into buffer
  35.     MOV    SI,80H            ;DOS PSP cmd line start
  36.     LODSB                ;snarf length byte
  37.     MOV    CL,AL            ;save in cl
  38.     XOR    CH,CH            ;clear msb to use as counter
  39.     LODSB                ;snarf first cmd line char (space)
  40.  
  41. Lup223:    LODSB                ;snarf first cmd line char
  42.     CMP    AL,CR            ;done?
  43.     JZ    L022B            ; yep
  44.      STOSB                ; stuff in buffer
  45.      LOOP    Lup223            ; and keep looping
  46.  
  47. L022B:    STOSB                ;stuff the terminating CR or 0
  48. ;    MOV    AX,OFFSET Pause2    ;point DS to our buffer
  49. ;    MOV    DS,AX
  50. ;    Assume    DS:Nothing
  51. ;
  52. ;    MOV    SI,8            ;bump a little into the buffer
  53.     mov    si,offset buffer    ;snarfing FROM buffer now
  54.     MOV    AH,2            ;prepare for Display Output
  55.  
  56. ;Display our Pause2 prompt
  57. Lup236:    LODSB                ;snarf old cmd line char
  58.     or    al,al            ;terminating 0?
  59.     je    L0241            ; yep, done
  60.     CMP    AL,CR            ;terminating CR?
  61.     JZ    L0241            ; yep, done
  62.      MOV    DL,AL            ; need char in DL
  63.      INT    21H            ;Display output
  64.      JMP    SHORT    Lup236        ; and keep going
  65.  
  66. L0241:
  67.     mov    ax,0C01H        ;Clear kbd, do Func 1
  68.     INT    21H            ; (kbd input w/echo)
  69. ;    pop    DS            ;restore original DS
  70. ;    ASSUME    DS:CodeSeg
  71.  
  72.     mov    dx,offset CrLf        ;string offset
  73.     mov    ah,9            ;display string
  74.     int    21H
  75.     mov    ax,4C00H        ;terminate, Errorlevel 0
  76.     int    21H
  77.  
  78. CrLf    db    CR,LF,'$'
  79. Pause2    endp
  80.  
  81.     CodeSeg    ENDS
  82.     END    Pause2
  83.