فهرست منبع

+ allow specifying the names of the BASIC loader program and the machine code program on the tap

git-svn-id: branches/z80@44600 -
nickysn 5 سال پیش
والد
کامیت
a6eb389e61
1فایلهای تغییر یافته به همراه16 افزوده شده و 3 حذف شده
  1. 16 3
      utils/ihx2tzx/ihx2tzx.lpr

+ 16 - 3
utils/ihx2tzx/ihx2tzx.lpr

@@ -29,7 +29,7 @@ uses
   { you can add units after this };
 
 const
-  ShortOptions = 'h';
+  ShortOptions = 'hb:c:';
   LongOptions: array [0..0] of string = (
     'help'
   );
@@ -42,6 +42,8 @@ type
   private
     FInputFileName: string;
     FOutputFileName: string;
+    FBasicProgramName: string;
+    FBinaryProgramName: string;
     FInputImage: TIHXReader;
     FOutputFile: TStream;
     FTapeWriter: TTZXWriter;
@@ -76,6 +78,11 @@ begin
     Exit;
   end;
 
+  if HasOption('b', '') then
+    FBasicProgramName := GetOptionValue('b', '');
+  if HasOption('c', '') then
+    FBinaryProgramName := GetOptionValue('c', '');
+
   NonOptions := GetNonOptions(ShortOptions, LongOptions);
   if Length(NonOptions) = 0 then
   begin
@@ -104,8 +111,8 @@ begin
   BasicProgram := BAS_EncodeLine(10, ' '+BC_LOAD+'"" '+BC_CODE) +
                   BAS_EncodeLine(20, ' '+BC_PRINT+BC_USR+BAS_EncodeNumber(FInputImage.Origin));
 
-  FTapeWriter.AppendProgramFile('basic', 10, Length(BasicProgram), BasicProgram[1], Length(BasicProgram));
-  FTapeWriter.AppendCodeFile('test', FInputImage.Origin, FInputImage.Data[0], Length(FInputImage.Data));
+  FTapeWriter.AppendProgramFile(FBasicProgramName, 10, Length(BasicProgram), BasicProgram[1], Length(BasicProgram));
+  FTapeWriter.AppendCodeFile(FBinaryProgramName, FInputImage.Origin, FInputImage.Data[0], Length(FInputImage.Data));
 
   // stop program loop
   Terminate;
@@ -116,6 +123,8 @@ begin
   inherited Create(TheOwner);
   StopOnException:=True;
   FInputImage := TIHXReader.Create;
+  FBasicProgramName := 'basic';
+  FBinaryProgramName := 'test';
 end;
 
 destructor TIHX2TZX.Destroy;
@@ -130,6 +139,10 @@ procedure TIHX2TZX.WriteHelp;
 begin
   { add your help code here }
   writeln('Usage: ', ExeName, ' [options] ihx_file [tzx_file]');
+  Writeln('Options: -b <name>   specify the name of the BASIC loader program on the tape');
+  Writeln('         -c <name>   specify the name of the machine code program on the tape');
+  Writeln('         -h          display this help');
+  Writeln('         --help      display this help');
 end;
 
 var