A small update with 2 new commands, insert and remove, having been added to hexed. Insert first moves any data at the end of the file then inserts the bytes from a buffer and removes deletes bytes from the buffer.
The Command List
Inserts bytes in the file at the destination, repeating the bytes for a number of times.
-i 100 10 01 02 03
This will insert the bytes 0x01 0x02 0x03 at 0x100 16 times.
Removes a number of bytes from the file starting at the source.
-r 10 100
Removes 0x100 bytes from the file at 0x10 to 0x110.
Command control has been added to hexed and the first 3 commands are help, dump and enter. Command control is handled by a Command struct and a Cmdoptions struct. Each command is set with an ID, flags and any options in the Cmdoptions area. Cmdoptions is general purpose and shares common names for values between all the commands. Any extra data is stored in a buffer before being copied to the file. Multiple commands can be set on the command line and these are performed in the order they are found.
hexed -d 0 100 -e 40 10 20 30 40 -d 0 100 test.hex
This will display the file test.hex, enter 4 values at 0x40, display the file again then save the file and quit.
The Command List
Help simply displays the command list and how to use each command:
hexed - Hexadecimal File Editor
hexed [options] [file]
-? Shows this help screen
-d [src] [len] Display hex values from [src] for [len] bytes
-e [dest] [...] Enter hex values [...] at [dest]
The dump command displays a range of values and their ascii symbols:
-d 0 100
Displays values starting from 0x0 for 0x100 (256) bytes, all options to commands are set in hex values.
Enter adds new values to a file, overwriting any values that were already at the address:
-e 100 10 20 30 40
Enters the values 0x10, 0x20, 0x30 and 0x40 starting at 0x100. If a file name is set then the values will be automatically saved to the file.