News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

EditByte Program

Started by greco558, August 15, 2016, 03:40:36 AM

Previous topic - Next topic

greco558

Hi All,

I have been working on learning Assembly Language, so to help me along the way I took
one of my programs I wrote in BaCon Basic To C and re-wrote it in assembly language under
Linux first in Nasm then Flat Assembler and Now in Masm32 for Windows.

I have learned a lot along the way so I am posting the program here with Readme file on
how to use program.

The program is a console program that shows your file in Hex and Ascii and allows you to edit
bytes in the file. It uses an open file dialogbox for you to select file and dumps file for editing into
the console window.
Hope someone can find it helpful in learning Assembly language.

Feed back good or bad is welcome.

Let me know if you find a bug I think I have them all worked.

Best Regards
John

jj2007

Well done, and a hex editor is always useful, John :t

> h=left, l=right, j=down, k=up
Ever noticed the cursor keys on your keyboard?  ;)

greco558

You are right hjkl for cursor movement is not very intuitive . I will have to post an update with arrow keys for movement. I did make 2 versions in Linux one uses arrow keys the other using VIM editor movement hjkl.

Thanks jj2007

greco558

Here is update to editbyte program from feed back by jj2007.

I changed movement within sector from hjkl keys to Arrow keys on keyboard.

Best Regards
John

jj2007


greco558

#5
Was going thru code and adding more comments, found a potential Bug and fixed.
Also removed some unnecessary lines of code from program.

Here is Updated Version 0.0.5

Changed s replace string key to shift-r to match the Linux version.
so r=replace byte and shift-r=replace ASCII string.

I also moved the Binary number displayed from top right to bottom right to match Linux Version.

Added Macro for colors to cleanup code and Resource file to add icon.

Best Regards
John

greco558

#6
 Changed DwordToHex procedure to receive address in edi of where to store converted number received in EAX. That why it makes procedure a little more flexible and can be used for more then one task.

I also changed color of Location in top left Corner to green so it is easier to see what byte number
you are currently located on, also when you navigate Phantom cursor to last byte of file or beyond
Location will turn Red indicating you have moved beyond EOF.

Working on adding undo of changes to sectors even after you have written changes to file and
closed program.

Version 0.0.7

Quick change due to a request to make n=next & p=prev keys pageup and pagedown keys.
Now we us Arrows to move around sectors and pageup pagedn to move between sectors.

Version 0.0.8

Best Regards
John

greco558

#7
Latest update changed DwordToHex procedure to print nothing just do conversion so I can use in
other programs. Program was getting long to work on, so I broke it up into separate files.

Added g key for goto sector. When you press the g key you will be prompted for a sector to jump to
ranging from 0 to last sector of file.
That way if you have a file with 2000 256byte sectors you can jump directly to one of those sectors
without having to hit pagedown 2000 times to get to EOF.

Version: 0.1.0

Was using masm32 lib procedure ustr2dw, but I made my own routine called just as a learning exercise I
named it StrToDword proc It can be found in conversions.asm file of program.


Best Regards
John

greco558

#8
Hi All,

Added search mode feature to look for a WORD or DWORD entered.
Example of WORD '0d0a', DWORD '7f458020'.

Search will start from your current sector forward when match is found search will stop
and highlite match WORD/DWORD in BLUE. You can then press key 'f' to search foward again
or 'b' key to search back in file. 'x' key will exit search mode or if no match found it will automatically
exit search mode.

I have been working on a GUI version editbyte32.exe not where I want it yet but it is functional
I will attach GUI version FYI it was written using EasyCode IDE.

Updated Search procedure to include search for Byte in both Console and GUI versions.

Best Regards
John

greco558

This is a bug fix for Console based program. editbyte.exe

Program crashed in Windows 10 due to DumpBytes Procedure
in display.asm file where I start displaying Ascii Characters, Invoke WriteToConsole 4 parm was
incorrect. Did not cause a crash in early versions of Windows but Windows 10 did not Like it.


Best Regards
John

mabdelouahab


GuruSR

Quote from: greco558 on August 29, 2016, 11:58:42 PM
I have been working on a GUI version editbyte32.exe not where I want it yet but it is functional
I will attach GUI version FYI it was written using EasyCode IDE.

I've yet to actually make a GUI with EasyCode IDE (using the old version 1 I think), looks like the latest version isn't much different, any headaches with doing a GUI with it?  I was thinking of it, but then I gave up and used VB6 for a quick GUI and then called the asm in a library.  (I cheated, but it was easier, since I "grew up coding in raw memory and later assemblers from text files", but have yet to venture into macros or GUIs.  Besides, most of the GUIs I've designed...  look like a programmer made them...  just like my documentation...

Best quote in a manual I've ever seen (friend's tablet)  "The fuselage can exhibit the phenomena of fever".  Man that made me laugh (basically means the tablet can get hot, :greenclp: ).

GuruSR.
Learned 68k Motorola Asm instruction set in 30 minutes on the way to an Amiga Developer's Forum meeting.
Following week wrote a kernel level memory pool manager in 68k assembler for fun.

greco558

GuruSR,

I find easycode a quick & easy way to make GUI interface. By using easy code your final executable is a little bigger than if you had hand coded the GUI interface, but for speed of buildiing the GUI, I find it worth the extra kilo bytes.
It all comes down to what you are comfortable using to build GUI.

When making GUI programs in Linux I use BaCon basic to C converter.


Best Regards
John

GuruSR

Quote from: greco558 on October 06, 2016, 10:09:48 PM
GuruSR,

I find easycode a quick & easy way to make GUI interface. By using easy code your final executable is a little bigger than if you had hand coded the GUI interface, but for speed of buildiing the GUI, I find it worth the extra kilo bytes.
It all comes down to what you are comfortable using to build GUI.

When making GUI programs in Linux I use BaCon basic to C converter.

Well, I can write code easily, but when it comes to GUIs, most of the time they're ugly train wrecks.  And don't even attempt to read my readmes or help files, cryptic is a mild way of saying "HUH"?  I usually get a friend who isn't a programmer, to proof read them, so they make sense and then get feedback on the program usage and design, though I still am horrible at it.  I'll have to try the GUI on it when I'm actually not writing libraries.  :bgrin:

GuruSR.
Learned 68k Motorola Asm instruction set in 30 minutes on the way to an Amiga Developer's Forum meeting.
Following week wrote a kernel level memory pool manager in 68k assembler for fun.