FreeCalypso > hg > fc-sim-tools
view libcommon/hexdump.c @ 9:c9ef9e91dd8e
new libcommon, initial version
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 14 Mar 2021 06:55:38 +0000 |
parents | |
children |
line wrap: on
line source
#include <sys/types.h> #include <stdio.h> #include "simresp.h" display_sim_resp_in_hex(outf) FILE *outf; { unsigned off, cc, n, c; for (off = 0; off < sim_resp_data_len; off += cc) { fprintf(outf, "%02X:", off); cc = 16; if (sim_resp_data_len - off < cc) cc = sim_resp_data_len - off; for (n = 0; n < 16; n++) { if (n == 0 || n == 8) putc(' ', outf); putc(' ', outf); if (n < cc) fprintf(outf, "%02X", sim_resp_data[off + n]); else { putc(' ', outf); putc(' ', outf); } } putc(' ', outf); putc(' ', outf); for (n = 0; n < cc; n++) { c = sim_resp_data[off + n]; if (c < 0x20 || c > 0x7E) c = '.'; putc(c, outf); } putc('\n', outf); } return(0); } cmd_sim_resp(argc, argv, outf) char **argv; FILE *outf; { return display_sim_resp_in_hex(outf); }