View Single Post
Old 28th October 2008, 03:52   #285  |  Link
schluppo
Guest
 
Posts: n/a
Here's the complete structure of the 'conversion table' (this covers exactly all the data which is given by trap 0x20):

Code:
header
16 bit: [number of tables]

then [number of tables] tables, where a table is as follows:

table
32 bit: [table id]
16 bit: [number of segments]

then [number of segments] times:
32 bit: address of each segment
then [number of segments] segments, where a segment is as follows:

segment
32 bit: [number of entries]
then [number of entries] times: 32 bit indexing value
then [number of entries] times: 16 bytes table entry
In the two examples that we could look at so far, the conversion table consists of 0x24 / 0x42 tables, but all other tables apart from the one with [table id]=1 just contain varying numbers of empty segments (i.e. segments with [number of entries]=0).

So here is an example of how to get to "DAT" table 1, segment 3, entry 8. Be aware that all the mentioned addresses are relative to the starting address of the conversion table. Also notice that the counting of tables starts at 1 whereas counting of segments and entries starts at 0:

Code:
At 0x00000000, check: 1 <= [number of tables]? If not: Error!
Seek to table_offset for [table_id]=1. In this case, this offset is 0x00000006. For [table id]=2, the offset is 0x000FC930 etc.
At 0x00000006, check: 3 < [number of segments]? If not: Error!
Seek to segment_address for segment 3. In this case, this address lies at 0x00000006 + 2 + 3*4 = 0x00000014 and has value 0x00001FC8.
Seek to 0x00001FC8.
At 0x00001FC8, check: 8 < [number of entries]? If not: Error!
Seek to 0x00001FC8 + 4 + 8*4 = 0x00001FEC.
Get indexing value from 0x00001FEC (in this case, the indexing value is 0x001B0E1E).
Seek to 0x00001FC8 + 4 + [number of entries]*4 + 8*16 = 0x00001FC8 + 4 + 0xBA*4 + 8*16 = 0x00002334.
Get table entry from 0x00002334 (in this case, the table entry is 0xC04C9D38 0xD81F55CD 0x95D64326 0x196C2248).
Edit: Also, [number of segments] of table 1 will tell us, how often we have to invoke event 0x220 to get all the segment keys (DAT: 0x153 times, I Robot: 0x141 times).

Last edited by schluppo; 28th October 2008 at 04:01.
  Reply With Quote