summaryrefslogtreecommitdiffstats
path: root/Support_Libs
diff options
context:
space:
mode:
authorOliver Schinagl <oliver@schinagl.nl>2004-11-11 10:27:31 (GMT)
committerOliver Schinagl <oliver@schinagl.nl>2004-11-11 10:27:31 (GMT)
commit9877678730e53e9ee99241a8ab5babe35eacf28d (patch)
tree275313725d8a1816a665b892c6116549e26f24a7 /Support_Libs
parent51085a870cc074c3eeef5a6ba1b45503ce0e0f4d (diff)
downloadTASS-9877678730e53e9ee99241a8ab5babe35eacf28d.zip
TASS-9877678730e53e9ee99241a8ab5babe35eacf28d.tar.gz
TASS-9877678730e53e9ee99241a8ab5babe35eacf28d.tar.bz2
Diffstat (limited to 'Support_Libs')
-rw-r--r--Support_Libs/debug/debug.hcc57
-rw-r--r--Support_Libs/debug/debug.hch6
2 files changed, 45 insertions, 18 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
diff --git a/Support_Libs/debug/debug.hch b/Support_Libs/debug/debug.hch
index c2656f2..8777b4b 100644
--- a/Support_Libs/debug/debug.hch
+++ b/Support_Libs/debug/debug.hch
@@ -12,7 +12,7 @@
* Post: A hex representation of value is printed.
*
****************************************************************************/
-void print_hex_value(unsigned value);
+void print_hex_value(unsigned 32 value);
/****************************************************************************
*
@@ -30,4 +30,6 @@ void print_hex_value(unsigned value);
void print_string(unsigned char *s);
-void print_eol(void); \ No newline at end of file
+void print_eol(void);
+void print_cr(void);
+void print_cls(void); \ No newline at end of file