home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / fortran / library / comline / comline.asm < prev    next >
Assembly Source File  |  1991-07-01  |  3KB  |  91 lines

  1. ;=======================================================================
  2. ;
  3. ;   PROGRAM FILE:  COMLINE.ASM
  4. ;
  5. ;   DATE:  June 23, 1991
  6. ;
  7. ;   VERSION:  2.02                      REVISION DATE: June 26, 1991
  8. ;
  9. ;   AUTHOR:  Scott D. Heavner 
  10. ;
  11. ;   LANGUAGE: Assembly Language Routine for FORTRAN 
  12. ;
  13. ;   COPYRIGHT:  1991, Scott D. Heavner
  14. ;
  15. ;=======================================================================
  16. ;
  17. ;   DESCRIPTION: A routine to read the user options entered at the 
  18. ;                command line into a FORTRAN string.  The first character
  19. ;                of the string will be the length of the line input by the 
  20. ;                user.  Input ends with a CR.
  21. ;
  22. ;   CONTENTS:    call CLINE(CHARACTER*128)
  23. ;
  24. ;
  25. ;   APPRECIATION:  If you find this program instructive or helpful, a 
  26. ;                small (or large) donation would be greatly appreciated.
  27. ;
  28. ;                Send them to:    Scott Heavner
  29. ;                                 19 Pine Woods Drive
  30. ;                                 North Tonawanda, NY 14120
  31. ;
  32. ;   COMMENTS:   Send EMAIL to sdh@po.cwru.edu
  33. ;
  34. ;=======================================================================
  35.     TITLE   COMLINE.ASM
  36.     NAME    COMLINE
  37. ;----------------------------------------------------------------------
  38. ;   Subroutine CLINE(CHARACTER*128)
  39. ;
  40. ;   Copyright 1991 -- Scott D. Heavner
  41. ;
  42. ;   Uses DOS INT 21-2F to read address of last load (where command line
  43. ;        is stored).  This may be adjusted by an overlay file.  If this
  44. ;        adjustment does occur, the only thing that should be altered is
  45. ;        the length of the string (and possibly the first character will
  46. ;        become a carriage return.  Since this routine does not clear
  47. ;        the string before it's use, the previous data will remain.
  48. ;
  49. ;----------------------------------------------------------------------
  50.     .8087
  51. CODE    SEGMENT  BYTE PUBLIC
  52. CODE    ENDS
  53. DATA    SEGMENT  WORD PUBLIC
  54. DATA    ENDS
  55.     ASSUME  CS: CODE, DS: DATA, SS: DATA, ES: DATA
  56. CODE      SEGMENT
  57.     PUBLIC    CLINE
  58. CLINE    PROC FAR
  59.     push    bp        ; Prepare for far call
  60.     mov    bp,sp        ;  +
  61. ;
  62.     push    si        ; Save Index Registers
  63.     push    di        ;   +
  64.     push    ds        ; Save Segment Registers
  65.     push    es        ;   +
  66. ;
  67.     les    bx,DWORD PTR [bp+6]    ; Put offset of CLINE variable in DI
  68.     mov    DI,bx        ;   +
  69.     push    es
  70.      mov    SI,0080H    ; Load SI with offset of Command Line input
  71.     mov    ax,2F00H    ; Interrupt to get seg of main (return ES:BX)
  72.     int    21H        ;   - may not work with overlay files
  73.     push    es        ; Transfer ES(main prog addr) to DS
  74.     pop    ds        ; DS now contains seg of Comline
  75.     pop    es        ; ES now contains seg of Destination String
  76.     mov    cx,64        ; Load CX with number of words to move
  77.     rep    movsw        ; Transfer Command line to String
  78. ;    
  79.     pop    es        ; Restore Segment Registers
  80.     pop    ds        ;  +
  81.     pop    di        ; Restore Index Registers  
  82.     pop    si        ;  +
  83. ;
  84.     mov    sp,bp        ; Return from far call
  85.     pop    bp        ;  +
  86.     ret    4        ;  +
  87.  
  88. CLINE    ENDP
  89. CODE    ENDS
  90. END
  91.