OpenCores
URL https://opencores.org/ocsvn/k68/k68/trunk

Subversion Repositories k68

[/] [k68/] [trunk/] [sw/] [splitrom/] [splitrom.dpr] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 sybreon
/////////////////////////////////////////////////////////////////////
2
////                                                             ////
3
//// Copyright (C) 2003 to Shawn Tan Ser Ngiap.                  ////
4
////                       shawn.tan@aeste.net                   ////
5
////                                                             ////
6
//// This source file may be used and distributed without        ////
7
//// restriction provided that this copyright statement is not   ////
8
//// removed from the file and that any derivative work contains ////
9
//// the original copyright notice and the associated disclaimer.////
10
////                                                             ////
11
////     THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY     ////
12
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED   ////
13
//// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS   ////
14
//// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR      ////
15
//// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,         ////
16
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES    ////
17
//// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE   ////
18
//// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR        ////
19
//// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF  ////
20
//// LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT  ////
21
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT  ////
22
//// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE         ////
23
//// POSSIBILITY OF SUCH DAMAGE.                                 ////
24
////                                                             ////
25
/////////////////////////////////////////////////////////////////////
26
 
27
program splitrom;
28
 
29
{$APPTYPE CONSOLE}
30
 
31
uses
32
  SysUtils, Classes;
33
 
34
var
35
  fin,f0,f1,f2,f3:tfilestream;
36
  dat: cardinal;
37
  i,l:integer;
38
begin
39
  { TODO -oUser -cConsole Main : Insert code here }
40
  if paramcount <> 1 then begin
41
        writeln('Syntax: splitrom <binary ROM filename>');
42
        halt;
43
  end;
44
 
45
  if not fileexists(paramstr(1)) then begin
46
        writeln('File ',paramstr(1),' not found!');
47
        halt;
48
  end;
49
 
50
  fin := tfilestream.create(paramstr(1),fmopenread);
51
 
52
  f0 := tfilestream.create(changefileext(paramstr(1),'.0.bin'),fmcreate);
53
  f1 := tfilestream.create(changefileext(paramstr(1),'.1.bin'),fmcreate);
54
  f2 := tfilestream.create(changefileext(paramstr(1),'.2.bin'),fmcreate);
55
  f3 := tfilestream.create(changefileext(paramstr(1),'.3.bin'),fmcreate);
56
 
57
  try
58
        l := sizeof(dat);
59
        repeat
60
                dat := 0;
61
                i := fin.Read(dat,l);
62
 
63
                f0.Write(byte(dat),1);
64
                dat := dat shr 8;
65
                f1.Write(byte(dat),1);
66
                dat := dat shr 8;
67
                f2.Write(byte(dat),1);
68
                dat := dat shr 8;
69
                f3.Write(byte(dat),1);
70
 
71
        until i<l;
72
 
73
  finally
74
        fin.free;
75
        f0.free;
76
        f1.free;
77
        f2.free;
78
        f3.free;
79
  end;
80
end.
81
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.