summaryrefslogtreecommitdiffstats
path: root/system/hex.c
diff options
context:
space:
mode:
authorneoraider <devnull@localhost>2005-04-18 17:18:02 +0200
committerneoraider <devnull@localhost>2005-04-18 17:18:02 +0200
commit2c7f83e006c3fee8d26e940eee801a4be9443e50 (patch)
treecb8273f74857305921b653aed0a0488b2d27c13a /system/hex.c
downloadwinx-master.tar
winx-master.zip
Verzeichnisstruktur ver?ndertHEADmaster
Diffstat (limited to 'system/hex.c')
-rw-r--r--system/hex.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/system/hex.c b/system/hex.c
new file mode 100644
index 0000000..4374063
--- /dev/null
+++ b/system/hex.c
@@ -0,0 +1,31 @@
+/* hex.c - hexdecimal print functions */
+
+#include <system.h>
+
+
+extern unsigned char console_std_attr;
+
+static char hex_values[16] = "0123456789ABCDEF";
+
+void print_hex_byte(unsigned char hex) {
+ print_char(hex_values[(hex >> 4) & 0x0F]);
+ print_char(hex_values[hex & 0x0F]);
+}
+
+void print_hex_word(unsigned short hex) {
+ print_char(hex_values[(hex >> 12) & 0x0F]);
+ print_char(hex_values[(hex >> 8) & 0x0F]);
+ print_char(hex_values[(hex >> 4) & 0x0F]);
+ print_char(hex_values[hex & 0x0F]);
+}
+
+void print_hex_long(unsigned long hex) {
+ print_char(hex_values[(hex >> 28) & 0x0F]);
+ print_char(hex_values[(hex >> 24) & 0x0F]);
+ print_char(hex_values[(hex >> 20) & 0x0F]);
+ print_char(hex_values[(hex >> 16) & 0x0F]);
+ print_char(hex_values[(hex >> 12) & 0x0F]);
+ print_char(hex_values[(hex >> 8) & 0x0F]);
+ print_char(hex_values[(hex >> 4) & 0x0F]);
+ print_char(hex_values[hex & 0x0F]);
+}