You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
621 B
33 lines
621 B
#include <fmt/format.h>
|
|
#include <fstream>
|
|
#include <memory-map.hpp>
|
|
#include <hex.hpp>
|
|
#include <graphics.hpp>
|
|
|
|
std::ifstream::pos_type filesize(const char* filename)
|
|
{
|
|
std::ifstream in(filename, std::ifstream::ate | std::ifstream::binary);
|
|
return in.tellg();
|
|
}
|
|
|
|
inline auto map_file(const char* filename)
|
|
{
|
|
return hv::memory_map(filesize(filename), filename);
|
|
}
|
|
|
|
int main(int argc, char** argv)
|
|
{
|
|
if(!argv[1]) {
|
|
fmt::print("Usage: {} <file>\n", argv[0]);
|
|
return 1;
|
|
}
|
|
|
|
auto map = map_file(argv[1]);
|
|
auto memory = map.span();
|
|
|
|
hv::print_screen(memory, 0);
|
|
fmt::print("\n");
|
|
|
|
return 0;
|
|
}
|