aboutsummaryrefslogtreecommitdiff
path: root/int10vga.h
diff options
context:
space:
mode:
authorJavier <dev.git@javispedro.com>2022-03-29 01:15:53 +0200
committerJavier <dev.git@javispedro.com>2022-03-29 01:15:53 +0200
commita816d1a09b1045fb5c155ac73f3231fcf9d93180 (patch)
treec4e31e850b9f2afb36acd6119483cf350c33f596 /int10vga.h
parent67ebca92621aef31ff97705013456e95e60f7fbe (diff)
downloadvbados-a816d1a09b1045fb5c155ac73f3231fcf9d93180.tar.gz
vbados-a816d1a09b1045fb5c155ac73f3231fcf9d93180.zip
initial import of DOS mouse driver
Diffstat (limited to 'int10vga.h')
-rw-r--r--int10vga.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/int10vga.h b/int10vga.h
new file mode 100644
index 0000000..f3e0a07
--- /dev/null
+++ b/int10vga.h
@@ -0,0 +1,41 @@
+#ifndef INT10_H
+#define INT10_H
+
+#include <stdint.h>
+
+#define BIOS_DATA_AREA_SEGMENT 0x40
+
+static uint8_t int10_get_video_mode(uint8_t *screenwidth, uint8_t *videopage);
+#pragma aux int10_get_video_mode = \
+ "mov al, 0" \
+ "mov ah, 0x0F" \
+ "int 0x10" \
+ "mov ss:[si], ah" \
+ "mov ss:[di], bh" \
+ __parm [si] [di] \
+ __value [al] \
+ __modify [ax bh]
+
+static inline uint16_t bda_get_word(unsigned int offset) {
+ uint16_t __far *p = MK_FP(BIOS_DATA_AREA_SEGMENT, offset);
+ return *p;
+}
+
+static inline uint8_t bda_get_byte(unsigned int offset) {
+ uint8_t __far *p = MK_FP(BIOS_DATA_AREA_SEGMENT, offset);
+ return *p;
+}
+
+#define bda_get_video_mode() bda_get_byte(0x49)
+#define bda_get_num_columns() bda_get_word(0x4a)
+#define bda_get_video_page_size() bda_get_word(0x4c)
+//#define bda_get_tick_count() bda_get_dword(0x6c)
+#define bda_get_tick_count_lo() bda_get_word(0x6c)
+
+static inline uint16_t __far * get_video_char(uint8_t page, unsigned int x, unsigned int y)
+{
+ return MK_FP(0xB800, (page * bda_get_video_page_size())
+ + ((y * bda_get_num_columns()) + x) * 2);
+}
+
+#endif