]> mj.ucw.cz Git - misc.git/blob - false-true/mktrue2
Initial commit.
[misc.git] / false-true / mktrue2
1 #!/usr/bin/perl
2
3 while (<DATA>) {
4         s/#.*$//; s/\b(\w{4})(\w{4})\b/$2 $1/g; s/\b(\w\w)(\w\w)\b/$2 $1/g;
5         foreach $a (split /\s+/) { print pack("c",hex $a); }
6 }
7
8 __END__
9
10 7f 45 4c 46                     # Identification
11 01                              # We're 32-bit
12 01                              # Little endian
13 01                              # Header version
14 00 00000000 00000000            # Padding
15 0002                            # Type: Executable File
16 0003                            # Machine: i386
17 00000001                        # Version: Current :)
18 100000A4                        # Entry point
19 00000084                        # PH offset
20 00000034                        # SH offset
21 00000000                        # Machine-specific flags
22 0034                            # EH size
23 0020                            # Size of single PH entry
24 0001                            # Number of PH entries
25 0028                            # Size of single SH entry
26 0002                            # Number of SH entries
27 0000                            # String table offset
28
29 # Offset 34: Section Header for section 0
30
31 00000000                        # Name (ST offset)
32 00000000                        # Type: Void
33 00000000                        # Flags
34 00000000                        # Address
35 00000000                        # Offset
36 00000000                        # Size
37 00000000                        # Link
38 00000000                        # Info
39 00000000                        # Align
40 00000000                        # Size of single entry
41
42 # Offset 5C: Section Header for section 1
43
44 00000000                        # Name (ST offset)
45 00000001                        # Type: Program bits
46 00000007                        # Flags: writeable, allocate, executable
47 100000A4                        # Address
48 000000A4                        # Offset
49 00000009                        # Size
50 00000000                        # Link
51 00000000                        # Info
52 00000000                        # Align
53 00000000                        # Size of single entry: No entries
54
55 # Offset 84: Program Header
56
57 00000001                        # Type: Loadable
58 000000A4                        # Offset of section start
59 100000A4                        # Virtual address
60 100000A4                        # Physical address: ignored
61 00000009                        # File image size
62 00000009                        # Memory image size
63 00000007                        # Flags: rwx
64 00001000                        # Align to page size
65
66 # Offset A4: Our Program
67
68 b8 01 00 00 00
69 31 db
70 cd 80