flat assembler
Message board for the users of flat assembler.

Index > Tutorials and Examples > Byte Count

Author
Thread Post new topic Reply to topic
greco558



Joined: 21 Jul 2016
Posts: 35
greco558 07 Jul 2017, 12:46
Just another program I wrote to help me understand how to program in Linux
assembly.

Any feedback is welcome I am still learning how to do assembly.

This program counts the number of times bytes 00-FF show up in a file, text or binary.

It uses sys_brk to allocate memory then the program reads file data to allocated memory.

We scan the bytes in allocated memory and count the number of times bytes 00-FF are in file then display info to screen.

Make terminal full screen because i use columns to display info.
usage on Linux command line: ./bytect -f filename

See post below to get most recent version....

Best Regards
John


Last edited by greco558 on 17 Jul 2017, 19:47; edited 3 times in total
Post 07 Jul 2017, 12:46
View user's profile Send private message Reply with quote
greco558



Joined: 21 Jul 2016
Posts: 35
greco558 12 Jul 2017, 22:45
Updated bytect program to process command line arguments.
-c set minimum decimal count of bytes to display
-l set lower Hex limit of byte 00-ff to display
-u set upper hex limit of byte 00-ff to display
-f followed by filename REQUIRED
-h help
-v version/info

You can use above switches to narrow displayed results.

Changed Header printed above display dump from a static message to
one that will change with parameters entered on command line.

Updated 07/17/2017: changed the way command line is processed so you can enter
switch and parameter with or without a space ex. -c20 or -c 20
Updated header in to show lower and upper range in HEX and
Count in decimal

Best Regards
John
Post 12 Jul 2017, 22:45
View user's profile Send private message Reply with quote
greco558



Joined: 21 Jul 2016
Posts: 35
greco558 09 Mar 2018, 19:15
Found a bug in bytect program after writing the same program in LUA.

If count of lets say hex byte 20 in file was greater than 256 the count would be off
because I was storing the count in a byte size mem location.

Fix was changing from byte size count storage to dword size and adding some
indexing to account for dword size count eg. EBX*4.

Attached is Bug Fixed version

Best regards
John


Description:
Download
Filename: 2018-03-09-bytect.tar.gz
Filesize: 7.5 KB
Downloaded: 842 Time(s)

Post 09 Mar 2018, 19:15
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


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.