home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / CPM / LANGUAGS / FORTRAN / CPMLIB.ARK / CPMFNA.MAC < prev    next >
Text File  |  1982-01-12  |  3KB  |  101 lines

  1. ;
  2. ;    CPMFNA
  3. ;
  4. ;    CP/M Command Line - interface routine
  5. ;
  6. ;
  7. ;    Originally written:  November, 1981
  8. ;
  9. ;    Pre-release modifications:
  10. ;    (none)
  11. ;
  12. ;    Released to CP/M User's Group as:
  13. ;    Version 1.0
  14. ;    January 12, 1982
  15. ;
  16. ;    Author: William R. Brandoni
  17. ;
  18. ;    Language: Microsoft M80 (MACRO-80 assembler) Version 3.4 (26-Nov-80)
  19. ;
  20. ;
  21. ;    See the "User-Defined Equates" section for modifications
  22. ;    you may have to make to reassemble this file.
  23. ;
  24. ; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  25. ;
  26. ;    This file is an interface for
  27. ;    extracting the "Command Line Tail" from
  28. ;    the CP/M operating system.
  29. ;
  30. ;    The main reason for its existance is to provide
  31. ;    an interface between Microsoft FORTRAN-80 and
  32. ;    the command line, as a means to pass input to
  33. ;    a FORTRAN program at the command level.
  34. ;
  35. ;    This file is intended as support to Microsoft FORTRAN
  36. ;    subroutines which in turn provide all of the
  37. ;    interfacing and setup functions prior to calling
  38. ;    this subroutine.
  39. ;
  40. ;    Arguments are assumed to be passed into this routine
  41. ;    in Microsoft format (ie. all arguments passed as addresses).
  42. ;
  43. ; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  44. ;
  45. ;    For an explanation of the command line processing, see
  46. ;    the "CP/M 2.0 INTERFACE GUIDE" (c) 1979 by Digital
  47. ;    Research
  48. ;
  49. ; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  50.     PAGE
  51. ; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  52. ;
  53. ;    User-Defined Equates
  54. ;
  55. ;
  56. ;    Define base of CP/M (std version is 0000H)
  57. ;
  58. ;
  59.     BASE    EQU    0000H    ;<--- set to base of your CP/M
  60. ;
  61. ; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  62. ;
  63. ;    Miscellaneous Equates
  64. ;
  65.     CMDLIN    EQU    BASE+0080H
  66. ;
  67. ; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  68.     PAGE
  69. ; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  70. ;
  71. ;
  72. ;    Arguments    FORTRAN
  73. ;    P1 (address in)    address of P1 in HL
  74. ;
  75.     ENTRY    CPMFNA
  76. CPMFNA:    SHLD    P1        ;Store param 1 and leave in <HL>
  77.     LXI    D,CMDLIN    ;Load address of command line in <DE>
  78.     LDAX    D        ;Get first byte (=no of bytes left)
  79.     MOV    M,A        ;    store in param 1
  80.                 ;    and leave in A as a counter
  81.     MVI    B,0        ;Set up B as loop counter
  82. LOOP:    CMP    B        ;"Are we done?"
  83.     JZ    EXIT
  84.     INR    B        ;Increment counter
  85.     INX    D        ;Increment command line address
  86.     INX    H        ;Increment param 1 address
  87.     MOV    C,A        ;Save loop counter
  88.     LDAX    D        ;Get next byte of line
  89.     MOV    M,A        ;    store in param 1
  90.     MOV    A,C        ;Restore loop counter
  91.     JMP    LOOP        ;    and try again
  92. EXIT:    LHLD    P1        ;Restore original P1 address
  93.     RET            ;    and return
  94. ;
  95. ; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  96. ;
  97. ;    Define temporary storage
  98. ;
  99. P1:    DS    2
  100.     END
  101.