I use a tool called bgrep (binary grep) to search for occurrences of hex patterns,
find attached the executable and source of bgrep.
This tool is quite handy when searching for matching code fragments in different images.
Here is how you can find the location of TDMLSDS if you have the disassembled code
and some basic knowledge about the C167 opcodes available:
1. Search for references to TDMLSDS in the assembler code of an image
with known symbol addresses (here F-Box is shown):
...
87'FDA6: 8A2D06B0 JB [B_kuppl], L_87FDB6 (87'FDB6)
87'FDAA: 9A540460 JNB [00FDA8h].6, L_87FDB6 (87'FDB6)
87'FDAE: F3F81513 MOVB RL4, [TDMLSDS]
87'FDB2: F7F80DA8 MOVB [38280Dh], RL4
...
2. Select a hex search pattern matching this code sequence,
verify that this search pattern is found only once:
bash-3.2$ bgrep "8A2DxxB09AxxxxxxF3F8xxxxF7F8xxxxF3F8xxxx" fbox.bin
fbox.bin: 0007FDA6 -> 8A2D06B09A540460F3F81513F7F80DA8F3F80DA8
-> found only once, see that address (0007FDA6) matches with assembler code (87'FDA6).
3. Have to know that the bit "B_kuppl" is at FD56.8 for M-Box (FD5A.11 for F-Box),
so the instruction "JB [B_kuppl], address"
has pattern "8A2Bxx80" in M-Box compared to "8A2DxxB0" in F-Box
(need to read the C167 documentation to know how opcodes are encoded
).
4. Search the corresponding pattern in the M-Box image:
bash-3.2$ bgrep "8A2Bxx809AxxxxxxF3F8xxxxF7F8xxxx" mbox.bin
mbox.bin: 0007544A -> 8A2B06809A510400F3F8AC13F7F83BA9
-> also found only once at address 87'544A
5. Check this address in the assembler code of M-box:
...
87'544A: 8A2B0680 JB [B_kuppl], L_87545A (87'545A)
87'544E: 9A510400 JNB [00FDA2h].0, L_87545A (87'545A)
87'5452: F3F8AC13 MOVB RL4, [8113ACh]
87'5456: F7F83BA9 MOVB [38293Bh], RL4
...
-> TDMLSDS is at offset 0x113AC in M-Box as stated by nyet and gremlin (has value 0x33).