Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong block size when there is a jump in segment address #9

Open
sresam89 opened this issue Jan 18, 2024 · 1 comment
Open

Wrong block size when there is a jump in segment address #9

sresam89 opened this issue Jan 18, 2024 · 1 comment

Comments

@sresam89
Copy link

sresam89 commented Jan 18, 2024

We have a hex file that has data record with same baseSegment address
image

The file has address jumps between sectors but has same baseSegment address
image

Current class file has implementation for getting the segment info gives the correct number of segment address using getSegmentinfo(). "2" in our case, x00010000 and x00030000. The class also gives the block size for each segment address which are 47892 and 65536.

The class file while calculating the block size is assuming the start of the address is always "x0000", takes the last address in the sector (which is "x0001BB14") as its block-size (which is 47892 in our case). This calculation would be wrong as the start address is not zero always (like in our x3000xxxx sector and between our x1000xxxx sectors where it-jumps/start-with-non-zero address). These jumps should be taken into account.
image

If we do consider the jumps and non-zero-start-address, actual block-size should be 40992 (including the address jumps) for the first segment and 1024 for the second segment.

Each sector calculation is done as below
sectorStartAddresses: x00010000 totalSectordataLength: x2ec
sectorStartAddresses: x00011000 dataLength: x238
sectorStartAddresses: x00012000 dataLength: x378
sectorStartAddresses: x00012380 dataLength: x8544
sectorStartAddresses: x0001a8c8 dataLength: xfdc
sectorStartAddresses: x0001b8a8 dataLength: x1fc
sectorStartAddresses: x0001baa8 dataLength: x64
sectorStartAddresses: x0001bb10 dataLength: x4

Hoping to collaborate and make this code work for both cases.

@codinghead
Copy link
Owner

Hi and thanks for writing and sharing your use case. This is a little side project that I dip in and out of from time to time.

I need some more time to understand the issue you're having because I've not looked at the code for several months.

I think your needs require some extra functionality as the base segment address doesn't (according to my understanding) indicate anything other than an offset address for a register in an Intel architecture processor. Intel HEX file format is very simple with no meta-data. It simply records data at 16-bit addresses (which could be for any type of processor architecture), the contents of two possible Intel processor registers, and the start address of the code.

I'll take a look when I have a moment and post an update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants