home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / BASIC / BAS_SUB.ZIP / BASPARAM.BAS < prev    next >
Encoding:
BASIC Source File  |  1985-04-19  |  1.5 KB  |  25 lines

  1. 10 '**************************************************************************
  2. 20 ' taken from *.* column in PC World, November, 1983 with a mod to get rid
  3. 30 ' of a leading space on the parameter string. useful for compiled BASIC
  4. 40 ' only.
  5. 50 ' If you start a program with a command line such as "a>PROGRAM ABCDEFGH"
  6. 60 ' Then PARM will be "ABCDEFGH"
  7. 70 ' basparm.bas--this is a program fragment, include at the start of your program
  8. 80 DEF SEG                 :'point data segment register to basic
  9. 90 DIM SUBR%(3)              :'array to contain machine subroutine
  10. 100 DEF USR0=VARPTR(SUBR%(0))         :'get subroutine's segment offset
  11. 110 SUBR%(0)=&H5B59             :'pop CX         pop BX
  12. 120 SUBR%(1)=&H5153             :'push BX        push CX
  13. 130 SUBR%(2)=&HEB83             :'sub BX,10H
  14. 140 SUBR%(3)=&HCB10             :'retf
  15. 150 I%=0                 :'dummy parameter to functionn  call
  16. 160 PSP%=USR0(I%)             :'get program segment prefix's segment
  17. 170 DEF SEG=PSP%             :'set base register at that segment
  18. 180 PARMLEN%=PEEK(&H80)          :'get command parameter length
  19. 190 PARM$=""                         :'set up string to receive the string
  20. 200 FOR I% = 2 TO PARMLEN%         :'loop thru parameter string but skip
  21. 210 PARM$=PARM$+CHR$(PEEK(&H80+I%))  :'leading blank char. collect whole string
  22. 220 NEXT I%                 :'until end of the string
  23. 230 DEF SEG                 :'return to normal data string
  24. 240 '**************************************************************************
  25.