Message board for the users of flat assembler.
> Tutorials and Examples > Byte Count
Just another program I wrote to help me understand how to program in Linux
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....
Last edited by greco558 on 17 Jul 2017, 19:47; edited 3 times in total
|07 Jul 2017, 12:46||
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
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
|12 Jul 2017, 22:45||
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
|09 Mar 2018, 19:15||
< Last Thread | Next Thread >
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.