Advertisement
Mysoft

Untitled

Jun 6th, 2025
468
0
9 hours
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. '_sync( "BootSector" )
  2.  
  3. #macro ForEachOperation( _act )  
  4.   '    "[!]RecipeName" , "ToolFile"||@Func , Tool/Function Parameter , Output file(s)         , {Input file(s)...}
  5.   _act( "BootSector"  , "$nasm"            , "%i -l %ipn.lst -o %o"  , "build\boot\boot.sec"  , {"src\boot\bootsec.asm"} )
  6.   _act( "ImageFile"   , GenerateDiskImage  , ""                      , "MyCCOS.img"           , {"build\boot\boot.sec"} )
  7.   _act( "System"      , "$fbc"             , "%i -x %opn.exe"        , "build\sys\*.bin"      , {"src\sys\*.bas"} )  
  8. #endmacro
  9.  
  10. function GenerateDiskImage( sBootSecFile as string , sOutputImgFile as string , sUnused as string = ""  ) as long
  11.   #define _FATAL(_msg) print _msg : return 0
  12.   var f = freefile , iResu = 0
  13.   iResu = open( exepath+"\"+sBootSecFile for binary access read as #f)
  14.  if iResu then _FATAL("failed to OPEN '"+sBootSecFile+"' for read")  
  15.   dim as ulongint iSz = lof(f)
  16.   if iSz < 512 orelse iSz > 65536 then _FATAL("boot sector file, must be between 512 bytes and 64kb")  
  17.   dim as ubyte bBoot(iSz-1) = any
  18.   iResu = get(#f,,bBoot()) : close #f  
  19.   if iResu then _FATAL("failed to READ '"+sBootSecFile+"'")  
  20.   iResu = open( exepath+"\"+sOutputImgFile for binary access write as #f)
  21.  if iResu then _FATAL("failed to OPEN '"+sOutputImgFile+"' for write")
  22.   iResu = (put(#f,,bBoot()) orelse put(#f,1+1440*1024-sizeof(iResu),iResu)) : close #f  
  23.   if iResu then _FATAL("failed to WRITE '"+sOutputImgFile+"'")  
  24.   return 1
  25. end function
  26.  
  27. #macro _Execute( _sRecipe , _StrOrPtrTool , _vParameters , _sOutput , _sInput... )
  28.   '#print _sRecipe
  29.   __FB_UNIQUEID_PUSH__( InputArr )
  30.   #define _ArrName __FB_JOIN__( sList , __FB_UNIQUEID__( InputArr ) )    
  31.   dim as string _ArrName (...) = _sInput
  32.   #if typeof( @_StrOrPtrTool ) = typeof( zstring ptr )    
  33.     AddThreadsExecuteCommand( _sRecipe , _StrOrPtrTool , _vParameters , _sOutput , _ArrName () )    
  34.   #else
  35.     AddThreadsCallFunction( _sRecipe , @_StrOrPtrTool , _vParameters , _sOutput , _ArrName () )
  36.   #endif
  37.   #undef _ArrName
  38.   __FB_UNIQUEID_POP__( InputArr )
  39. #endmacro
  40.  
  41. type CallProto as function( sInput as string , sOutput as string , sParms as string ) as long
  42.  
  43. sub AddThreadsExecuteCommand( sRecipe as string , sExec as string , sParms as string , sOutFile as string , sInFiles() as string )
  44.   print sRecipe , sExec , sParms
  45. end sub
  46. sub AddThreadsCallFunction( sRecipe as string , pfFunc as CallProto , sParms as string , sOutFile as string , sInFiles() as string )
  47.   print sRecipe , sParms
  48. end sub
  49.  
  50. ForEachOperation( _Execute )
  51. sleep
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement