home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / basic / compiler / asic / callsrch.asi < prev    next >
Text File  |  1994-03-01  |  2KB  |  58 lines

  1. rem callsrch.asi
  2. rem Copyright (c) 1993 by David A. Visti -- All rights reserved
  3. rem this program demonstrates how to call an assembly language subroutine
  4. rem from ASIC.  To run this program, you must also have an assembler (such
  5. rem as Borland's Turbo Assembler, or Microsoft's Assembler.
  6. rem Here are the steps to build this program from the DOS command line
  7. rem Step 1) Assemble the file SRCH.ASM:
  8. rem
  9. rem                     TASM SRCH               <--Borland
  10. rem                     MASM SRCH               <--Microsoft
  11. rem Step 2) Compile the ASIC program and link to the assembler object file:
  12. rem                     ASICC CALLSRCH B/OBJ OBJ=SRCH LNK=C:\DOS
  13. rem
  14. rem         (Note:  Make sure that the "LNK=" parameter points to the
  15. rem          directory on your hard disk that contains the file: LINK.EXE)
  16. rem
  17. rem Instead of following "Step 2)" above, you can build CALLSRCH from the
  18. rem integrated enviroment:
  19. rem        o   Open the "Compile" Menu, Select "Advanced Options"
  20. rem        o   Select "obJects Names", and enter: SRCH    for the object name
  21. rem        o   Select "Obj output file" option
  22. rem        o   Select "Link path", and enter: C:\DOS      or whatever
  23. rem                                                       directory LINK.EXE
  24. rem                                                       is located in
  25. rem        o   Close menu and press <F10> to compile program.
  26. rem
  27. rem
  28. rem this program calls SRCH.ASM, an assembly language subroutine that will
  29. rem search an ASIC string array for a string, and return the element number
  30. rem of the array in which it found the search string.  If the search string
  31. rem is not found, SRCH returns an element number of "-1".
  32. rem call SRCH as follows:
  33. rem  CALL SUB "SRCH" (stringarray$(0),arraysize,searchstring$,returnval)
  34. dim names$(4)
  35. data "Tim","Jim","Dave","John","George"
  36. for i=0 to 4
  37.    read names$(i)
  38. next i
  39. search$="George"
  40. gosub search:
  41. search$="Sally"
  42. gosub search:
  43. end
  44.  
  45. search:
  46.    call sub "srch" (names$(0),4,search$,sub)
  47.    if sub>-1 then
  48.       print "Found ";
  49.       print search$;
  50.       print " in element ";
  51.       print sub
  52.    else
  53.       print search$;
  54.       print " not found in array"
  55.    endif
  56.    return
  57.  
  58.