summaryrefslogtreecommitdiff
path: root/FAQ-cd.txt
diff options
context:
space:
mode:
authorPixel <Pixel>2002-05-23 14:07:46 +0000
committerPixel <Pixel>2002-05-23 14:07:46 +0000
commitbdbd7e1296b98081794e0b185a0b8b677c811359 (patch)
tree18b17064b2b5026d3272ac573b6728fed418c476 /FAQ-cd.txt
parent983358288de02d3bbf09a007f67d6f7d01bc2eff (diff)
Again FILE * removing... this is boring!
Diffstat (limited to 'FAQ-cd.txt')
-rw-r--r--FAQ-cd.txt9
1 files changed, 5 insertions, 4 deletions
diff --git a/FAQ-cd.txt b/FAQ-cd.txt
index 4a3a92b..778b0d7 100644
--- a/FAQ-cd.txt
+++ b/FAQ-cd.txt
@@ -131,10 +131,11 @@ A: Firstly, when you have a raw sector, you have to understand its primary form.
in packed BCD format. You may know what the BCD format is if you are "old"
enough for that. I won't enter into the details so if you want a more
description of the BCD format, look into the net. You only have to know that:
-
-unsigned char from_BCD(unsigned char x) {return ((x & 15) + (x & 240) * 10));}
-unsigned char to_BCD(unsigned char x) {return ((x / 10) << 4) | (x % 10));}
-int is_valid_BCD(unsigned char x) {return (((x & 15) < 10) && ((x >> 4) < 10));}
+
+typedef unsigned char uchar;
+uchar from_BCD(uchar x) {return ((x & 15) + ((x & 240) >> 4) * 10));}
+uchar to_BCD(uchar x) {return ((x / 10) << 4) | (x % 10));}
+int is_valid_BCD(uchar x) {return (((x & 15) < 10) && ((x >> 4) < 10));}
Last thing: when you look at a BCD packed number, you have to read it in
hexadecimal, and then you will see a "decimal" number. So when you count