summaryrefslogtreecommitdiffstats
path: root/include/system.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/system.h')
-rw-r--r--include/system.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/system.h b/include/system.h
new file mode 100644
index 0000000..9440d6b
--- /dev/null
+++ b/include/system.h
@@ -0,0 +1,21 @@
+#define IN_PORT(p,b) asm("in %1,%0" : "=a" ((unsigned char)(b)) : "d" ((unsigned short)(p)) )
+#define IN_PORT_P(p,b) asm("in %1,%0;in $0x80,%%al" : "=a" ((unsigned char)(b)) : "d" ((unsigned short)(p)) )
+#define IN_PORT_PP(p,b) asm("in %1,%0;in $0x80,%%al;in $0x80,%%al;in $0x80,%%al;in $0x80,%%al" \
+ : "=a" ((unsigned char)(b)) : "d" ((unsigned short)(p)) )
+#define OUT_PORT(b,p) asm("out %0,%1" : : "a" ((unsigned char)(b)), "d" ((unsigned short)(p)) )
+#define OUT_PORT_P(b,p) asm("out %0,%1;in $0x80,%%al" : : "a" ((unsigned char)(b)), "d" ((unsigned short)(p)) )
+#define OUT_PORT_PP(b,p) asm("out %0,%1;in $0x80,%%al;in $0x80,%%al;in $0x80,%%al;in $0x80,%%al" \
+ : : "a" ((unsigned char)(b)), "d" ((unsigned short)(p)) )
+
+#define ANSI2ASCII(x) asm ("mov %0,%%dl;call ansi2ascii;mov %%dl,%0\n" : "+m" (x))
+#define ASCII2ANSI(x) asm ("mov %0,%%dl;call ascii2ansi;mov %%dl,%0\n" : "+m" (x))
+
+
+void print(unsigned char * text);
+void print_attr(unsigned char * text, unsigned char attr);
+void print_char(unsigned char text);
+void print_char_attr(unsigned char text, unsigned char attr);
+
+void print_hex_byte(unsigned char hex);
+void print_hex_word(unsigned short hex);
+void print_hex_long(unsigned long hex);