The BSP disassembler included in this project tries to follow the script's control and data flow: it examines operands to discover addresses of data items and branch targets, and avoids disassembling fragments of patch space which are unlikely to be executed as code (such as those following an unconditional branch/return instruction, that are not otherwise branch targets). This analysis is quite simplistic however, as it is limited to immediate operands; something as simple as a set #0, target / jump #0 will defeat it.
As a stop-gap measure, the disassembler allows providing 'hints' on the command line, which advise the disassembler about the type of data existing at a specified address. The idea is that the user examines the disassembly, discovers additional data, adds those as hints, and then re-runs the disassembler. By repeating these steps, a complete disassembly will be obtained. This process is quite tedious, however, and it would be desirable to ease or eliminate it.
There are two options: more elaborate analysis, or adding interactivity to the disassembler. The former risks adding significant complexity and computational burden to the disassembler; while BSP bytecode is not technically Turing-complete, solving its halting problem in full generality is still prohibitively expensive (due to large constant factors, if nothing else). The second option therefore seems inevitable.
The BSP disassembler included in this project tries to follow the script's control and data flow: it examines operands to discover addresses of data items and branch targets, and avoids disassembling fragments of patch space which are unlikely to be executed as code (such as those following an unconditional branch/return instruction, that are not otherwise branch targets). This analysis is quite simplistic however, as it is limited to immediate operands; something as simple as a
set #0, target/jump #0will defeat it.As a stop-gap measure, the disassembler allows providing 'hints' on the command line, which advise the disassembler about the type of data existing at a specified address. The idea is that the user examines the disassembly, discovers additional data, adds those as hints, and then re-runs the disassembler. By repeating these steps, a complete disassembly will be obtained. This process is quite tedious, however, and it would be desirable to ease or eliminate it.
There are two options: more elaborate analysis, or adding interactivity to the disassembler. The former risks adding significant complexity and computational burden to the disassembler; while BSP bytecode is not technically Turing-complete, solving its halting problem in full generality is still prohibitively expensive (due to large constant factors, if nothing else). The second option therefore seems inevitable.