summaryrefslogtreecommitdiff
path: root/src/user/dumphex
diff options
context:
space:
mode:
authorBenji Dial <benji6283@gmail.com>2021-01-24 12:00:11 -0500
committerBenji Dial <benji6283@gmail.com>2021-01-24 12:00:11 -0500
commitbce944d1498eaa3b6940ee234c863b3548a66b37 (patch)
treeea40c087ab4f0f236aee8d158cf68550f5209f72 /src/user/dumphex
parentca731aa747214919df7b3dfe3478dbe787ce5b68 (diff)
downloadportland-os-bce944d1498eaa3b6940ee234c863b3548a66b37.tar.gz
graphics!
Diffstat (limited to 'src/user/dumphex')
-rw-r--r--src/user/dumphex/dumphex.c81
1 files changed, 0 insertions, 81 deletions
diff --git a/src/user/dumphex/dumphex.c b/src/user/dumphex/dumphex.c
deleted file mode 100644
index 2944a2f..0000000
--- a/src/user/dumphex/dumphex.c
+++ /dev/null
@@ -1,81 +0,0 @@
-#include <knob/file.h>
-#include <knob/user.h>
-#include <knob/format.h>
-
-#define LINE_LEN 16
-
-void print_zero_line(uint32_t offset) {
-}
-
-void main(const char *path) {
- struct file *f = open_file(path);
- if (!f) {
- tell_user_sz("Couldn't open file.\n");
- return;
- }
-
- uint8_t line[LINE_LEN + 2];
- uint8_t len;
- uint32_t offset = -LINE_LEN;
-
- enum {
- ZR_NO,
- ZR_FIRST,
- ZR_REST
- } zero_run;
-
- char nbuf[9];
-
- while ((len = read_from_file(f, LINE_LEN, line))) {
- offset += LINE_LEN;
-
- for (uint8_t i = 0; i < LINE_LEN; ++i)
- if (line[i]) {
- zero_run = ZR_NO;
- goto print_normal;
- }
-
- switch (zero_run) {
- case ZR_NO:
- zero_run = ZR_FIRST;
- _log_string("0x");
- itosz_h32(offset, nbuf);
- _log_string(nbuf);
- _log_string(" | 00 00 00 00 00 00 00 00 "
- "00 00 00 00 00 00 00 00 |\n");
- continue;
- case ZR_FIRST:
- zero_run = ZR_REST;
- tell_user_sz("...\n");
- case ZR_REST:
- continue;
- }
-
- print_normal:
- _log_string("0x");
- itosz_h32(offset, nbuf);
- _log_string(nbuf);
- _log_string(" |");
-
- nbuf[0] = ' ';
- for (uint8_t i = 0; i < len; ++i) {
- itosz_h8(line[i], nbuf + 1);
- _log_string(nbuf);
- }
-
- for (uint8_t i = len; i < LINE_LEN; ++i)
- _log_string(" ");
-
- _log_string(" | ");
-
- for (uint8_t i = 0; i < len; ++i)
- if ((line[i] < 0x20) || (line[i] > 0x7e))
- line[i] = ' ';
- line[len] = '\n';
- line[len + 1] = '\0';
-
- _log_string(line);
- }
-
- close_file(f);
-} \ No newline at end of file