summaryrefslogtreecommitdiff
path: root/Source/Kernel/VTManager
diff options
context:
space:
mode:
authorAlexis211 <alexis211@gmail.com>2009-08-31 21:44:26 +0200
committerAlexis211 <alexis211@gmail.com>2009-08-31 21:44:26 +0200
commitdf76b24fed5ac3b5af406aad3df277d7f4c347e5 (patch)
treeea8a0ca4856cce9da63c047eff6e72a58c643159 /Source/Kernel/VTManager
parent6bf215215e1ebaa9613b51500031e6963c12d33b (diff)
downloadMelon-df76b24fed5ac3b5af406aad3df277d7f4c347e5.tar.gz
Melon-df76b24fed5ac3b5af406aad3df277d7f4c347e5.zip
Now we can read frop floppy drives !!! Next : FAT driver.
Diffstat (limited to 'Source/Kernel/VTManager')
-rw-r--r--Source/Kernel/VTManager/VirtualTerminal.class.cpp28
-rw-r--r--Source/Kernel/VTManager/VirtualTerminal.class.h2
2 files changed, 30 insertions, 0 deletions
diff --git a/Source/Kernel/VTManager/VirtualTerminal.class.cpp b/Source/Kernel/VTManager/VirtualTerminal.class.cpp
index 7864afd..4c0df95 100644
--- a/Source/Kernel/VTManager/VirtualTerminal.class.cpp
+++ b/Source/Kernel/VTManager/VirtualTerminal.class.cpp
@@ -158,6 +158,7 @@ void VirtualTerminal::writeDec(s32int i, bool updatecsr) {
}
void VirtualTerminal::writeHex(u32int i, bool updatecsr) {
+ if (m_cols < 60) return;
write("0x", false);
char hexdigits[] = "0123456789ABCDEF";
for (u32int j = 0; j < 8; j++) {
@@ -166,3 +167,30 @@ void VirtualTerminal::writeHex(u32int i, bool updatecsr) {
}
if (updatecsr) updateCursor();
}
+
+void VirtualTerminal::hexDump(u8int *ptr, u32int sz) {
+ if (m_cols < 76) return; //Not enough space
+ write("HEX Dump, from "); writeHex((u32int)ptr); write("\n");
+ char hexdigits[] = "0123456789ABCDEF";
+ for (u32int i = 0; i < sz; i += 16) {
+ writeHex(i);
+ write(" ");
+ for (u32int j = 0; j < 16; j++) {
+ u8int b = ptr[i + j];
+ if (j > 7) put(" ");
+ put(hexdigits[b >> 4]);
+ put(hexdigits[b & 0xF]);
+ if (j < 8) put(" ");
+ }
+ write(" ");
+ for (u32int j = 0; j < 16; j++) {
+ u8int b = ptr[i + j];
+ if (b >= 0x20 && b < 128) {
+ put(wchar(b));
+ } else {
+ put(".");
+ }
+ }
+ if (m_cols > 76) write("\n");
+ }
+}
diff --git a/Source/Kernel/VTManager/VirtualTerminal.class.h b/Source/Kernel/VTManager/VirtualTerminal.class.h
index 6a14080..4e5fe86 100644
--- a/Source/Kernel/VTManager/VirtualTerminal.class.h
+++ b/Source/Kernel/VTManager/VirtualTerminal.class.h
@@ -49,6 +49,8 @@ class VirtualTerminal {
void write(String s, bool updatecsr = true);
void writeDec(s32int i, bool updatecsr = true);
void writeHex(u32int i, bool updatecsr = true);
+
+ void hexDump(u8int* ptr, u32int sz);
inline VirtualTerminal& operator<<(String s) { write(s); return *this; }
//inline VirtualTerminal& operator<<(wchar c) { put(c); return *this; }