home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / basic / library / asic / asicmake / asicmake.asi next >
Encoding:
Text File  |  1991-05-10  |  6.4 KB  |  308 lines

  1. MAIN:
  2.        color 0,7
  3.        cls
  4.        locate 1,35
  5.        print " ASICMAKE "
  6.        color 7,0
  7.        locate 3,23
  8.        print "A program to merge ASIC .ASI files."
  9.        locate 4,28
  10.        print "See Documentation file."
  11.        locate 6,26
  12.        color 2,0
  13.        print "(c) Stephen Almond, May 1991."
  14.        locate 7,22
  15.        print "This program is in the PUBLIC DOMAIN."
  16.        locate 9,16
  17.        color 4,0
  18.        print "ASIC is a copyrighted program by David A. Visti."
  19.        print " "
  20.        print " "
  21.        color 1,0
  22.        print "(C)reate a '.MAK' file"
  23.        print "(A)ssemble an '.ASI' file"
  24.        print "(E)nd"
  25.        gosub WAITFORKEY:
  26.    if char$="c" then MAKEMAK:
  27.    if char$="C" then MAKEMAK:
  28.    if char$="A" then MERGEMAK:
  29.    if char$="a" then MERGEMAK:
  30.    if char$="E" then DONE2:
  31.    if char$="e" then DONE2:
  32.  
  33. MERGEMAK:
  34.        cls
  35.        count=0
  36.        print "Name of MAKE file ";
  37.        input MAKENAME$
  38.  
  39.  
  40. GOTANAME:
  41.        OUTPUTFILE$=MAKENAME$+".ASI"
  42.        MAKENAME$=MAKENAME$+".MAK"
  43.        color 2,0
  44.        print "Do you want a printout of the file ? (y or n)"
  45.        print " "
  46.        print " "
  47. TRYAGAIN:
  48.        gosub WAITFORKEY:
  49.    if char$="n" then NO:
  50.    if char$="y" then YES:
  51.        goto TRYAGAIN:
  52. NO:
  53.        printout=0
  54.        goto MAKEFILE:
  55. YES:
  56.        print " "
  57.        print " "
  58.        color 2,0
  59.        print "Turn on your printer now, please."
  60.        print "Press any key to continue."
  61.        gosub WAITFORKEY:
  62.        printout=1
  63.  
  64. MAKEFILE:
  65.        e$="open"
  66.        file$=OUTPUTFILE$
  67.        open "o",3,OUTPUTFILE$
  68.    if ERROR > 0 then PROGRAMERROR:
  69.        gosub OPENMAKEFILE:
  70. NEXT1:
  71.        gosub READMAKEFILE:
  72.    if e=1 then DATAS:
  73.        gosub OPENINPUTFILE:
  74.        low=1
  75. READ1:
  76.        gosub READALINE:
  77.    if e=1 then NEXT1:
  78.        gosub LOOKFORDIMS:
  79.    if find=0 then NEXT2:
  80.        gosub PRINTLINE:
  81.        goto READ1:
  82. NEXT2:
  83.        e$="close"
  84.        file$=char$
  85.        close 2
  86.    if ERROR > 0 then PROGRAMERROR:
  87.        goto NEXT1:
  88.  
  89. DATAS:
  90.        gosub OPENMAKEFILE:
  91. NEXT3:
  92.        gosub READMAKEFILE:
  93.    if e=1 then DATASANDDIMS:
  94.        gosub OPENINPUTFILE:
  95.        low=1
  96. READ2:
  97.        gosub READALINE:
  98.    if e=1 then NEXT3:
  99.        gosub LOOKFORDIMS:
  100.    if find=1 then READ2:
  101.        gosub LOOKFORDATAS:
  102.    if find=0 then NEXT4:
  103.        gosub PRINTLINE:
  104.        goto READ2:
  105. NEXT4:
  106.        e$="close"
  107.        file$=char$
  108.        close 2
  109.    if ERROR > 0 then PROGRAMERROR:
  110.        goto NEXT3:
  111.  
  112. DATASANDDIMS:
  113.        gosub OPENMAKEFILE:
  114. NEXT5:
  115.        gosub READMAKEFILE:
  116.    if e=1 then MADEMAKEFILE:
  117.        gosub OPENINPUTFILE:
  118.        low=1
  119. READ3:
  120.        gosub READALINE:
  121.    if e=1 then NEXT5:
  122.        gosub LOOKFORDIMS:
  123.    if find=1 then READ3:
  124.        gosub LOOKFORDATAS:
  125.    if find=1 then READ3:
  126.        gosub PRINTLINE:
  127.        goto READ3:
  128.  
  129. MADEMAKEFILE:
  130.        print " "
  131.        print " "
  132.        print "FILE ";
  133.        print OUTPUTFILE$;
  134.        print " has been created with ";
  135.        print count;
  136.        print " lines."
  137.        sound 400,20
  138.        sound 200,40
  139.        goto DONE:
  140.  
  141. OPENMAKEFILE:
  142.        e$="open"
  143.        file$=MAKENAME$
  144.        open "i",1,MAKENAME$
  145.    if ERROR > 0 then PROGRAMERROR:
  146.        return
  147.  
  148. READMAKEFILE:
  149.        e=0
  150.        e$="read"
  151.        file$=MAKENAME$
  152.        input#1,char$ NONULL
  153.    if ERROR=99 then CLOSE1:
  154.    if ERROR > 0 then PROGRAMERROR:
  155.        return
  156. CLOSE1:
  157.        e$="close"
  158.        close 1
  159.        e=1
  160.        return
  161.  
  162. OPENINPUTFILE:
  163.        e$="open"
  164.        file$=char$
  165.        open "i",2,char$
  166.    if ERROR > 0 then PROGRAMERROR:
  167.        return
  168.  
  169. READALINE:
  170.        e=0
  171. SETLINE:
  172.        line$=""
  173.        e$="read"
  174.        file$=char$
  175.    if low=0 then HALFDONE:
  176. GETINT:
  177.        input#2,twochars
  178.    if ERROR=99 then CLOSE2:
  179.    if ERROR > 0 then PROGRAMERROR:
  180.        low=0
  181.        acc1=varptr(twochars)
  182.        c=peek(acc1)
  183.    if c=13 then HALFDONE:
  184.    if c=10 then GOTLINE:
  185.        c$=chr$(c)
  186.        line$=line$+c$
  187. HALFDONE:
  188.        low=1
  189.        acc1=varptr(twochars)
  190.        acc1=acc1+1
  191.        c=peek(acc1)
  192.    if c=13 then GETINT:
  193.    if c=10 then GOTLINE:
  194.        c$=chr$(c)
  195.        line$=line$+c$
  196.        goto GETINT:
  197. GOTLINE:
  198.        return
  199. CLOSE2:
  200.        e$="close"
  201.        close 2
  202.    if ERROR > 0 then PROGRAMERROR:
  203.        e=1
  204.        return
  205.  
  206. LOOKFORDIMS:
  207.        u$="DIM "
  208.        l$="dim "
  209.        size=4
  210.        goto LOOKFOR:
  211. LOOKFORDATAS:
  212.        u$="DATA "
  213.        l$="data "
  214.        size=5
  215. LOOKFOR:
  216.        find=0
  217.        c$=mid$(line$,1,size)
  218.    if u$=c$ then LOOKFORRETURN:
  219.    if l$=c$ then LOOKFORRETURN:
  220.        find=-1
  221. LOOKFORRETURN:
  222.        find=find+1
  223.        return
  224.  
  225. PRINTLINE:
  226.        count=count+1
  227.        print line$
  228.    if printout=0 then NOLINEPRINT:
  229.        lprint line$
  230. NOLINEPRINT:
  231.        c$=chr$(13)
  232.        line$=line$+c$
  233.        c$=chr$(10)
  234.        line$=line$+c$
  235.        e$="write"
  236.        file$=OUTPUTFILE$
  237.        print#3,line$ NONULL
  238.        return
  239.  
  240. WAITFORKEY:
  241.        char$=inkey$
  242.    if char$="" then WAITFORKEY:
  243.        return
  244.  
  245. MAKEMAK:
  246.        cls
  247.        print " "
  248.        print " "
  249.        print "Name of file to create ? (NO extender) ";
  250.        input MAKENAME$
  251.        MAKENAME$=MAKENAME$+".MAK"
  252.        e$="open"
  253.        file$=MAKENAME$
  254.        open "o",1,MAKENAME$
  255.    if ERROR > 0 then PROGRAMERROR:
  256.        print " "
  257.        print " "
  258. LOOP:
  259.        print "Name of .ASI file ? (Do NOT add .ASI extender!) (/e to end.)";
  260.        input char$
  261.    if char$="/e" then DONE1:
  262.        char$=char$+".ASI"
  263.        e$="write"
  264.        print #1,char$
  265.        goto LOOP:
  266. DONE1:
  267.        e$="close"
  268.        close 1
  269.    if ERROR > 0 then PROGRAMERROR:
  270.        print MAKENAME$;
  271.        print " has been created."
  272.        print "Press any key to continue."
  273.        gosub WAITFORKEY:
  274.        char$=""
  275.        MAKENAME$=""
  276.        goto MAIN:
  277.  
  278. PROGRAMERROR:
  279.        sound 1000,20
  280.        color 4,0
  281.        print " "
  282.        print " "
  283.        print "While trying to ";
  284.        print e$;
  285.        print " ";
  286.        print file$;
  287.        print " an ERROR number ";
  288.        print ERROR;
  289.        print " has occured."
  290.        print "See 'SYSTEM ERROR CODE VALUES' in the ASIC manual to interpret."
  291.        sound 2000,20
  292. DONE:
  293.        color 2,0
  294.        print " "
  295.        print " "
  296.        print "Press any key to end."
  297.        gosub WAITFORKEY:
  298.        cls
  299.        close 1
  300.        close 2
  301.        close 3
  302.        goto MAIN:
  303.  
  304. DONE2:
  305.        cls
  306.        end
  307.  
  308.