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 using NASM
Assembler. Once I got a working Program in Nasm, I then wrote it in 
Flat Assembler. 

I have now converted the Linux Flat Assembler Program to Windows Masm32 Program
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.

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

To Build use makeit.bat file.

To use program double click executable editbyte.exe and a dialogbox will open
so you can select a file to edit or examine. After selecting a file the console
window will show file in Hex and Ascii with file name you selected at the top.

The top left of screen will show current sector number.

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 in Green 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, pageup=next 256byte sector or pagedown=previous 256byte sector of file.
g=goto you can jump to sector from 0 to last sector. If you have a big file and don't want
to press pagedown 2000 times to get to sector 2000 you just press g key to jump to sector.

When you get to end of file a message will popup in Red at the lower right corner of 
display showing you the Hex number of the last byte in file. 
If you navigate your Phantom cursor to last byte in file or beyond the Location in top
right of display will turn red indicating you are beyond or at EOF.

Pressing the r=replace key will allow you to edit the current byte where your 
Phantom cursor is located highlited in Yellow in 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".

The s=srch key will search each file sector for  HEX byte word or double word you enter.
example of WORD to search for would be '0d0a', DWORD '7c6f4580'. The search will
stop at first sector it finds your BYTE/WORD/DWORD and highlite it in Blue.
You can continue search by pressing f=foward search or b=search back. 
If no match is found, search mode exits back to main or once you find your WORD/DWORD
you press x=exit to go back to main.
  
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 fileyet. 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 Green 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 Green 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 Green 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 Blue.

The c=clear key will clear all highlites from previous m=mark 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


 
