summaryrefslogtreecommitdiffstats
path: root/Support_Libs/debug/debug.hcc
diff options
context:
space:
mode:
Diffstat (limited to 'Support_Libs/debug/debug.hcc')
-rw-r--r--Support_Libs/debug/debug.hcc57
1 files changed, 41 insertions, 16 deletions
diff --git a/Support_Libs/debug/debug.hcc b/Support_Libs/debug/debug.hcc
index 303adde..618ca46 100644
--- a/Support_Libs/debug/debug.hcc
+++ b/Support_Libs/debug/debug.hcc
@@ -4,35 +4,60 @@
#include "debug.hch"
-void print_hex_value(unsigned value)
+void print_hex_value(unsigned 32 value)
{
unsigned 8 ch;
unsigned 4 i;
- unsigned 32 tempvalue;
-
- tempvalue = 0 @ value;
for(i = 0;i < 8;i++)
{
- ch = 0 @ (tempvalue\\28);
- tempvalue <<= 4;
+ ch = 0 @ (value\\28);
+ value <<= 4;
ch += (ch > 9) ? 0x37 : 0x30;
PalDataPortWrite(PalRS232PortCT(0), ch);
}
}
void print_string(unsigned char *s) {
- unsigned 4 i;
- i = 0;
- for(i = 0;'\0' != s[i];i++)
- {
- PalDataPortWrite(PalRS232PortCT(0), s[i]);
+ unsigned 10 index;
+
+ /*
+ * We print all elements from the provided array until we encounter the
+ * '\0' character. Since standard C and Handel-C both end a string
+ * with the '\0' character. Since Handel-C init's var's to 0 this
+ * normally will never go wrong.
+ */
+ for(index = 0; '\0' != s[index]; index++) {
+ PalDataPortWrite(PalRS232PortCT(0), s[index]);
}
-
}
-void print_eol(void)
-{
- PalDataPortWrite(PalRS232PortCT(0), 0x0A);
- PalDataPortWrite(PalRS232PortCT(0), 0x0D);
+
+
+void print_eol(void) {
+ /*
+ * To write a clean 'return' we have to both write the newline and
+ * carriage return symbol.
+ */
+ PalDataPortWrite(PalRS232PortCT(0), 0x0a);
+ PalDataPortWrite(PalRS232PortCT(0), 0x0d);
+}
+
+
+
+void print_cr(void) {
+ /*
+ * Write the character that forces the cursor to go back to the
+ * beginning of the line.
+ */
+ PalDataPortWrite(PalRS232PortCT(0), 0x0d);
+}
+
+
+
+void print_cls(void) {
+ /*
+ * Write the clearscreen character to the RS232 port.
+ */
+ PalDataPortWrite(PalRS232PortCT(0), 0x0c);
} \ No newline at end of file