home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l350 / 3.ddi / EXAMPLES / ASM / PECHO.ASM < prev    next >
Encoding:
Assembly Source File  |  1988-05-29  |  2.0 KB  |  82 lines

  1. ;************************************************************************/
  2. ;*    Copyright (C) 1986-1988 Phar Lap Software, Inc.            */
  3. ;*    Unpublished - rights reserved under the Copyright Laws of the    */
  4. ;*    United States.  Use, duplication, or disclosure by the         */
  5. ;*    Government is subject to restrictions as set forth in         */
  6. ;*    subparagraph (c)(1)(ii) of the Rights in Technical Data and     */
  7. ;*    Computer Software clause at 252.227-7013.            */
  8. ;*    Phar Lap Software, Inc., 60 Aberdeen Ave., Cambridge, MA 02138    */
  9. ;************************************************************************/
  10. ;
  11. ; ECHO386 - Echo command line arguments
  12. ;
  13. ; This program illustrates how to pick up command line arguments
  14. ; whenb running in 386 protected mode.  This program simply
  15. ; echos the command line arguments which it is given to the screen.
  16. ; The command line is contained in the PSP.  DOS-Extender sets up selector
  17. ; number #24 to point to the PSP.
  18. ;
  19.  
  20. ;
  21. ;    Start of the program
  22. ;
  23.  
  24. _text    segment    byte public use32 'code'
  25.  
  26.     assume    cs:_text
  27.  
  28. ;
  29. ; Local definitions
  30. ;
  31.  
  32. SS_UPSP    equ    024H            ; PSP selector number
  33.  
  34.  
  35. ;
  36. ; The code
  37. ;
  38.  
  39.     public    _start_            ;
  40. _start_    proc    near            ;
  41.  
  42.     mov    ax,SS_UPSP        ; Set-up ES to address the PSP.
  43.     mov    es,ax            ;
  44.  
  45.     mov    cl,es:080H        ; Load the length of the command line
  46.     mov    esi,081H        ;    into CL and set ESI to address
  47.                     ;    the first text character of the
  48.                     ;    command line.
  49.  
  50.     jmp    #bot1            ; Go to the bottom of the output loop.
  51.  
  52. #loop1:    mov    dl,es:[esi]        ; Call DOS to output the next 
  53.     mov    ah,02H            ;    character.
  54.     int    21H            ;
  55.  
  56.     add    esi,1            ; Increment the command line pointer.
  57.  
  58. #bot1:    sub    cl,1            ; Decrement CL and loop if not done
  59.     jns    #loop1
  60.  
  61.     mov    dl,0DH            ; Output CR/LF.
  62.     mov    ah,02H            ; 
  63.     INT    21H            ;
  64.     mov    dl,0AH            ; 
  65.     mov    ah,02H            ;
  66.     INT    21H            ;
  67.  
  68.     mov    ax,04C00H        ; Exit back to DOS.
  69.     INT     21H            ;
  70.  
  71. _start_    endp                ;
  72.  
  73. _text    ends                ;
  74.  
  75. _stack    segment byte stack use32 'stack'
  76.  
  77.     db    8192 dup (?)
  78.  
  79. _stack    ends
  80.  
  81.     end _start_
  82.