diff options
author | neoraider <devnull@localhost> | 2005-04-18 17:18:02 +0200 |
---|---|---|
committer | neoraider <devnull@localhost> | 2005-04-18 17:18:02 +0200 |
commit | 2c7f83e006c3fee8d26e940eee801a4be9443e50 (patch) | |
tree | cb8273f74857305921b653aed0a0488b2d27c13a /system/hex.c | |
download | winx-master.tar winx-master.zip |
Diffstat (limited to 'system/hex.c')
-rw-r--r-- | system/hex.c | 31 |
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]); +} |