home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / assemblr / library / sampler1 / basload.asm < prev    next >
Assembly Source File  |  1985-01-29  |  3KB  |  88 lines

  1. ;BASLOAD.ASM      07/09/84 - DKeels
  2. ;----------------------------------------------------------------------------
  3. ;This program provides BASIC programs with access to the program loader (LOAD) 
  4. ;by passing parameters via the system parameter area (SYSPARM).
  5. ;
  6. ;Inputs:
  7. ;  FILE SPEC 1    - A string (len <= 80) with the complete name, including
  8. ;          path, of the file to be loaded and executed.
  9. ;          Example: 'MAINMENU.EXE' or 'C:\FORMAT.COM'
  10. ;  PARAMETER 1  - A string (len <= 80) with the command line parameters
  11. ;          to be passed to the program specified in FILE SPEC 1.
  12. ;          Example: '' or 'A:'
  13. ;  FILE SPEC 2  - Same as 1.
  14. ;  PARAMETER 2  - Same as 1.
  15. ;
  16. ;Outputs:
  17. ;  This program gives control to LOAD.
  18. ;----------------------------------------------------------------------------
  19.  
  20.  
  21. CODE        SEGMENT 'CODE'
  22.         ASSUME    CS:CODE
  23.  
  24.  
  25.         PUBLIC    BASLOAD        ;make known to BASIC at link time
  26. BASLOAD        PROC    FAR
  27.  
  28.     ;prologue
  29.         PUSH    BP        ;save BP
  30.         MOV    BP,SP        ;set base for parm list
  31.         PUSH    DS        ;DS -> basic work area
  32.         PUSH    ES        ;ES -> basic work area
  33.         MOV    DX,'dk'        ;interrupt verification switch
  34.         INT    77H        ;get seg address of sysparm area in AX
  35.         MOV    ES,AX        ;ES -> sysparm area
  36.         CLD            ;set direction for all moves
  37.  
  38.     ;move file spec 1 to sysparm
  39.         MOV    BX,SS:[BP+12]    ;get addr of string descriptor
  40.         MOV    CX,DS:[BX]    ;get length of string into CX
  41.         MOV    SI,DS:[BX+2]    ;get addr of string into SI
  42.         MOV    DI,0        ;offset into sysparm
  43.         REP    MOVSB        ;move string
  44.         MOV    BYTE PTR ES:[DI],0    ;make it asciiz string
  45.  
  46.     ;move parameter 1 to sysparm
  47.         MOV    BX,SS:[BP+10]    ;get addr of string descriptor
  48.         MOV    CX,DS:[BX]    ;get length of string into CX
  49.         MOV    SI,DS:[BX+2]    ;get addr of string into SI
  50.         MOV    DI,81        ;offset into sysparm
  51.         INC    CL        ;adjust for cr to be added at end
  52.         MOV    BYTE PTR ES:[DI],CL    ;1st byte is length of string
  53.         DEC    CL        ;re-adjust for move operation
  54.         INC    DI
  55.         REP    MOVSB        ;move string
  56.         MOV    BYTE PTR ES:[DI],13    ;add cr to end
  57.  
  58.     ;move file spec 2 to sysparm
  59.         MOV    BX,SS:[BP+8]    ;get addr of string descriptor
  60.         MOV    CX,DS:[BX]    ;get length of string into CX
  61.         MOV    SI,DS:[BX+2]    ;get addr of string into SI
  62.         MOV    DI,163        ;offset into sysparm
  63.         REP    MOVSB        ;move string
  64.         MOV    BYTE PTR ES:[DI],0    ;make it asciiz string
  65.  
  66.     ;move parameter 2 to sysparm
  67.         MOV    BX,SS:[BP+6]    ;get addr of string descriptor
  68.         MOV    CX,DS:[BX]    ;get length of string into CX
  69.         MOV    SI,DS:[BX+2]    ;get addr of string into SI
  70.         MOV    DI,244        ;offset into sysparm
  71.         INC    CL        ;adjust for cr to be added at end
  72.         MOV    BYTE PTR ES:[DI],CL    ;1st byte is length of string
  73.         DEC    CL        ;re-adjust for move operation
  74.         INC    DI
  75.         REP    MOVSB        ;move string
  76.         MOV    BYTE PTR ES:[DI],13    ;add cr to end
  77.  
  78.     ;exit to BASIC
  79.         POP    ES
  80.         POP    DS
  81.         POP    BP
  82.         RET    8
  83.  
  84. BASLOAD        ENDP
  85.  
  86. CODE        ENDS
  87.         END    BASLOAD
  88.