#!/usr/bin/perl

while (<DATA>) {
	s/#.*$//; s/\b(\w{4})(\w{4})\b/$2 $1/g; s/\b(\w\w)(\w\w)\b/$2 $1/g;
	foreach $a (split /\s+/) { print pack("c",hex $a); }
}

__END__

7f 45 4c 46			# Identification
01				# We're 32-bit
01				# Little endian
01				# Header version
00 00000000 00000000		# Padding
0002				# Type: Executable File
0003				# Machine: i386
00000001			# Version: Current :)
100000A4			# Entry point
00000084			# PH offset
00000034			# SH offset
00000000			# Machine-specific flags
0034				# EH size
0020				# Size of single PH entry
0001				# Number of PH entries
0028				# Size of single SH entry
0002				# Number of SH entries
0000				# String table offset

# Offset 34: Section Header for section 0

00000000			# Name (ST offset)
00000000			# Type: Void
00000000			# Flags
00000000			# Address
00000000			# Offset
00000000			# Size
00000000			# Link
00000000			# Info
00000000			# Align
00000000			# Size of single entry

# Offset 5C: Section Header for section 1

00000000			# Name (ST offset)
00000001			# Type: Program bits
00000007			# Flags: writeable, allocate, executable
100000A4			# Address
000000A4			# Offset
00000009			# Size
00000000			# Link
00000000			# Info
00000000			# Align
00000000			# Size of single entry: No entries

# Offset 84: Program Header

00000001			# Type: Loadable
000000A4			# Offset of section start
100000A4			# Virtual address
100000A4			# Physical address: ignored
00000009			# File image size
00000009			# Memory image size
00000007			# Flags: rwx
00001000			# Align to page size

# Offset A4: Our Program

b8 01 00 00 00
31 db
cd 80
