mirror of
https://github.com/ksherlock/wdc-utils.git
synced 2024-12-12 04:29:05 +00:00
fixes.
This commit is contained in:
parent
2cd1ad1ce5
commit
9d937e9c37
@ -497,9 +497,10 @@ void disassembler::flush() {
|
||||
|
||||
void disassembler::check_labels() {
|
||||
|
||||
if ( _label_callback && _next_label >= 0 && _pc + _st >= _next_label) {
|
||||
flush();
|
||||
_next_label = _label_callback(_pc);
|
||||
if ( _next_label >= 0 && _pc + _st >= _next_label) {
|
||||
//flush();
|
||||
if (_st) dump();
|
||||
_next_label = next_label(_pc);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
#include <functional>
|
||||
|
||||
class disassembler {
|
||||
|
||||
@ -43,15 +42,8 @@ class disassembler {
|
||||
void flush();
|
||||
|
||||
|
||||
void set_label_callback(std::function<int32_t(int32_t)> callback) {
|
||||
_label_callback = callback;
|
||||
_next_label = -1;
|
||||
if (_label_callback) _next_label = _label_callback(-1);
|
||||
}
|
||||
|
||||
void recalc_next_label() {
|
||||
if (_label_callback) _next_label = _label_callback(-1);
|
||||
else _next_label = -1;
|
||||
_next_label = next_label(-1);
|
||||
}
|
||||
|
||||
static std::string to_x(uint32_t value, unsigned bytes, char prefix = 0);
|
||||
@ -98,8 +90,6 @@ class disassembler {
|
||||
int32_t _next_label = -1;
|
||||
|
||||
void check_labels();
|
||||
|
||||
std::function<int32_t(int32_t)> _label_callback;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -43,6 +43,14 @@ zrdz_disassembler::zrdz_disassembler(std::vector<section> &§ions, std::vecto
|
||||
e.symbols.emplace_back(s);
|
||||
}
|
||||
|
||||
// sort labels...
|
||||
for (auto &e : _sections) {
|
||||
if (e.symbols.empty()) continue;
|
||||
std::sort(e.symbols.begin(), e.symbols.end(), [](const symbol &a, const symbol &b) {
|
||||
return a.offset > b.offset;
|
||||
});
|
||||
}
|
||||
|
||||
if (_sections.size() < 5) _sections.resize(5);
|
||||
_sections[SECT_PAGE0].name = "page0";
|
||||
_sections[SECT_CODE].name = "code";
|
||||
|
Loading…
Reference in New Issue
Block a user