fixes, ifdefs for different byterun versions

This commit is contained in:
ProgramSnail 2024-12-15 03:33:46 +03:00
parent 5a6dbe3692
commit 2589f6166f
11 changed files with 244 additions and 58 deletions

View file

@ -1,5 +1,6 @@
#include <cassert>
#include <errno.h>
#include <iomanip>
#include <iostream>
#include <malloc.h>
#include <string.h>
@ -574,3 +575,18 @@ std::pair<Cmd, uint8_t> parse_command(char **ip, const Bytefile &bf,
std::ostream &out) {
return parse_command_impl<true>(ip, bf, out);
}
void print_file(const Bytefile &bf, std::ostream &out) {
char *ip = bf.code_ptr;
while (true) {
out << std::setfill('0') << std::setw(8) << std::hex << ip - bf.code_ptr
<< ": ";
const auto [cmd, l] = parse_command(&ip, bf, out);
out << '\n';
if (cmd == Cmd::EXIT) {
break;
}
}
}