still wip

This commit is contained in:
2025-12-22 23:02:29 +01:00
parent 627acef32c
commit a48ef9d5e0
60 changed files with 6993 additions and 4939 deletions

24
User/util/hexdump.c Normal file
View File

@@ -0,0 +1,24 @@
#include "stdio.h"
#include <ctype.h>
#include "hexdump.h"
void hexdump (const char *label, const uint8_t *data, size_t len) {
if (label)
printf ("%s (len=%u):\n", label, len);
for (size_t i = 0; i < len; i += 16) {
printf ("%04u ", i); // offset
for (size_t j = 0; j < 16; j++) {
if (i + j < len)
printf ("%02X ", data[i + j]);
else
printf (" "); // pad spacing
}
printf (" ");
for (size_t j = 0; j < 16 && i + j < len; j++) {
uint8_t c = data[i + j];
printf ("%c", isprint (c) ? c : '.');
}
printf ("\n");
}
}

9
User/util/hexdump.h Normal file
View File

@@ -0,0 +1,9 @@
#ifndef HEXDUMP_HEADER
#define HEXDUMP_HEADER
#include "stddef.h"
#include "stdint.h"
void hexdump (const char *label, const uint8_t *data, size_t len);
#endif