Today I have finally solved how to handle Pascals base one arrays in IDA Pro.
So if you have a fixed size array block, it will normally be packed after some other data.
![pascal memory layout pascal memory layout](/blog/static/799896d6/pascal-memory-layout@2x.png)
you can see the stru_1DA79 is an fixed size array from it’s use.
![pascal array copy pascal array copy](/blog/static/ac40e9bd/pascal-array-copy@2x.png)
But when the base-1 array is indexed into, the results are messy and confusing
![pascal array index ugly pascal array index ugly](/blog/static/3dc30b77/pascal-array-index-ugly@2x.png)
Yes it looks like the dword is being accessed not the actual array. For a long time I have worked around this with mega ugly repeat comments like:
_dword and [+2] = unk_1DA79[i-1].byte_0 and [+3] = unk_1DA79[i-1].byte_1_
Today I read enough help to finally workout how to do it correctly.
The first steps are to see above that the structure is 3 bytes wide, and create a structure for that (already done in the snaps above thus struct_6). Then in the incorrect usage shown above @ ovr032:0B51 select dword_1DA74 then Offset (User Defined)
![Offset (user-defined) Offset (user-defined)](/blog/static/b11bc4ea/pascal-fix-02@2x.png)
Then set the Target delta to -3 (-1 * the size of structure (3))
![pascal-fix-03 pascal-fix-03](/blog/static/ab78df7e/pascal-fix-03@2x.png)
and like magic it shows you correctly accessing the array
![pascal-array-fixed pascal-array-fixed](/blog/static/2f6ef95c/pascal-array-fixed@2x.png)
This ‘issue’ has only been the bane of my reverse engineering for like the last ten years.