flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Examples and Tutorials > Byte Locate

Author
Thread Post new topic Reply to topic
greco558



Joined: 21 Jul 2016
Posts: 28
Byte Locate
I had an idea the other day, kind of a companion program to my Byte Count program posted here.

I don't know if the program is much use for anything, but it was something I thought
someone might be interested in so I am posting it here.

Program will give you the byte locations in file that hex byte entered on command line
appears in file.

To run from Linux Terminal: ./bytelc [-f filename] [-x HexByte]
./bytelc -f bytect -x e8

I wrote the command line procedure to work with or without space after switchs, so the
above command line can be written ./bytelc -fbytect -xe8

As always feed back good or bad is welcome.

Best Regards
John


Last edited by greco558 on 04 Dec 2017, 20:27; edited 1 time in total
Post 30 Nov 2017, 19:44
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 15312
Location: Bigweld Industries
I assume this is for Linux?

Maybe you could extend it to a byte sequence locator.
Post 30 Nov 2017, 23:28
View user's profile Send private message Visit poster's website Reply with quote
greco558



Joined: 21 Jul 2016
Posts: 28
Yes it is for Linux.
Good idea about sequence locater.
I will have to get to work on it.




Thanks
John
Post 30 Nov 2017, 23:57
View user's profile Send private message Reply with quote
greco558



Joined: 21 Jul 2016
Posts: 28
Cleaned up old version noticed some of the comments in source code were from bytect program.

Added the ability to search for BYTE, WORD or DWORD in file.

Still need to add more error checking.

using command line option switchs:
-b for byte search
-w fro word search
-d for double word search.

./bytelc -f filename -b e8
./bytelc -f filename -w e8ff
./bytelc -f filename -d e8ff3479

Best Regards
John


Description:
Download
Filename: 2017-12-04-bytelc.tar.gz
Filesize: 6.93 KB
Downloaded: 11 Time(s)

Post 04 Dec 2017, 20:34
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 15312
Location: Bigweld Industries
Good.

Can it search for arbitrary length strings?
Post 04 Dec 2017, 23:40
View user's profile Send private message Visit poster's website Reply with quote
greco558



Joined: 21 Jul 2016
Posts: 28
Hi Revolution,

I am working on that and will post update.
I figured I would post the version that can search for up to a double
Word length.
It will take me a few days to implement arbitrary lengths.
I don't get to program in assembly often and working on this will help
me to stay involved in Assembly language.

Best Regards
John
Post 04 Dec 2017, 23:57
View user's profile Send private message Reply with quote
greco558



Joined: 21 Jul 2016
Posts: 28
Ok here it is the revised version to replace bytelc.

I eliminated the -b byte, -w word, and -d dword options and replaced
with 1 switch option for byte sequence search -s.

This program bytesq will take arbitrary length hex bytes entered on command line.

You can have your byte sequence on command line first as in the 2nd example
shown below it does not matter.
Example: ./btyesq -f filename -s e83d789723eff856636d646c696e
./bytesq -s 45ffef586c -f filename
./bytesq -f filename -s e8

you can enter 1 hex byte or 15 hex bytes or more on command line after -s switch.
you are limited to 128 hex byte sequence but that is pretty long sequence of bytes to
search for.

Best Regards
John


Description:
Download
Filename: 2017-12-05-bytesq.tar.gz
Filesize: 6.08 KB
Downloaded: 11 Time(s)

Post 05 Dec 2017, 19:22
View user's profile Send private message Reply with quote
donn



Joined: 05 Mar 2010
Posts: 68
Cool, one use may be to compute the size of a sequence of instructions. I can't calculate them in my head yet. This might be possible by defining a searchable string before the instructions and a separate one after, then subtracting..? I've been subtracting them with labels then writing to a file, which requires some overhead.

I'm not using Linux at the moment, but found out that the new Win 10 update supports Linux installs such as Ubuntu and OpenSUSE. I tried running the executable but got


Code:
donn@PC:/mnt/c/Users/donn/Downloads/bytesq./bytesq
-bash./bytesqcannot execute binary fileExec format error



The Win 10 Linux doesn't include the Linux kernel I think, so this might not be possible. May just be a matter of porting or re-assembling, can take another look later.
Post 05 Dec 2017, 22:37
View user's profile Send private message Reply with quote
greco558



Joined: 21 Jul 2016
Posts: 28
Thanks donn,

I don't do a lot of programming in windows anymore, for a while if i wrote something in Linux i
would write the same program for Windows have not done that for a while now.

If I find some time maybe I will try to re-write this for Windows, its not a very big program to
have to translate to Windows platform.



Best Regards
John
Post 06 Dec 2017, 12:01
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >

Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.