home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d5xx / d592 / ezasm.lha / EZAsm / Mk.s < prev    next >
Text File  |  1992-01-31  |  3KB  |  234 lines

  1.  
  2. *    Make for EZAsm, A68k, Blink
  3. *    Test for success by Lock() / Examine() on produced file
  4.  
  5. *    Support for with/without include path:
  6.  
  7. *        Mk -iPathToIncludes filenm
  8. *        Mk filenm
  9.  
  10. *    Support for .mak file
  11.  
  12. *        Mk filenm
  13.  
  14.  
  15.  
  16. *    ( Minutes combined with Tics to prevent "wrap around" problems )
  17.  
  18.  
  19.  
  20. LONG    CLIArg Nm _DosBase OutHandle
  21. LONG    Buf Tbuf
  22. LONG    FIB Cdays Flock Comb
  23. LONG    Fhandle Rbuf PtrSave
  24. BYTE    MkSw
  25.  
  26.  
  27.  
  28.  
  29.     CLIArg = a0
  30.     -1(a0,d0.w) = 0        ;0 terminate CLI argument
  31.  
  32.     _DosBase = OpenLibrary( "dos.library" 0 )
  33.     beq    Quit
  34.  
  35.     FIB = AllocMem( 300 $10001 )    ;FIB buffer
  36.     beq    Quit
  37.  
  38.     Tbuf = AllocMem( 12 $10001 )    ;DateStamp() buffer
  39.     beq    Quit
  40.  
  41.     Buf = AllocMem( 127 $10001 )    ;Execute() buffer
  42.     beq    Quit
  43.  
  44.     PrintInit( )
  45.     beq    Quit
  46.  
  47.     OutHandle = Output( )
  48.  
  49. *   Get current time
  50.  
  51.     a0 = DateStamp( Tbuf )
  52.  
  53.     Cdays = (a0)    ;save Days
  54.  
  55.     d0 = 4(a0)    ;D0 = Minutes
  56.     swap    d0    ;Minutes to upper 2 bytes
  57.     d0 |= 8(a0)    ;combine Minutes with Tics
  58.  
  59.     Comb = d0    ;save for compare
  60.  
  61. *   Adjust CLI args for an include path..
  62.  
  63.     strrchr( CLIArg $20 )
  64.     d0 != 0 {
  65.         d0 ++
  66.         Nm = d0
  67.     } else {
  68.         Nm = CLIArg
  69.  
  70.         strcpy( Buf Nm )
  71.         strcat( Buf ".mak" )
  72.  
  73.         Fhandle = Open( Buf 1005 )
  74.         beq    Cont
  75.  
  76.         MkSw = 1
  77.  
  78.         Rbuf = AllocMem( 1000 $10001 )        
  79.         beq    Quit
  80.  
  81.         PtrSave = Rbuf
  82.  
  83.         Read( Fhandle Rbuf 1000 ) 
  84.         bmi    Quit
  85.     }
  86.  
  87. Cont
  88.     Print( "--------------------\n" * )
  89.  
  90.     MkSw = 1 {
  91.         bsr    LoadNext
  92.     } else {
  93.         strcpy( Buf "ezasm " )
  94.         strcat( Buf Nm )
  95.         strcat( Buf ".s\n" )
  96.     }
  97.  
  98.     Execute( Buf 0 OutHandle )    ; "ezasm [file].s\n"
  99.  
  100.     Print( "--------------------\n" * )
  101.  
  102.     strcpy( Buf Nm )    ;get name to Lock() 
  103.     strcat( Buf ".asm" )
  104.  
  105.     bsr    Check
  106.  
  107.     MkSw = 1 {
  108.         bsr    LoadNext
  109.     } else {
  110.         strcpy( Buf "a68k " )
  111.         strcat( Buf CLIArg )
  112.         strcat( Buf ".asm\n" )
  113.     }
  114.  
  115.     Execute( Buf 0 OutHandle )    ; "a68k [file].asm\n"
  116.  
  117.     Print( "--------------------\n" * )
  118.  
  119.     strcpy( Buf Nm )    ;get name to Lock() 
  120.     strcat( Buf ".o" )
  121.  
  122.     bsr Check
  123.  
  124.     MkSw = 1 {
  125.         bsr    LoadNext
  126.     } else {
  127.         strcpy( Buf "blink FROM " )
  128.         strcat( Buf Nm )
  129.  
  130.         strcat( Buf ".o LIBRARY ez.lib TO " )
  131.         strcat( Buf Nm )
  132.         strcat( Buf "\n" );
  133.     }
  134.  
  135. *  Blink FROM [file].o LIBRARY ez.lib TO [file]
  136.  
  137.     Execute( Buf 0 OutHandle )
  138.  
  139.     jmp    Quit
  140.  
  141.  
  142.  
  143.  
  144. Check
  145.  
  146.  
  147.     Flock = Lock( Buf -2 )      
  148.     beq    Quit
  149.  
  150. *   It's here, but is it more recent than Current values?
  151.  
  152.     Examine( Flock FIB )
  153.     beq    Quit
  154.  
  155.     a0 = FIB
  156.     d0 = 132(a0)        ;D0 = Days
  157.     d0 < Cdays  Quit
  158.  
  159.     d0 = 136(a0)        ;D0 = Minutes
  160.     swap    d0
  161.     d0 |= 140(a0)        ;combine with Tics
  162.  
  163.     d0 < Comb Quit
  164.  
  165.     UnLock( Flock )
  166.     Flock = 0
  167.  
  168.     rts
  169.  
  170.  
  171. *   Locate next line to Execute(), and load into Buf..
  172.  
  173. LoadNext
  174.  
  175.  
  176.     a0 = PtrSave
  177.  
  178. Again
  179.     isalpha( * ) {
  180.         a0 = PtrSave 
  181.         a1 = Buf
  182.  
  183. Nxt        (a1)+ = (a0)+ b
  184.         -1(a1) != $0a Nxt
  185.  
  186.         (a1) = 0 b
  187.         PtrSave = a0    ;( byte after $0a )
  188.  
  189.         rts
  190.     }
  191.  
  192.     a0 = PtrSave
  193. Inc    (a0)+ = $0a {
  194.         PtrSave = a0
  195.         jmp    Again
  196.     }
  197.     jmp    Inc
  198.  
  199.  
  200.  
  201. Quit
  202.     PrintClose( )
  203.  
  204.     Fhandle != 0 {
  205.         Close( Fhandle )
  206.     }
  207.  
  208.     Rbuf != 0 {
  209.         FreeMem( Rbuf 1000 )
  210.     }
  211.  
  212.     Flock != 0 {
  213.         UnLock( Flock )
  214.     }
  215.  
  216.     FIB != 0 {
  217.         FreeMem( FIB 300 )
  218.     }
  219.  
  220.     Tbuf != 0 {
  221.         FreeMem( Tbuf 12 )
  222.     }
  223.  
  224.     Buf != 0 {
  225.         FreeMem( Buf 127 )
  226.     }
  227.  
  228.     _DosBase != 0 {
  229.         CloseLibrary( _DosBase )
  230.     }
  231.  
  232.     END
  233.  
  234.