projects
/
dosdemo
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
minor performance improvements, optional mouse, mouse cursor now drawn
[dosdemo]
/
src
/
util.h
diff --git
a/src/util.h
b/src/util.h
index
76dd044
..
b305d78
100644
(file)
--- a/
src/util.h
+++ b/
src/util.h
@@
-5,12
+5,15
@@
#ifdef __GNUC__
#define INLINE __inline
#ifdef __GNUC__
#define INLINE __inline
+#define PACKED __attribute__((packed))
#elif defined(__WATCOMC__)
#define INLINE __inline
#elif defined(__WATCOMC__)
#define INLINE __inline
+#define PACKED
#else
#define INLINE
#else
#define INLINE
+#define PACKED
#endif
/* fast conversion of double -> 32bit int
#endif
/* fast conversion of double -> 32bit int
@@
-46,6
+49,14
@@
void perf_end(void);
void debug_break(void);
#pragma aux debug_break = "int 3";
void debug_break(void);
#pragma aux debug_break = "int 3";
+
+void halt(void);
+#pragma aux halt = "hlt";
+
+void memset16(void *ptr, int val, int count);
+#pragma aux memset16 = \
+ "rep stosw" \
+ parm[edi][eax][ecx];
#endif
#ifdef __GNUC__
#endif
#ifdef __GNUC__
@@
-69,6
+80,13
@@
void debug_break(void);
#define debug_break() \
asm volatile ("int $3")
#define debug_break() \
asm volatile ("int $3")
+
+#define halt() \
+ asm volatile("hlt")
+
+#define memset16(ptr, val, count) asm volatile ( \
+ "rep stosw\n\t" \
+ :: "D"(ptr), "a"(val), "c"(count))
#endif
#ifdef _MSC_VER
#endif
#ifdef _MSC_VER
@@
-97,6
+115,16
@@
void debug_break(void);
do { \
__asm { int 3 } \
} while(0)
do { \
__asm { int 3 } \
} while(0)
+
+#define memset16(ptr, val, count) \
+ do { \
+ __asm { \
+ mov edi, ptr \
+ mov ecx, count \
+ mov eax, val \
+ rep stosw \
+ } \
+ } while(0)
#endif
#endif /* UTIL_H_ */
#endif
#endif /* UTIL_H_ */