Editbyte was a project I start in BaCon Basic to C Converter under Linux.
I wanted to see if I could write the same program in Nasm assembly to help 
me learn Assembly language programming. It start out as a simple Hex/Ascii
Dump command line program and progressed to an editor in Linux programed in
NASM Assembler. Once I got a working Program in Nasm, I then wrote it in 
Flat Assembler. 

I have now written the Program in Masm32 Assembler for Windows using Masm32 
Quick Editor 4.0. Display is not as colorful as Linux Version but it is 
just as functional.I have learned alot from working on this program, hopefully 
posting it here will help someone else with learning Assembly Language.

If you are interested in Linux Assembly Versions you can find them on the Flat
Assembler and Nasm forums, posted under username greco558.
If you are interested in Masm32 Assembler Version for Windows see the Masm32
Forum also under greco558 for how to use windows version see windows ReadMe.txt

This is still a work in progress and any changes I make to program will be posted
on forums. Feel free to change the code in anyway to fit your needs.

To Assemble Fasm version at commandline type "fasm editbin.asm edbyte"
To Assemble Nasm version at commandline type "make"

To use program open a terminal full screen and at prompt type 
"edbyte -x filename"   for Fasm Version
"editbin -x filename" for Nasm Version
"edbin -h" for Help or -v for version
"editbin -h" for Help or -v for version

The Hex number in the top left of display in Green is current byte location of Phantom Cursor.
The Hex numbers down the left side of display are the starting byte of each row
and across top of display is Hex number of row.
You will also see in Bottom right of display the Binary number of byte Phantom Cursor
is currently on. As you move around the 256byte sector display,the Location number
in top left will change to show byte number you are on and Binary number will change
to show the Binary of Hex byte you are on.

The bottom of the display shows you a menu of what keyboard keys do.

Once you have a file open and displayed in the console you can move around by
pressing Arrow keys, n=next 256byte sector or p=previous 256byte sector of file.
Key g=goto will jump to sector number, so if you have a big file and you want to
goto sector 2000 you do not have to press n key 2000 times, use g key for jump
to sector of choice.

When you get to end of file a message will popup in the lower right corner of 
display showing you the Hex number of the last byte in file.
If you move Phantom Cursor to EOF byte or beyond Current byte location displayed
in upper left of display will turn Red.

Pressing the r=replace key will allow you to edit the current byte where your 
Phantom cursor is located highlited in Yellow on Hex/Ascii display.
A prompt will popup at bottom of screen asking for a Hex byte or Ascii character to
replace existing one. Hex bytes run from 01-FF program will accept upper or lowercase
for Hex letters A-F. You can also enter any Ascii character letter, number, symbol at
this prompt. The program will assume you are entering an Ascii Character if you type 
a single Character such as a, 1 or D. If you are entering a hex value it must be 2 
characters entered, so the letter "a" would mean lowercase "a" and "0a" would mean 
Hex byte "0a" or "0A".

If you press Shift-r=Ascii string key a prompt will popup asking for an Ascii string 
which will replace as many characters as you type at prompt starting at location of 
Phantom Cursor.
You can include any Ascii character number, letter, symbol or space in string.

After entering your replacement Byte or String and pressing enter the Bytes replaced 
in display will turn red meaning that you changed these bytes, but they have not been 
written to file. If you change sectors using the n=next p=prvious key before saving 
changes with w=write key, your changes will be lost and not written to file. 
You can undo changes in Red by navigating your Phantom cursor to that Byte and 
pressing u key for undo. 

To write your changes to file press w=write key which will make changes to file
and turn the written bytes to White to show your changes have been written to file.
You can still undo the changes you just wrote to file as long as you do not press
n=next or p=prvious. Just navigate Phantom cursor to White byte and press u=undo
key. The byte will turn Red again showing you have not saved changes to file,
to save the undo changes to file press w=write and bytes will show White again.

Any changes you make in a sector that are still showing in Red will not be saved
if you change sectors by pressing n=next of p=previous keys.

The m=mark key will popup a prompt for Hex byte to highlite in sector.
For example if you want to see all 0D hex bytes type 0d or 0D at prompt hit 
enter and all hex bytes in sector that are 0D will be highlited in Yellow.
I updated mark feature to highlite byte from sector to sector until you
press c to clear mark or enter a different hex byte to mark.

The s=search key will search the file for HEX BYTE, WORD or DWORD you enter,
example for HEX BYTE 0a, WORD 0d0a or DWORD 7f65804d.
If search finds match it will highlite bytes in yellow, you can then press
f=fwrd key to search foward or b=back to search back, if search reaches
beginning or EOF with no more matches it will automatically exit searchmode.
If you find bytes you are looking for you can exit searchmode x=exit.

The c=clear key will clear all highlites from previous m=mark or s=search action.

When done q=quit will close file and exit program.

Any feed back about program good or bad would be appreciated.

WARNING: NOT RESPONSIBLE FOR DAMAGE TO FILES BY CARELESS USE OF THIS PROGRAM!

Best Regards
John Endler 2016


 
